From: Stefano Lattarini Date: Fri, 11 Jun 2010 19:22:40 +0000 (+0200) Subject: Testsuite: ensure verbose printing of captured stderr. X-Git-Tag: v1.11.1b~75^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f2d7321b758061ff25c2de8616e4f320ea098462;p=thirdparty%2Fautomake.git Testsuite: ensure verbose printing of captured stderr. * tests/acloca18.test: Print captured stderr before either failing or grepping it. Be sure to send captured stderr to stderr, not to stdout. * tests/ansi3b.test: Likewise. * tests/cond39.test: Likewise. * tests/configure.test: Likewise. * tests/missing3.test: Likewise. * tests/missing6.test: Likewise. * tests/output-order.test: Likewise. * tests/pr300-ltlib.test: Likewise. * tests/python6.test: Likewise. * tests/python7.test: Likewise. * tests/python8.test: Likewise. * tests/python9.test: Likewise. * tests/subobj.test: Likewise. * tests/vars3.test: Likewise. * tests/missing4.test: Likewise, and fix a call to grep not to use the `-c' flag. * tests/ansi3.test: Likewise, and rely on the `configure.in' stub created by `./defs', rather than writing one from scratch. Signed-off-by: Ralf Wildenhues --- diff --git a/ChangeLog b/ChangeLog index 6f6ca10a7..b571cf295 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,27 @@ 2010-06-12 Stefano Lattarini + Testsuite: ensure verbose printing of captured stderr. + * tests/acloca18.test: Print captured stderr before either failing + or grepping it. Be sure to send captured stderr to stderr, not to + stdout. + * tests/ansi3b.test: Likewise. + * tests/cond39.test: Likewise. + * tests/configure.test: Likewise. + * tests/missing3.test: Likewise. + * tests/missing6.test: Likewise. + * tests/output-order.test: Likewise. + * tests/pr300-ltlib.test: Likewise. + * tests/python6.test: Likewise. + * tests/python7.test: Likewise. + * tests/python8.test: Likewise. + * tests/python9.test: Likewise. + * tests/subobj.test: Likewise. + * tests/vars3.test: Likewise. + * tests/missing4.test: Likewise, and fix a call to grep not to use + the `-c' flag. + * tests/ansi3.test: Likewise, and rely on the `configure.in' stub + created by `./defs', rather than writing one from scratch. + Enable `errexit' shell flag in various tests. * tests/backsl.test: Enable the `errexit' shell flag, and related changes. diff --git a/tests/acloca18.test b/tests/acloca18.test index 276e5ba7b..c38fac485 100755 --- a/tests/acloca18.test +++ b/tests/acloca18.test @@ -106,9 +106,13 @@ AC_DEFUN([AM_MACRO1], [echo macro1d >> foo]) AC_DEFUN([AM_MACRO2], [echo macro2d >> foo]) EOF rm -f foo -$ACLOCAL --diff=diff >output 2>stderr -cat stderr -cat output -grep '#serial 456' output +$ACLOCAL --diff=diff >stdout 2>stderr || { + cat stderr >&2 + cat stdout + Exit 1 +} +cat stderr >&2 +cat stdout +grep '#serial 456' stdout test ! -f 4/m1.m4 grep 'installing.*4/m1.m4' stderr diff --git a/tests/ansi3.test b/tests/ansi3.test index 2bbcaf76e..e1e0c4297 100755 --- a/tests/ansi3.test +++ b/tests/ansi3.test @@ -1,5 +1,6 @@ #! /bin/sh -# Copyright (C) 1998, 1999, 2001, 2002, 2003 Free Software Foundation, Inc. +# Copyright (C) 1998, 1999, 2001, 2002, 2003, 2010 Free Software +# Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -22,12 +23,10 @@ required=gcc set -e -cat > configure.in << 'END' -AC_INIT(hello.c) -AM_INIT_AUTOMAKE(hello,0.23) +cat >> configure.in << 'END' AC_PROG_CC AM_C_PROTOTYPES -AC_OUTPUT(Makefile) +AC_OUTPUT END cat > Makefile.am << 'END' @@ -53,8 +52,8 @@ export CFLAGS # Linux boxes (Red Hat 5.1 in particular). $ACLOCAL $AUTOCONF -$AUTOMAKE -a 2>stderr -cat stderr +$AUTOMAKE -a 2>stderr || { cat stderr >&2; Exit 1; } +cat stderr >&2 grep 'Makefile.am:1:.*ansi2knr\.c' stderr CC='gcc' ./configure ANSI2KNR=./ansi2knr U=_ $MAKE -e diff --git a/tests/ansi3b.test b/tests/ansi3b.test index 8f254adb2..ad222ffe2 100755 --- a/tests/ansi3b.test +++ b/tests/ansi3b.test @@ -1,5 +1,6 @@ #! /bin/sh -# Copyright (C) 1998, 1999, 2001, 2002, 2003 Free Software Foundation, Inc. +# Copyright (C) 1998, 1999, 2001, 2002, 2003, 2010 Free Software +# Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -52,8 +53,8 @@ export CFLAGS # Linux boxes (Red Hat 5.1 in particular). $ACLOCAL $AUTOCONF -$AUTOMAKE -a 2>stderr -cat stderr +$AUTOMAKE -a 2>stderr || { cat stderr >&2; Exit 1; } +cat stderr >&2 grep 'configure.in:2:.*ansi2knr\.1' stderr CC='gcc' ./configure ANSI2KNR=./ansi2knr U=_ $MAKE -e diff --git a/tests/cond39.test b/tests/cond39.test index 79eaa7077..8d96595ba 100755 --- a/tests/cond39.test +++ b/tests/cond39.test @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright (C) 2008 Free Software Foundation, Inc. +# Copyright (C) 2008, 2010 Free Software Foundation, Inc. # # This file is part of GNU Automake. # @@ -82,8 +82,8 @@ $AUTOCONF $AUTOMAKE --add-missing ./configure COND=true -$MAKE 2>stderr -cat stderr +$MAKE 2>stderr || { cat stderr >&2; Exit 1; } +cat stderr >&2 grep 'overriding commands' stderr && Exit 1 $MAKE sure-exist ./prog1 && Exit 1 @@ -97,8 +97,8 @@ $MAKE sure-exist $MAKE distclean ./configure COND=false -$MAKE 2>stderr -cat stderr +$MAKE 2>stderr || { cat stderr >&2; Exit 1; } +cat stderr >&2 grep 'overriding commands' stderr && Exit 1 ./prog1 ./sub/prog2 @@ -107,3 +107,5 @@ $MAKE sure-not-exist $MAKE ./prog1 ./sub/prog2 + +: diff --git a/tests/configure.test b/tests/configure.test index f7ee977cc..838da68aa 100755 --- a/tests/configure.test +++ b/tests/configure.test @@ -48,7 +48,7 @@ $ACLOCAL 2>stderr && { cat stderr >&2; Exit 1; } cat stderr >&2 grep 'configure.ac.*configure.in.*both present' stderr -$ACLOCAL -Wno-error 2>stderr +$ACLOCAL -Wno-error 2>stderr || { cat stderr >&2; Exit 1; } cat stderr >&2 grep 'configure.ac.*configure.in.*both present' stderr grep 'proceeding.*configure.ac' stderr diff --git a/tests/missing3.test b/tests/missing3.test index d3a782335..54044f561 100755 --- a/tests/missing3.test +++ b/tests/missing3.test @@ -43,7 +43,7 @@ grep . stderr && Exit 1 cat stderr >&2 grep WARNING stderr -./missing --run ./missing --version 2>stderr +./missing --run ./missing --version 2>stderr || { cat stderr >&2; Exit 1; } cat stderr >&2 grep . stderr && Exit 1 ./missing --run ./missing --grep 2>stderr && { cat stderr >&2; Exit 1; } diff --git a/tests/missing4.test b/tests/missing4.test index 10158287b..13a4c224e 100755 --- a/tests/missing4.test +++ b/tests/missing4.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc. +# Copyright (C) 2006, 2007, 2008, 2010 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -36,13 +36,13 @@ cmp aclocal.m4 aclocal.tmp && Exit 1 mv aclocal.tmp aclocal.m4 -$MAKE 2>stderr -cat stderr +$MAKE 2>stderr || { cat cat stderr >&2; Exit 1; } +cat stderr >&2 grep 'You have another version of autoconf' stderr -grep -c 'aclocal.m4:.*this file was generated for' stderr +grep 'aclocal.m4:.*this file was generated for' stderr -$MAKE 2>stderr -cat stderr +$MAKE 2>stderr || { cat cat stderr >&2; Exit 1; } +cat stderr >&2 grep 'You have another version of autoconf' stderr && Exit 1 grep 'aclocal.m4:.*this file was generated for' stderr && Exit 1 diff --git a/tests/missing6.test b/tests/missing6.test index 914546b66..3994b8507 100755 --- a/tests/missing6.test +++ b/tests/missing6.test @@ -31,7 +31,7 @@ rm -f configure.in touch Makefile.am $ACLOCAL -$AUTOCONF 2>stderr +$AUTOCONF 2>stderr || { cat stderr >&2; Exit 1; } cat stderr >&2 grep 'You have another version of autoconf' stderr grep 'aclocal.m4:.*this file was generated for' stderr @@ -44,8 +44,8 @@ cmp configure.ac configure.tmp && Exit 1 mv configure.tmp configure.ac -$MAKE 2>stderr -cat stderr +$MAKE 2>stderr || { cat stderr >&2; Exit 1; } +cat stderr >&2 grep 'You have another version of autoconf' stderr grep 'aclocal.m4:.*this file was generated for autoconf 9999a' stderr diff --git a/tests/output-order.test b/tests/output-order.test index 856baa268..cb9ffff93 100755 --- a/tests/output-order.test +++ b/tests/output-order.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2008 Free Software Foundation, Inc. +# Copyright (C) 2008, 2010 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -43,7 +43,7 @@ END $ACLOCAL $AUTOCONF rm -f missing install-sh -$AUTOMAKE --add-missing --copy 2>stderr +$AUTOMAKE --add-missing --copy 2>stderr || { cat stderr >&2; Exit 1; } cat stderr >&2 for i in 1 2 3 4 5 6; do diff --git a/tests/pr300-ltlib.test b/tests/pr300-ltlib.test index 01814a9b5..c6f9a5ed9 100755 --- a/tests/pr300-ltlib.test +++ b/tests/pr300-ltlib.test @@ -1,5 +1,6 @@ #! /bin/sh -# Copyright (C) 2002, 2007, 2008, 2009 Free Software Foundation, Inc. +# Copyright (C) 2002, 2007, 2008, 2009, 2010 Free Software Foundation, +# Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -58,7 +59,7 @@ grep 'libb.la .*-rpath .*lib/subdir' stdout test -f subdir/liba.la test -f subdir/libb.la -$MAKE install 2>stderr +$MAKE install 2>stderr || { cat stderr >&2; Exit 1; } cat stderr >&2 grep 'remember.*--finish' stderr && Exit 1 diff --git a/tests/python6.test b/tests/python6.test index eb4fb4d3e..86dcfbba7 100755 --- a/tests/python6.test +++ b/tests/python6.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2003 Free Software Foundation, Inc. +# Copyright (C) 2003, 2010 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -34,6 +34,8 @@ $AUTOCONF $AUTOMAKE --add-missing # Simulate no Python -./configure PYTHON=: 2>stderr -cat stderr +./configure PYTHON=: 2>stderr || { cat stderr >&2; Exit 1; } +cat stderr >&2 grep 'GREP ME:' stderr + +: diff --git a/tests/python7.test b/tests/python7.test index 62c1a1bb5..27b2e7966 100755 --- a/tests/python7.test +++ b/tests/python7.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2003 Free Software Foundation, Inc. +# Copyright (C) 2003, 2010 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -34,6 +34,8 @@ $ACLOCAL $AUTOCONF $AUTOMAKE --add-missing -./configure 2>stderr -cat stderr +./configure 2>stderr || { cat stderr >&2; Exit 1; } +cat stderr >&2 grep 'GREP ME:' stderr + +: diff --git a/tests/python8.test b/tests/python8.test index a50af2285..51d02ad9b 100755 --- a/tests/python8.test +++ b/tests/python8.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2003 Free Software Foundation, Inc. +# Copyright (C) 2003, 2010 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -32,6 +32,8 @@ $ACLOCAL $AUTOCONF $AUTOMAKE --add-missing -./configure 2>stderr -cat stderr +./configure 2>stderr || { cat stderr >&2; Exit 1; } +cat stderr >&2 grep 'GREP ME' stderr + +: diff --git a/tests/python9.test b/tests/python9.test index 9b23deb3f..6a91e9fee 100755 --- a/tests/python9.test +++ b/tests/python9.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2003 Free Software Foundation, Inc. +# Copyright (C) 2003, 2010 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -33,6 +33,8 @@ $ACLOCAL $AUTOCONF $AUTOMAKE --add-missing -./configure 2>stderr -cat stderr +./configure 2>stderr || { cat stderr >&2; Exit 1; } +cat stderr >&2 grep 'GREP ME' stderr + +: diff --git a/tests/subobj.test b/tests/subobj.test index df297f49e..64edd0ed4 100755 --- a/tests/subobj.test +++ b/tests/subobj.test @@ -1,5 +1,6 @@ #! /bin/sh -# Copyright (C) 1999, 2001, 2002, 2004 Free Software Foundation, Inc. +# Copyright (C) 1999, 2001, 2002, 2004, 2010 Free Software Foundation, +# Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -32,8 +33,8 @@ wish_SOURCES = generic/a.c generic/b.c END $ACLOCAL -$AUTOMAKE --add-missing 2>stderr -cat stderr +$AUTOMAKE --add-missing 2>stderr || { cat stderr >&2; Exit 1; } +cat stderr >&2 # Make sure compile is installed, and that Automake says so. grep 'install.*compile' stderr test -f compile @@ -43,3 +44,5 @@ grep '[^/]a\.\$(OBJEXT)' Makefile.in && Exit 1 # Opportunistically test for a different bug. grep '^generic/b.\$(OBJEXT):.*dirstamp' Makefile.in + +: diff --git a/tests/vars3.test b/tests/vars3.test index 3d10a902d..6b738ab98 100755 --- a/tests/vars3.test +++ b/tests/vars3.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2002 Free Software Foundation, Inc. +# Copyright (C) 2002, 2010 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -38,8 +38,9 @@ EOF $ACLOCAL # Make sure this warning is print in the `portability' category. -$AUTOMAKE --warnings=no-error,none,portability 2>stderr -cat stderr +$AUTOMAKE --warnings=no-error,none,portability 2>stderr \ + || { cat stderr >&2; Exit 1; } +cat stderr >&2 # Lines number are printed in error message. # Use them to make sure errors are diagnosed against the right lines.