2 # Copyright (C) 2009-2013 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 # Basic checks on parallel-tests support:
19 # - log files, and what goes in 'test-suite.log'
21 # - dependencies between tests
22 # - TESTS redefinition at runtime
23 # - TEST_LOGS redefinition at runtime
24 # - RECHECK_LOGS redefinition at runtime
28 cat >> configure.ac << 'END'
32 cat > Makefile.am << 'END'
33 TESTS = foo.test bar.test baz.test
34 XFAIL_TESTS = bar.test
39 # foo.test and bar.test sleep to ensure their logs are always strictly newer
40 # than the logs of their prerequisites, for HP-UX make. The quoting pleases
42 cat > foo.test <<'END'
48 cat > bar.test <<'END'
54 cat > baz.test <<'END'
59 chmod a+x foo.test bar.test baz.test
67 run_make -O -e FAIL check
68 count_test_results total=3 pass=1 fail=1 skip=0 xfail=0 xpass=0 error=1
69 test -f test-suite.log
71 test $(grep -c '^FAIL:' test-suite.log) -eq 1
72 test $(grep -c '^ERROR:' test-suite.log) -eq 1
73 $EGREP '^(X?PASS|XFAIL|SKIP)' test-suite.log && exit 1
82 test ! -e test-suite.log
84 # Check dependencies: baz.test needs to run before bar.test,
85 # but foo.test is not needed.
86 # Note that this usage has a problem: the summary will only
87 # take bar.log into account, because the $(TEST_SUITE_LOG) rule
88 # does not "see" baz.log. Hmm.
89 run_make -O -e FAIL TESTS='bar.test' check
90 grep '^FAIL: baz\.test$' stdout
91 grep '^ERROR: bar\.test$' stdout
96 test -f test-suite.log
98 # Upon a lazy rerun, foo.test should be run, but the others shouldn't.
99 # Note that the lazy rerun still exits with a failure, due to the previous
101 # Note that the previous test and this one taken together expose the timing
102 # issue that requires the check-TESTS rule to always remove TEST_SUITE_LOG
103 # before running the tests lazily.
104 run_make -O -e FAIL check RECHECK_LOGS=
106 grep '^PASS: foo\.test$' stdout
107 grep bar.test stdout && exit 1
108 grep baz.test stdout && exit 1
109 grep '^# PASS: *1$' stdout
110 grep '^# FAIL: *1$' stdout
111 grep '^# ERROR: *1$' stdout
113 # Now, explicitly retry with all test logs already updated, and ensure
114 # that the summary is still displayed.
115 run_make -O -e FAIL check RECHECK_LOGS=
116 grep foo.test stdout && exit 1
117 grep bar.test stdout && exit 1
118 grep baz.test stdout && exit 1
119 grep '^# PASS: *1$' stdout
120 grep '^# FAIL: *1$' stdout
121 grep '^# ERROR: *1$' stdout
123 # Lazily rerunning only foo should only rerun this one test.
124 run_make -O -e FAIL check RECHECK_LOGS=foo.log
126 grep bar.test stdout && exit 1
127 grep baz.test stdout && exit 1
128 grep '^# PASS: *1$' stdout
129 grep '^# FAIL: *1$' stdout
130 grep '^# ERROR: *1$' stdout
133 run_make -O -e FAIL TEST_LOGS=baz.log check
134 grep foo.test stdout && exit 1
135 grep bar.test stdout && exit 1
139 run_make -O -e FAIL TESTS=baz.test check
140 grep foo.test stdout && exit 1
141 grep bar.test stdout && exit 1