2 # Copyright (C) 2011-2012 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/>.
18 # - testsuite progress on console should happen mostly "in real time";
19 # i.e., it's not acceptable for the driver to wait the end of the
20 # script to start displaying results from it.
21 # FIXME: this test uses expect(1) to ensure line buffering from make and
22 # children, and is pretty hacky and complex; is there a better way to
23 # accomplish the checks done here?
27 cat >expect-check <<'END'
28 eval spawn $env(SHELL) -c ":"
31 expect -f expect-check || {
32 echo "$me: failed to find a working expect program" >&2
37 # Unfortunately, some make implementations (among them, FreeBSD make,
38 # NetBSD make, and Solaris Distributed make), when run in parallel mode,
39 # serialize the output from their targets' recipes unconditionally. In
40 # such a situation, there's no way the partial results of a TAP test can
41 # be displayed until the test has terminated. And this is not something
42 # our TAP driver script can work around; in fact, the driver *is* sending
43 # out its output progressively and "in sync" with test execution -- it is
44 # make that is stowing such output away instead of presenting it to the
45 # user as soon as it gets it.
46 if ! using_gmake; then
48 *\ -j*) skip_ "doesn't with non-GNU concurrent make";;
50 # Prevent Sun Distributed Make from trying to run in parallel.
51 DMAKE_MODE=serial; export DMAKE_MODE
54 cat > Makefile.am << 'END'
61 cat > all.test <<'END'
65 # Creative quoting to placate maintainer-check.
68 # The awk+shell implementation of the TAP driver must "read ahead" of one
69 # line in order to catch the exit status of the test script it runs. So
70 # be sure to echo one "dummy" line after each result line in order not to
71 # cause false positives.
76 test -f ok-1 || { echo 'Bail out!'; exit 1; }
81 test -f ok-2 || { echo 'Bail out!'; exit 1; }
86 test -f ok-3 || { echo 'Bail out!'; exit 1; }
93 cat > expect-make <<'END'
94 eval spawn $env(MAKE) check
96 "PASS: all.test 1 - foo" {
100 "PASS: all.test 2 - bar" {
104 "PASS: all.test 3 - baz" {
108 "Testsuite summary" {
112 puts "expect timed out"
122 # Expect should simulate a tty as stdout, which should ensure a
123 # line-buffered output.
124 MAKE=$MAKE expect -f expect-make