automake-ng
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Automake-ng] [FYI] [ng] tests: prefer to grep make stderr for expected


From: Stefano Lattarini
Subject: [Automake-ng] [FYI] [ng] tests: prefer to grep make stderr for expected diagnostic
Date: Sat, 14 Apr 2012 10:43:20 +0200

Few make implementations, like BSD's, can print diagnostic from make or
its spawned recipes on stdout rather than on stderr.  Some of our tests
had been relaxed to cater for this.  Now that we assume GNU make, there
is no reason to be this "sloppy" anymore.

* t/uninstall-fail.sh: Expect diagnostic from make and its recipes
to be on stderr, not possibly also on stdout.
* t/lisp3.sh: Likewise.
* t/test-missing.sh: Likewise.
* t/test-missing2.sh: Likewise.
* t/distcheck-pr10470.sh: Likewise.
* t/distcheck-pr9579.sh: Likewise.
* t/dist-missing-am.sh: Likewise.
* t/dist-missing-included-m4.sh: Likewise.
* t/dist-missing-m4.sh: Likewise.
* t/deleted-am.sh: Likewise.
* t/deleted-m4.sh: Likewise.
* t/distcheck-configure-flags-am.sh: Likewise.
* t/distcheck-configure-flags-subpkg.sh: Likewise.
* t/distcheck-configure-flags.sh: Likewise.
* t/yacc-dist-nobuild.sh: Likewise.  Also, be stricter in matching
expected make diagnostic.

Signed-off-by: Stefano Lattarini <address@hidden>
---
 t/colon6.sh                           |    6 +++---
 t/deleted-am.sh                       |   14 +++++++-------
 t/deleted-m4.sh                       |   16 ++++++++--------
 t/dist-missing-am.sh                  |    8 ++++----
 t/dist-missing-included-m4.sh         |    8 ++++----
 t/dist-missing-m4.sh                  |    8 ++++----
 t/distcheck-configure-flags-am.sh     |    6 +++---
 t/distcheck-configure-flags-subpkg.sh |    6 +++---
 t/distcheck-configure-flags.sh        |    6 +++---
 t/distcheck-pr10470.sh                |    6 +++---
 t/distcheck-pr9579.sh                 |   18 +++++++++---------
 t/lisp3.sh                            |    6 +++---
 t/test-missing.sh                     |   26 +++++++++++++-------------
 t/test-missing2.sh                    |   12 ++++++------
 t/uninstall-fail.sh                   |   12 ++++++------
 t/yacc-dist-nobuild.sh                |    6 +++---
 16 files changed, 82 insertions(+), 82 deletions(-)

diff --git a/t/colon6.sh b/t/colon6.sh
index 09cc2eb..bf2dacd 100755
--- a/t/colon6.sh
+++ b/t/colon6.sh
@@ -82,10 +82,10 @@ for vpath in : false; do
 
   # version.good should depend on version.gin.
   rm -f version.good
-  $MAKE version.good >output 2>&1 && { cat output; Exit 1; }
-  cat output
+  $MAKE version.good 2>stderr && { cat stderr >&2; Exit 1; }
+  cat stderr >&2
   # Try to verify that we errored out for the right reason.
-  $FGREP version.gin output
+  $FGREP version.gin stderr
 
   cd .. # Back in top builddir.
   cd $srcdir
diff --git a/t/deleted-am.sh b/t/deleted-am.sh
index e8e7a22..e3612a3 100755
--- a/t/deleted-am.sh
+++ b/t/deleted-am.sh
@@ -35,12 +35,12 @@ $AUTOMAKE
 $MAKE
 
 rm -f zardoz.am
-$MAKE >output 2>&1 && { cat output; Exit 1; }
-cat output
+$MAKE 2>stderr && { cat stderr >&2; Exit 1; }
+cat stderr >&2
 # This error will come from automake, not make, so we can be stricter
 # in our grepping of it.
-grep 'cannot open.*zardoz\.am' output
-grep 'foobar\.am' output && Exit 1 # No spurious error, please.
+grep 'cannot open.*zardoz\.am' stderr
+grep 'foobar\.am' stderr && Exit 1 # No spurious error, please.
 
 # Try with one less indirection.
 : > foobar.am
