]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
tests: fix spurious failures w.r.t. parallel make and colorization
authorStefano Lattarini <stefano.lattarini@gmail.com>
Tue, 8 Nov 2011 17:41:30 +0000 (18:41 +0100)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Tue, 8 Nov 2011 18:01:59 +0000 (19:01 +0100)
* tests/color2.test: Skip the test if the $MAKE program fails to
consider the standard output as a tty when spawned by `expect'.
This is required for make implementations, like FreeBSD make and
Solaris dmake, that redirect the output of recipes to temporary
files or pipes when run in parallel mode.  Since we are at it,
simplify the detection of a working `expect' program, and throw
in other minor simplifications.

ChangeLog
tests/color2.test

index cc917f011893d8454e762af281e82ce03e978fbb..3cd5deafc9a406b0dfa33d286c83db997ee88be9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2011-11-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: fix spurious failures w.r.t. parallel make and colorization
+       * tests/color2.test: Skip the test if the $MAKE program fails to
+       consider the standard output as a tty when spawned by `expect'.
+       This is required for make implementations, like FreeBSD make and
+       Solaris dmake, that redirect the output of recipes to temporary
+       files or pipes when run in parallel mode.  Since we are at it,
+       simplify the detection of a working `expect' program, and throw
+       in other minor simplifications.
+
 2011-11-07  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        tests: fix spurious failure in 'distcheck-override-infodir.test'
index 306aa040cb5a6cbb7e0a297a90d95f95877766ca..2217d8866a266e78bf28674fe8beeb0ec14ad2b5 100755 (executable)
@@ -38,16 +38,31 @@ case `echo "$std" | grep .` in
   *) echo "$me: grep can't parse nonprinting characters" >&2; Exit 77;;
 esac
 
-# Check that we have a working expect program.
-cat >expect-check <<'END'
-#! /usr/bin/expect -f
-spawn $env(THE_SYSTEM_SHELL) -c :
-expect eof
+# This test requires a working a working `expect' program.
+(set +e; expect -c "exit 77"; test $? -eq 77) \
+  || skip_ "requires a working expect program"
+
+# Also, if the $MAKE program fails to consider the standard output as a
+# tty (this happens with e.g., BSD make and Solaris dmake when they're
+# run in parallel mode; see the autoconf manual), there is little point
+# in proceeding.
+cat > Makefile <<'END'
+all:
+## Creaive quoting in the `echo' below to avoid risk of spurious output
+## matches by `expect', below.
+       @test -t 1 && echo "stdout" "is" "a" "tty"
 END
-THE_SYSTEM_SHELL=/bin/sh expect -f expect-check || {
-    echo "$me: failed to find a working expect program" >&2
-    Exit 77
+cat > expect-check <<'END'
+spawn $env(MAKE)
+expect {
+  "stdout is a tty" { exit 0 }
+  default { exit 1 }
 }
+exit 1
+END
+MAKE=$MAKE expect -f expect-check \
+  || skip_ "make spawned by expect should have a tty stdout"
+rm -f check Makefile
 
 # Do the tests.
 
@@ -108,7 +123,6 @@ test_no_color ()
 }
 
 cat >expect-make <<'END'
-#! /usr/bin/expect -f
 spawn $env(MAKE) -e check
 expect eof
 END