2 # Copyright (C) 2009, 2010 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
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 # foo.test and bar.test sleep to ensure their logs are always strictly newer
44 # than the logs of their prerequisites, for HP-UX make. The quoting pleases
46 cat >>foo.test <<'END'
52 cat >>bar.test <<'END'
58 cat >>baz.test <<'END'
63 chmod a+x foo.test bar.test baz.test
71 $MAKE check >stdout && { cat stdout; Exit 1; }
73 # There should be two errors: bar.test is a hard error.
74 test `grep -c '^FAIL' stdout` -eq 2
76 test `grep -c '^FAIL' mylog.log` -eq 2
80 # The summary should be formatted correctly.
81 grep 'failedn' stdout && Exit 1
83 # clean should remove all log files (but not more).
92 # Check dependencies: baz.test needs to run before bar.test,
93 # but foo.test is not needed.
94 # Note that this usage has a problem: the summary will only
95 # take bar.log into account, because the $(TEST_SUITE_LOG) rule
96 # does not "see" baz.log. Hmm.
97 env TESTS='bar.test' $MAKE -e check && Exit 1
103 # Upon a lazy rerun, foo.test should be run, but the others shouldn't.
104 # Note that the lazy rerun still exits with a failure, due to the previous
106 # Note that the previous test and this one taken together expose the timing
107 # issue that requires the check-TESTS rule to always remove TEST_SUITE_LOG
108 # before running the tests lazily.
109 env RECHECK_LOGS= $MAKE -e check > stdout && { cat stdout; Exit 1; }
113 grep bar.test stdout && Exit 1
114 grep baz.test stdout && Exit 1
115 grep '2.*tests.*failed' stdout
117 # Now, explicitly retry with all test logs already updated, and ensure
118 # that the summary is still displayed.
119 env RECHECK_LOGS= $MAKE -e check > stdout && { cat stdout; Exit 1; }
121 grep foo.test stdout && Exit 1
122 grep bar.test stdout && Exit 1
123 grep baz.test stdout && Exit 1
124 grep '2.*tests.*failed' stdout
126 # Lazily rerunning only foo should only rerun this one test.
127 env RECHECK_LOGS=foo.log $MAKE -e check > stdout && { cat stdout; Exit 1; }
130 grep bar.test stdout && Exit 1
131 grep baz.test stdout && Exit 1
132 grep '2.*tests.*failed' stdout
135 env VERBOSE=yes $MAKE -e check > stdout && { cat stdout; Exit 1; }
137 grep 'this is.*bar.test' stdout
138 grep 'this is.*baz.test' stdout
141 env TEST_LOGS=baz.log $MAKE -e check > stdout && { cat stdout; Exit 1; }
143 grep foo.test stdout && Exit 1
144 grep bar.test stdout && Exit 1
148 env TESTS=baz.test $MAKE -e check > stdout && { cat stdout; Exit 1; }
150 grep foo.test stdout && Exit 1
151 grep bar.test stdout && Exit 1