@@ -48,10 +48,10 @@ $AUTOMAKE Makefile
 ./config.status Makefile
 $MAKE # Sanity check.
 rm -f foobar.am
-$MAKE >output 2>&1 && { cat output; Exit 1; }
-cat output
+$MAKE 2>stderr && { cat stderr >&2; Exit 1; }
+cat stderr >&2
 # This error will come from automake, not make, so we can be stricter
 # in our grepping of it.
-grep 'cannot open.*foobar\.am' output
+grep 'cannot open.*foobar\.am' stderr
 
 :
diff --git a/t/deleted-m4.sh b/t/deleted-m4.sh
index e1bbfce..328657e 100755
--- a/t/deleted-m4.sh
+++ b/t/deleted-m4.sh
@@ -39,13 +39,13 @@ $AUTOMAKE
 $MAKE
 
 rm -f zardoz.m4
-$MAKE >output 2>&1 && { cat output; Exit 1; }
-cat output
+$MAKE 2>stderr && { cat stderr >&2; Exit 1; }
+cat stderr >&2
 # This error will come from aclocal, not make, so we can be stricter
 # in our grepping of it.
-grep ' foobar\.m4:1:.*zardoz\.m4.*does not exist' output
+grep ' foobar\.m4:1:.*zardoz\.m4.*does not exist' stderr
 # No spurious errors, please.
-$FGREP -v ' foobar.m4:1:' output | $FGREP 'foobar.m4' && Exit 1
+$FGREP -v ' foobar.m4:1:' stderr | $FGREP 'foobar.m4' && Exit 1
 
 # Try with one less indirection.
 : > foobar.m4
@@ -54,12 +54,12 @@ $AUTOCONF
 ./configure
 $MAKE # Sanity check.
 rm -f foobar.m4
-$MAKE >output 2>&1 && { cat output; Exit 1; }
-cat output
+$MAKE 2>stderr && { cat stderr >&2; Exit 1; }
+cat stderr >&2
 # This error will come from aclocal, not make, so we can be stricter
 # in our grepping of it.
-grep 'foobar\.m4.*does not exist' output
+grep 'foobar\.m4.*does not exist' stderr
 # No spurious errors, please (ok, this is really paranoid).
-$FGREP 'zardoz.m4' output && Exit 1
+$FGREP 'zardoz.m4' stderr && Exit 1
 
 :
diff --git a/t/dist-missing-am.sh b/t/dist-missing-am.sh
index 0765b0c..3a088c0 100755
--- a/t/dist-missing-am.sh
+++ b/t/dist-missing-am.sh
@@ -54,12 +54,12 @@ for vpath in false :; do
     cd $distdir
     ./configure
   fi
-  $MAKE >output 2>&1 && { cat output; Exit 1; }
-  cat output
+  $MAKE 2>stderr && { cat stderr >&2; Exit 1; }
+  cat stderr >&2
   # This error comes from automake, not make, so we can be stricter
   # in our grepping of it.
-  grep 'cannot open.*zardoz\.am' output
-  grep 'foobar\.am' output && Exit 1 # No spurious error, please.
+  grep 'cannot open.*zardoz\.am' stderr
+  grep 'foobar\.am' stderr && Exit 1 # No spurious error, please.
   cd "$ocwd" || fatal_ "cannot chdir back to top-level test directory"
 done
 
diff --git a/t/dist-missing-included-m4.sh b/t/dist-missing-included-m4.sh
index 5960003..480301b 100755
--- a/t/dist-missing-included-m4.sh
+++ b/t/dist-missing-included-m4.sh
@@ -56,12 +56,12 @@ for vpath in false :; do
     cd $distdir
     ./configure
   fi
-  $MAKE >output 2>&1 && { cat output; Exit 1; }
-  cat output
+  $MAKE 2>stderr && { cat stderr >&2; Exit 1; }
+  cat stderr
   # This error will come from automake, not make, so we can be stricter
   # in our grepping of it.
