2 # Copyright (C) 2011 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 # Parallel test harness: check that $(TESTS) can lazily depend on
18 # (or even be) $(EXTRA_PROGRAMS).
24 cat >> configure.
in << 'END'
29 # Will be extended later.
30 cat > Makefile.am
<< 'END'
31 TEST_EXTENSIONS
= .bin .
test
37 # Now try various kinds of test dependencies ...
40 # 1. A program that is also a test, and whose source files
43 cat >> Makefile.am
<<'END'
44 EXTRA_PROGRAMS += foo.bin
46 foo_bin_SOURCES = foo.c
53 printf ("foofoofoo\n");
58 # 2. A program that is also a test, and whose source files
59 # are buildable by make.
60 cat >> Makefile.am
<<'END'
61 EXTRA_PROGRAMS += bar.bin
63 bar_bin_SOURCES = bar.c
65 sed -e 's/foofoofoo/barbarbar/' foo.c > $@
68 # 3. A test script that already exists, whose execution depends
69 # on a program whose source files already exist and which is
71 cat >> Makefile.am
<<'END'
77 cat > baz.
test <<'END'
79 $srcdir/y "$@" | sed 's/.*/&ep&ep&ep/'
92 # 4. A program that is also a test, but whose source files
93 # do not exit and are not buildable by make.
95 cat >> Makefile.am
<<'END'
96 EXTRA_PROGRAMS += none.bin
98 none_bin_SOURCES = none.c
102 # Setup done, go with the tests.
112 # 1. even if we cannot build the `none.bin' program, all the other
113 # test programs should be built, and all the other tests should
115 # 2. still, since we cannot create the `none.log' file, the
116 # `test-suite.log' file shouldn't be created (as it depends
117 # on *all* the test logs).
120 $MAKE check
>stdout
2>stderr || st
=$?
124 test $st -gt 0 || Exit
1
126 # Files that should have been created, with the expected content.
128 grep foofoofoo foo.log
129 grep barbarbar bar.log
130 grep yepyepyep baz.log
131 # Files that shouldn't have been created.
133 test ! -f test-suite.log
134 # Expected testsuite progress output.
135 grep '^PASS: baz\.test$' stdout
136 # Don't anchor the end of the next two patterns, to allow for non-empty
138 grep '^PASS: foo\.bin' stdout
139 grep '^PASS: bar\.bin' stdout
140 # Expected error messages from make.
141 $EGREP 'none\.(bin|o|c)' stderr
144 # 1. if we make the last EXTRA_PROGRAM buildable, the failed tests
146 # 2. on a lazy re-run, the passed tests are not re-run, and
147 # 3. their log files are not updated or touched.
152 echo 'int main (void) { return 0; }' > none.c
155 RECHECK_LOGS
= $MAKE -e check
>stdout || st
=$?
158 test $st -eq 0 || Exit
1
161 stat stamp foo.log bar.log baz.log ||
:
163 # Files that shouldn't have been updated or otherwise touched.
164 is_newest stamp foo.log bar.log baz.log
165 # Files that should have been created now.
167 test -f test-suite.log
168 # Tests that shouldn't have been re-run.
169 $EGREP '(foo|bar)\.bin|baz\.test$' stdout
&& Exit
1
170 # Tests that should have been run. Again, we don't anchor the end
171 # of the next pattern, to allow for non-empty $(EXEEXT).
172 grep '^PASS: none\.bin' stdout