2 # Copyright (C) 2011-2024 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 <https://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 run_make
-O TEST_STATUS
=1 bar.trs baz.trs
72 grep '^FAIL: bar\.test' stdout
73 $EGREP '^(baz|foo)\.test' stdout
&& exit 1
75 : Recreate with a sweeping
"make check", and ensure that also up-to-date
76 : '.trs' files are remade.
82 is_newest baz.trs stamp
84 : Recreate with a sweeping
"make check" with failing tests. Again
,
85 : ensure that also up-to-date
'.trs' files are remade
-- this
time we
86 : grep the
"make check" output verify that.
88 run_make
-O -e FAIL TEST_STATUS
=1 check
91 grep '^FAIL: foo\.test' stdout
92 grep '^FAIL: bar\.test' stdout
93 grep '^PASS: baz\.test' stdout
95 : Recreate with a
"make check" with redefined TESTS.
96 rm -f foo.trs bar.trs baz.trs
97 run_make TESTS
=foo.
test check
102 : Recreate with a
"make check" with redefined TEST_LOGS.
103 rm -f foo.trs bar.trs baz.trs
104 run_make TEST_LOGS
=bar.log check
109 : Interactions with
"make recheck" are OK.
110 rm -f foo.trs bar.trs baz.log baz.trs
116 grep '^PASS: foo\.test' stdout
117 grep '^PASS: bar\.test' stdout
118 grep 'baz\.test' stdout
&& exit 1
119 count_test_results total
=2 pass
=2 fail
=0 xpass
=0 xfail
=0 skip
=0 error
=0
121 : Setup
for the next check.
127 : Recreate by remaking the global
test log
, and ensure that up-to-date
128 : '.trs' files are
*not
* remade.
130 rm -f foo.trs bar.trs test-suite.log
131 run_make
-O test-suite.log
132 grep '^PASS: foo\.test' stdout
133 grep '^PASS: bar\.test' stdout
134 grep 'baz\.test' stdout
&& exit 1
135 stat
*.trs
*.log stamp ||
: # For debugging.
136 # Check that make has updated what it needed to, but no more.
139 is_newest stamp baz.trs
140 is_newest test-suite.log foo.trs bar.trs
142 : Setup
for the next check.
148 : Interactions with lazy
test reruns are OK.
152 run_make
-O RECHECK_LOGS
= check
153 # Check that make has updated what it needed to, but no more.
155 is_newest bar.trs bar.
test
156 is_newest stamp baz.trs
157 grep '^PASS: foo\.test' stdout
158 grep '^PASS: bar\.test' stdout
159 grep 'baz\.test' stdout
&& exit 1