-  grep 'zardoz\.m4.*does not exist' output
-  grep 'foobar\.m4' output && Exit 1 # No spurious error, please.
+  grep 'zardoz\.m4.*does not exist' stderr
+  grep 'foobar\.m4' stderr && Exit 1 # No spurious error, please.
   cd "$ocwd" || fatal_ "cannot chdir back to top-level test directory"
 done
 
diff --git a/t/dist-missing-m4.sh b/t/dist-missing-m4.sh
index 9a418d3..678e67a 100755
--- a/t/dist-missing-m4.sh
+++ b/t/dist-missing-m4.sh
@@ -58,12 +58,12 @@ for vpath in false :; do
     cd $distdir
     ./configure
   fi
-  $MAKE >output 2>&1 && { cat output; Exit 1; }
-  cat output
+  $MAKE 2>stderr && { cat stderr; Exit 1; }
+  cat stderr
   # This error will come from autoconf, not make, so we can be stricter
   # in our grepping of it.
-  grep 'possibly undefined .*MY_ZARDOZ' output
-  grep 'MY_FOOBAR' output && Exit 1 # No spurious error, please.
+  grep 'possibly undefined .*MY_ZARDOZ' stderr
+  grep 'MY_FOOBAR' stderr && Exit 1 # No spurious error, please.
   cd "$ocwd" || fatal_ "cannot chdir back to top-level test directory"
 done
 
diff --git a/t/distcheck-configure-flags-am.sh 
b/t/distcheck-configure-flags-am.sh
index 7dbe2ab..be214ff 100755
--- a/t/distcheck-configure-flags-am.sh
+++ b/t/distcheck-configure-flags-am.sh
@@ -59,9 +59,9 @@ END
 $AUTOMAKE Makefile
 ./config.status Makefile
 
-$MAKE distcheck >output 2>&1 && { cat output; Exit 1; }
-cat output
-grep "^configure:.* success='no', sentence='it works :-)'" output
+$MAKE distcheck 2>stderr && { cat stderr >&2; Exit 1; }
+cat stderr >&2
+grep "^configure:.* success='no', sentence='it works :-)'" stderr
 
 $MAKE distcheck DISTCHECK_CONFIGURE_FLAGS="--enable-success=yes"
 
diff --git a/t/distcheck-configure-flags-subpkg.sh 
b/t/distcheck-configure-flags-subpkg.sh
index 45d0e0c..17dfc9c 100755
--- a/t/distcheck-configure-flags-subpkg.sh
+++ b/t/distcheck-configure-flags-subpkg.sh
@@ -74,8 +74,8 @@ $MAKE distcheck
 
 # ... but not when "make distcheck" is run from the subpackage.
 cd subpkg
-$MAKE distcheck >output 2>&1 && { cat output; Exit 1; }
-cat output
-grep '^configure:.* dc=KO am_dc=KO' output
+$MAKE distcheck 2>stderr && { cat stderr >&2; Exit 1; }
+cat stderr >&2
+grep '^configure:.* dc=KO am_dc=KO' stderr
 
 :
diff --git a/t/distcheck-configure-flags.sh b/t/distcheck-configure-flags.sh
index aec3ec4..bb6f840 100755
--- a/t/distcheck-configure-flags.sh
+++ b/t/distcheck-configure-flags.sh
@@ -48,8 +48,8 @@ $MAKE distcheck \
   DISTCHECK_CONFIGURE_FLAGS="--enable-success=yes sentence='it works :-)'"
 
 # Sanity check.
-$MAKE distcheck >output 2>&1 && { cat output; Exit 1; }
-cat output
-grep "^configure:.* success='no', sentence=''" output
+$MAKE distcheck 2>stderr && { cat stderr >&2; Exit 1; }
+cat stderr >&2
+grep "^configure:.* success='no', sentence=''" stderr
 
 :
diff --git a/t/distcheck-pr10470.sh b/t/distcheck-pr10470.sh
index 1b6a322..efb4380 100755
--- a/t/distcheck-pr10470.sh
+++ b/t/distcheck-pr10470.sh
@@ -50,10 +50,10 @@ $AUTOMAKE
 ./configure
 
 # We can build the distribution.
