2 # Copyright (C) 2011 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.test' and
22 # `parallel-tests-recheck-override.test'.
27 cp "$testsrcdir"/trivial-test-driver . \
28 || fatal_
"failed to fetch auxiliary script trivial-test-driver"
30 cat >> configure.
in << 'END'
34 cat > Makefile.am
<< 'END'
35 TEST_LOG_DRIVER
= $
(SHELL
) $
(srcdir
)/trivial-test-driver
36 TESTS
= a.
test b.
test c.
test
59 if test -f c.err
; then
61 elif test -f c.ok
; then
75 for vpath
in : false
; do
86 : Run the tests
for the first
time.
87 $MAKE check
>stdout
&& { cat stdout
; Exit
1; }
89 # All the test scripts should have run.
93 count_test_results total
=5 pass
=2 fail
=1 xpass
=1 xfail
=0 skip
=1 error
=0
97 : An empty
'$(TESTS)' or
'$(TEST_LOGS)' means that no
test should be run.
98 for var
in TESTS TEST_LOGS
; do
99 env
"$var=" $MAKE -e recheck
>stdout ||
{ cat stdout
; Exit
1; }
101 count_test_results total
=0 pass
=0 fail
=0 xpass
=0 xfail
=0 skip
=0 error
=0
108 : a.
test was sucessfull the first
time, no need to re-run it.
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.
119 TEST_LOGS
=b.log
$MAKE -e recheck
>stdout \
120 ||
{ cat stdout
; Exit
1; }
125 count_test_results total
=2 pass
=0 fail
=0 xpass
=0 xfail
=1 skip
=1 error
=0
129 : No need to re-run a.
test or b.
test anymore.
130 TEST_LOGS
=b.log
$MAKE -e recheck
>stdout \
131 ||
{ cat stdout
; Exit
1; }
133 count_test_results total
=0 pass
=0 fail
=0 xpass
=0 xfail
=0 skip
=0 error
=0
137 TESTS
='a.test b.test' $MAKE -e recheck
>stdout \
138 ||
{ cat stdout
; Exit
1; }
140 count_test_results total
=0 pass
=0 fail
=0 xpass
=0 xfail
=0 skip
=0 error
=0
145 : No need to re-run a.
test anymore
, but c.
test should be rerun
,
146 : as it contained an XPASS. And this
time, make it fail with
148 # Use `echo' here, since Solaris 10 /bin/sh would try to optimize
149 # a `:' away after the first iteration, even if it is redirected.
151 env TEST_LOGS
='a.log c.log' $MAKE -e recheck
>stdout \
152 && { cat stdout
; Exit
1; }
154 count_test_results total
=1 pass
=0 fail
=0 xpass
=0 xfail
=0 skip
=0 error
=1
161 : c.
test contained and hard error the last
time, so it should be re-run.
162 : This
time, make it pass
163 # Use `echo', not `:'; see comments above for why.
165 env TESTS
='c.test a.test' $MAKE -e recheck
>stdout \
166 ||
{ cat stdout
; Exit
1; }
168 count_test_results total
=1 pass
=1 fail
=0 xpass
=0 xfail
=0 skip
=0 error
=0
173 rm -f *.run
*.err
*.ok
175 : Nothing should be rerun anymore
, as all tests have been eventually
177 $MAKE recheck
>stdout ||
{ cat stdout
; Exit
1; }
179 count_test_results total
=0 pass
=0 fail
=0 xpass
=0 xfail
=0 skip
=0 error
=0