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 # Check parallel harness features:
18 # - recovery from deleted '.trs' files, in various scenarios
19 # This test is complex and tricky, but that's acceptable since we are
20 # testing semantics that are potentially complex and tricky.
24 cat >> configure.ac
<<END
28 cat > Makefile.am
<< 'END'
29 TESTS
= foo.
test bar.
test baz.
test
30 TEST_LOG_COMPILER
= $
(SHELL
)
33 echo 'exit $TEST_STATUS' > foo.
test
34 echo 'exit $TEST_STATUS' > bar.
test
37 TEST_STATUS
=0; export TEST_STATUS
39 # Slower and possible overkill in some situations, but also clearer
41 update_stamp
() { $sleep && touch stamp
&& $sleep; }
49 : Create the required log files.
53 rm -f foo.trs bar.trs baz.trs
59 : Recreate by hand
, several
at the same
time.
60 rm -f foo.trs bar.trs baz.trs
66 : Recreate by hand
, with a failing
test.
68 TEST_STATUS
=1 $MAKE bar.trs baz.trs
>stdout ||
{ cat stdout
; exit 1; }
73 grep '^FAIL: bar\.test' stdout
74 $EGREP '^(baz|foo)\.test' stdout
&& exit 1
76 : Recreate with a sweeping
"make check", and ensure that also up-to-date
77 : '.trs' files are remade.
83 is_newest baz.trs stamp
85 : Recreate with a sweeping
"make check" with failing tests. Again
,
86 : ensure that also up-to-date
'.trs' files are remade
-- this
time we
87 : grep the
"make check" output verify that.
89 TEST_STATUS
=1 $MAKE check
>stdout
&& { cat stdout
; exit 1; }
92 grep '^FAIL: foo\.test' stdout
93 grep '^FAIL: bar\.test' stdout
94 grep '^PASS: baz\.test' stdout
96 : Recreate with a
"make check" with redefined TESTS.
97 rm -f foo.trs bar.trs baz.trs
98 TESTS
=foo.
test $MAKE -e check
103 : Recreate with a
"make check" with redefined TEST_LOGS.
104 rm -f foo.trs bar.trs baz.trs
105 TEST_LOGS
=bar.log
$MAKE -e check
110 : Interactions with
"make recheck" are OK.
111 rm -f foo.trs bar.trs baz.log baz.trs
112 $MAKE recheck
>stdout ||
{ cat stdout
; exit 1; }
118 grep '^PASS: foo\.test' stdout
119 grep '^PASS: bar\.test' stdout
120 grep 'baz\.test' stdout
&& exit 1
121 count_test_results total
=2 pass
=2 fail
=0 xpass
=0 xfail
=0 skip
=0 error
=0
123 : Setup
for the next check.
129 : Recreate by remaking the global
test log
, and ensure that up-to-date
130 : '.trs' files are
*not
* remade.
132 rm -f foo.trs bar.trs test-suite.log
133 $MAKE test-suite.log
>stdout ||
{ cat stdout
; exit 1; }
135 grep '^PASS: foo\.test' stdout
136 grep '^PASS: bar\.test' stdout
137 grep 'baz\.test' stdout
&& exit 1
138 stat
*.trs
*.log stamp ||
: # For debugging.
139 # Check that make has updated what it needed to, but no more.
142 is_newest stamp baz.trs
143 is_newest test-suite.log foo.trs bar.trs
145 : Setup
for the next check.
151 : Interactions with lazy
test reruns are OK.
155 RECHECK_LOGS
= $MAKE -e check
>stdout ||
{ cat stdout
; exit 1; }
157 # Check that make has updated what it needed to, but no more.
159 is_newest bar.trs bar.
test
160 is_newest stamp baz.trs
161 grep '^PASS: foo\.test' stdout
162 grep '^PASS: bar\.test' stdout
163 grep 'baz\.test' stdout
&& exit 1