-$MAKE distcheck >output 2>&1 || { cat output; Exit 1; }
-cat output
+$MAKE distcheck 2>stderr || { cat stderr >&2; Exit 1; }
+cat stderr >&2
 # Sanity check: verify that our code has hit a problem removing
 # the distdir, but has recovered from it.
-grep "rm:.*$destdir" output || fatal_ "expected code path not covered"
+grep "rm:.*$destdir" stderr || fatal_ "expected code path not covered"
 
 :
diff --git a/t/distcheck-pr9579.sh b/t/distcheck-pr9579.sh
index 8c78900..fb8e405 100755
--- a/t/distcheck-pr9579.sh
+++ b/t/distcheck-pr9579.sh
@@ -54,11 +54,11 @@ $MAKE uninstall
 test -f inst/share/dir
 rm -rf inst
 
-$MAKE distcheck >output 2>&1 && { cat output; Exit 1; }
-cat output
+$MAKE distcheck 2>stderr && { cat stderr >&2; Exit 1; }
+cat stderr >&2
 
-$FGREP 'ERROR: files left after uninstall:' output
-grep '/share/dir *$' output
+grep 'ERROR: files left after uninstall:' stderr
+grep '/share/dir *$' stderr
 
 # A few trickier corner cases.
 
@@ -86,11 +86,11 @@ test -f inst/mu/share/info/dir
 test -f inst/share/info/more/dir
 rm -rf inst
 
-$MAKE distcheck >output 2>&1 && { cat output; Exit 1; }
-cat output
+$MAKE distcheck 2>stderr && { cat stderr >&2; Exit 1; }
+cat stderr >&2
 
-$FGREP 'ERROR: files left after uninstall:' output
-grep '/mu/share/info/dir *$' output
-grep '/share/info/more/dir *$' output
+grep 'ERROR: files left after uninstall:' stderr
+grep '/mu/share/info/dir *$' stderr
+grep '/share/info/more/dir *$' stderr
 
 :
diff --git a/t/lisp3.sh b/t/lisp3.sh
index a1531d3..b22245a 100755
--- a/t/lisp3.sh
+++ b/t/lisp3.sh
@@ -84,9 +84,9 @@ find _inst | $EGREP '\.elc?$' && Exit 1
 unique=0a3346e2af8a689b85002b53df09142a
 $sleep
 echo "(message \"$unique\")(provide 'am-three)" > am-three.el
-$MAKE >output 2>&1 || { cat output; Exit 1; }
-cat output
-grep $unique output
+$MAKE 2>stderr || { cat stderr >&2; Exit 1; }
+cat stderr >&2
+grep $unique stderr
 
 # It should also work for VPATH-builds.
 $MAKE distcheck
diff --git a/t/test-missing.sh b/t/test-missing.sh
index fbec0fd..1547962 100755
--- a/t/test-missing.sh
+++ b/t/test-missing.sh
@@ -38,21 +38,21 @@ $AUTOMAKE -a
 
 ./configure
 
-$MAKE check >output 2>&1 && { cat output; Exit 1; }
-cat output
+$MAKE check >stdout 2>stderr && { cat stdout; cat stderr >&2; Exit 1; }
+cat stdout; cat stderr >&2
 test -f ok.log
-grep '^PASS: ok\.test' output
-$FGREP 'zardoz.log' output
+grep '^PASS: ok\.test' stdout
+$FGREP 'zardoz.log' stderr
 test ! -f test-suite.log
 
-$MAKE TESTS='zardoz2.test' check >output 2>&1 && { cat output; Exit 1; }
-cat output
-$FGREP 'zardoz2.log' output
+$MAKE TESTS='zardoz2.test' check 2>stderr && { cat stderr >&2; Exit 1; }
+cat stderr
+$FGREP 'zardoz2.log' stderr
 test ! -f test-suite.log
 
-$MAKE TEST_LOGS='zardoz3.log' check >output 2>&1 && { cat output; Exit 1; }
-cat output
-$FGREP 'zardoz3.log' output
+$MAKE TEST_LOGS='zardoz3.log' check 2>stderr && { cat stderr >&2; Exit 1; }
+cat stderr >&2
+$FGREP 'zardoz3.log' stderr
 test ! -f test-suite.log
 
 # The errors should persist even after 'test-suite.log'
