2
# Copyright (C) 2009 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-tests features:
21
# - dependencies between tests
22
# - DISABLE_HARD_ERRORS
31
cat >> configure.in << 'END'
35
cat > Makefile.am << 'END'
36
TEST_SUITE_LOG = mylog.log
37
TESTS = foo.test bar.test baz.test
38
XFAIL_TESTS = bar.test
43
cat >>foo.test <<'END'
48
cat >>bar.test <<'END'
53
cat >>baz.test <<'END'
58
chmod a+x foo.test bar.test baz.test
67
# No hard errors: all tests should be run, there should be one failure.
68
env DISABLE_HARD_ERRORS=yes $MAKE -e check >stdout && { cat stdout; Exit 1; }
70
test `grep -c '^FAIL' stdout` -eq 1
72
test `grep -c '^FAIL' mylog.log` -eq 1
76
# The summary should be formatted correctly.
77
grep 'failedn' stdout && Exit 1
79
# clean should remove all log files (but not more).
89
$MAKE check >stdout && { cat stdout; Exit 1; }
91
# Now, there should be two errors: bar.test is a hard error.
92
test `grep -c '^FAIL' stdout` -eq 2
93
test `grep -c '^FAIL' mylog.log` -eq 2
95
# Check dependencies: baz.test needs to run before bar.test,
96
# but foo.test is not needed.
97
# Note that this usage has a problem: the summary will only
98
# take bar.log into account, because the $(TEST_SUITE_LOG) rule
99
# does not "see" baz.log. Hmm.
101
env TESTS='bar.test' $MAKE -e check && Exit 1
107
# Upon a lazy rerun, foo.test should be run, but the others shouldn't.
108
# Note that the lazy rerun still exits with a failure, due to the previous
110
# Note that the previous test and this one taken together expose the timing
111
# issue that requires the check-TESTS rule to always remove TEST_SUITE_LOG
112
# before running the tests lazily.
113
env RECHECK_LOGS= $MAKE -e check > stdout && { cat stdout; Exit 1; }
117
grep bar.test stdout && Exit 1
118
grep baz.test stdout && Exit 1
119
grep '2.*tests.*failed' stdout
121
# Now, explicitly retry with all test logs already updated, and ensure
122
# that the summary is still displayed.
123
env RECHECK_LOGS= $MAKE -e check > stdout && { cat stdout; Exit 1; }
125
grep foo.test stdout && Exit 1
126
grep bar.test stdout && Exit 1
127
grep baz.test stdout && Exit 1
128
grep '2.*tests.*failed' stdout
130
# Lazily rerunning only foo should only rerun this one test.
131
env RECHECK_LOGS=foo.log $MAKE -e check > stdout && { cat stdout; Exit 1; }
134
grep bar.test stdout && Exit 1
135
grep baz.test stdout && Exit 1
136
grep '2.*tests.*failed' stdout
139
env VERBOSE=yes $MAKE -e check > stdout && { cat stdout; Exit 1; }
141
grep 'this is.*bar.test' stdout
142
grep 'this is.*baz.test' stdout
145
env TEST_LOGS=baz.log $MAKE -e check > stdout && { cat stdout; Exit 1; }
147
grep foo.test stdout && Exit 1
148
grep bar.test stdout && Exit 1
152
env TESTS=baz.test $MAKE -e check > stdout && { cat stdout; Exit 1; }
154
grep foo.test stdout && Exit 1
155
grep bar.test stdout && Exit 1