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 # Creative quoting below to please maintainer-check.
34 echo exit '$TEST_STATUS' > foo.test
35 echo exit '$TEST_STATUS' > bar.test
38 TEST_STATUS=0; export TEST_STATUS
40 # Slower and possible overkill in some situations, but also clearer
42 update_stamp () { $sleep && touch stamp && $sleep; }
50 : Create the required log files.
54 rm -f foo.trs bar.trs baz.trs
60 : Recreate by hand, several at the same time.
61 rm -f foo.trs bar.trs baz.trs
67 : Recreate by hand, with a failing test.
69 TEST_STATUS=1 $MAKE bar.trs baz.trs >stdout || { cat stdout; exit 1; }
74 grep '^FAIL: bar\.test' stdout
75 $EGREP '^(baz|foo)\.test' stdout && exit 1
77 : Recreate with a sweeping "make check", and ensure that also up-to-date
78 : '.trs' files are remade.
84 is_newest baz.trs stamp
86 : Recreate with a sweeping "make check" with failing tests. Again,
87 : ensure that also up-to-date '.trs' files are remade -- this time we
88 : grep the "make check" output verify that.
90 TEST_STATUS=1 $MAKE check >stdout && { cat stdout; exit 1; }
93 grep '^FAIL: foo\.test' stdout
94 grep '^FAIL: bar\.test' stdout
95 grep '^PASS: baz\.test' stdout
97 : Recreate with a "make check" with redefined TESTS.
98 rm -f foo.trs bar.trs baz.trs
99 TESTS=foo.test $MAKE -e check
104 : Recreate with a "make check" with redefined TEST_LOGS.
105 rm -f foo.trs bar.trs baz.trs
106 TEST_LOGS=bar.log $MAKE -e check
111 : Interactions with "make recheck" are OK.
112 rm -f foo.trs bar.trs baz.log baz.trs
113 $MAKE recheck >stdout || { cat stdout; exit 1; }
119 grep '^PASS: foo\.test' stdout
120 grep '^PASS: bar\.test' stdout
121 grep 'baz\.test' stdout && exit 1
122 count_test_results total=2 pass=2 fail=0 xpass=0 xfail=0 skip=0 error=0
124 : Setup for the next check.
130 : Recreate by remaking the global test log, and ensure that up-to-date
131 : '.trs' files are *not* remade.
133 rm -f foo.trs bar.trs test-suite.log
134 $MAKE test-suite.log >stdout || { cat stdout; exit 1; }
136 grep '^PASS: foo\.test' stdout
137 grep '^PASS: bar\.test' stdout
138 grep 'baz\.test' stdout && exit 1
139 stat *.trs *.log stamp || : # For debugging.
140 # Check that make has updated what it needed to, but no more.
143 is_newest stamp baz.trs
144 is_newest test-suite.log foo.trs bar.trs
146 : Setup for the next check.
152 : Interactions with lazy test reruns are OK.
156 RECHECK_LOGS= $MAKE -e check >stdout || { cat stdout; exit 1; }
158 # Check that make has updated what it needed to, but no more.
160 is_newest bar.trs bar.test
161 is_newest stamp baz.trs
162 grep '^PASS: foo\.test' stdout
163 grep '^PASS: bar\.test' stdout
164 grep 'baz\.test' stdout && exit 1