2 # Copyright (C) 2011-2012 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 # Custom test drivers: try the "recheck" functionality with test protocols
18 # that allow multiple testcases in a single test script. In particular,
19 # check that this still works when we override $(TESTS) and $(TEST_LOGS)
21 # See also related tests 'test-driver-custom-multitest-recheck.sh' and
22 # 'parallel-tests-recheck-override.sh'.
26 cp "$am_testaux_srcdir"/trivial-test-driver . \
27 || fatal_
"failed to fetch auxiliary script trivial-test-driver"
29 cat >> configure.ac
<< 'END'
33 cat > Makefile.am
<< 'END'
34 TEST_LOG_DRIVER
= $
(SHELL
) $
(srcdir
)/trivial-test-driver
35 TESTS
= a.
test b.
test c.
test
58 if test -f c.err
; then
60 elif test -f c.ok
; then
74 for vpath
in : false
; do
85 : Run the tests
for the first
time.
86 $MAKE check
>stdout
&& { cat stdout
; exit 1; }
88 # All the test scripts should have run.
92 count_test_results total
=5 pass
=2 fail
=1 xpass
=1 xfail
=0 skip
=1 error
=0
96 : An empty
'$(TESTS)' or
'$(TEST_LOGS)' means that no
test should be run.
97 for var
in TESTS TEST_LOGS
; do
98 env
"$var=" $MAKE -e recheck
>stdout ||
{ cat stdout
; exit 1; }
100 count_test_results total
=0 pass
=0 fail
=0 xpass
=0 xfail
=0 skip
=0 error
=0
107 : a.
test was successful the first
time, no need to re-run it.
108 using_gmake ||
$sleep # Required by BSD make.
109 env TESTS
=a.
test $MAKE -e recheck
>stdout \
110 ||
{ cat stdout
; exit 1; }
112 count_test_results total
=0 pass
=0 fail
=0 xpass
=0 xfail
=0 skip
=0 error
=0
117 : b.
test failed
, it should be re-run. And
make it pass this
time.
118 using_gmake ||
$sleep # Required by BSD make.
120 TEST_LOGS
=b.log
$MAKE -e recheck
>stdout \
121 ||
{ cat stdout
; exit 1; }
126 count_test_results total
=2 pass
=0 fail
=0 xpass
=0 xfail
=1 skip
=1 error
=0
130 : No need to re-run a.
test or b.
test anymore.
131 using_gmake ||
$sleep # Required by BSD make.
132 TEST_LOGS
=b.log
$MAKE -e recheck
>stdout \
133 ||
{ cat stdout
; exit 1; }
135 count_test_results total
=0 pass
=0 fail
=0 xpass
=0 xfail
=0 skip
=0 error
=0
139 using_gmake ||
$sleep # Required by BSD make.
140 TESTS
='a.test b.test' $MAKE -e recheck
>stdout \
141 ||
{ cat stdout
; exit 1; }
143 count_test_results total
=0 pass
=0 fail
=0 xpass
=0 xfail
=0 skip
=0 error
=0
148 : No need to re-run a.
test anymore
, but c.
test should be rerun
,
149 : as it contained an XPASS. And this
time, make it fail with
152 env TEST_LOGS
='a.log c.log' $MAKE -e recheck
>stdout \
153 && { cat stdout
; exit 1; }
155 count_test_results total
=1 pass
=0 fail
=0 xpass
=0 xfail
=0 skip
=0 error
=1
162 : c.
test contained and hard error the last
time, so it should be re-run.
163 : This
time, make it pass
164 # Use 'echo', not ':'; see comments above for why.
165 using_gmake ||
$sleep # Required by BSD make.
167 env TESTS
='c.test a.test' $MAKE -e recheck
>stdout \
168 ||
{ cat stdout
; exit 1; }
170 count_test_results total
=1 pass
=1 fail
=0 xpass
=0 xfail
=0 skip
=0 error
=0
175 rm -f *.run
*.err
*.ok
177 : Nothing should be rerun anymore
, as all tests have been eventually
179 using_gmake ||
$sleep # Required by BSD make.
180 $MAKE recheck
>stdout ||
{ cat stdout
; exit 1; }
182 count_test_results total
=0 pass
=0 fail
=0 xpass
=0 xfail
=0 skip
=0 error
=0