@@ -62,9 +62,9 @@ test ! -f test-suite.log
 $MAKE check
 rm -f zardoz.test
 
-$MAKE check >output 2>&1 && { cat output; Exit 1; }
-cat output
-$FGREP 'zardoz.log' output
+$MAKE check 2>stderr && { cat stderr >&2; Exit 1; }
+cat stderr >&2
+$FGREP 'zardoz.log' stderr
 test ! -f test-suite.log
 
 :
diff --git a/t/test-missing2.sh b/t/test-missing2.sh
index e511a8b..dadc1b0 100755
--- a/t/test-missing2.sh
+++ b/t/test-missing2.sh
@@ -43,12 +43,12 @@ test ! -f foobar1.trs || Exit 99
 test ! -f foobar2.log || Exit 99
 test ! -f foobar2.trs || Exit 99
 
-$MAKE check >output 2>&1 && { cat output; Exit 1; }
-cat output
-grep 'test-suite\.log.*foobar1\.log' output
-grep 'test-suite\.log.*foobar1\.trs' output
-grep 'test-suite\.log.*foobar2\.log' output
-grep 'test-suite\.log.*foobar2\.trs' output
+$MAKE check 2>stderr && { cat stderr >&2; Exit 1; }
+cat stderr >&2
+grep 'test-suite\.log.*foobar1\.log' stderr
+grep 'test-suite\.log.*foobar1\.trs' stderr
+grep 'test-suite\.log.*foobar2\.log' stderr
+grep 'test-suite\.log.*foobar2\.trs' stderr
 test ! -f test-suite.log
 
 :
diff --git a/t/uninstall-fail.sh b/t/uninstall-fail.sh
index aee1fb5..a1897b1 100755
--- a/t/uninstall-fail.sh
+++ b/t/uninstall-fail.sh
@@ -61,19 +61,19 @@ mkdir $inst $inst/share
 : > $inst/share/foobar.txt
 
 chmod a-w $inst/share
-$MAKE uninstall >output 2>&1 && { cat output; Exit 1; }
-cat output
+$MAKE uninstall 2>stderr && { cat stderr >&2; Exit 1; }
+cat stderr >&2
 if test $rm_f_is_silent_on_error = yes; then
   : "rm -f" is silent on errors, skip the grepping of make output
 else
-  grep "rm: .*foobar\.txt" output
+  grep "rm: .*foobar\.txt" stderr >&2
 fi
 
 chmod a-rwx $inst/share
 (cd $inst/share) && skip_ "cannot make directories fully unreadable"
 
-$MAKE uninstall >output 2>&1 && { cat output; Exit 1; }
-cat output
+$MAKE uninstall 2>stderr && { cat stderr >&2; Exit 1; }
+cat stderr >&2
 #
 # Some shells, like Solaris 10 /bin/sh and /bin/ksh, do not report
 # the name of the 'cd' builtin upon a chdir error:
@@ -91,6 +91,6 @@ cat output
 #   > cd unreadable'
 #   /usr/xpg4/bin/sh[3]: unreadable: permission denied
 #
-$EGREP "(cd|sh)(\[[0-9]*[0-9]\])?: .*$inst/share" output
+$EGREP "(cd|sh)(\[[0-9]*[0-9]\])?: .*$inst/share" stderr
 
 :
diff --git a/t/yacc-dist-nobuild.sh b/t/yacc-dist-nobuild.sh
index 6f02f11..814b3d2 100755
--- a/t/yacc-dist-nobuild.sh
+++ b/t/yacc-dist-nobuild.sh
@@ -83,8 +83,8 @@ chmod a-w $distdir
 mkdir build2
 cd build2
 ../$distdir/configure
-$MAKE >out 2>&1 && { cat out; Exit 1; }
-cat out
-$FGREP parse.c out
+$MAKE 2>stderr && { cat stderr >&2; Exit 1; }
+cat stderr >&2
+$FGREP parse.c stderr
 
 :
-- 
1.7.9.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]