From a7d14dfbd4bbf58e03b007cea9e97d1c47f17c7c Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Sun, 2 Jan 2011 15:49:16 +0100 Subject: [PATCH] Tests: normalize use of the 'errexit' shell flag. * tests/maken3.test (check_targets): Remove redundant call to 'set -e'. * tests/maken4.test: Likewise. * tests/ansi5.test: Call 'set -e' just after './defs' has been sourced. * tests/ansi6.test: Likewise. * tests/ansi7.test: Likewise. * tests/cond16.test: Likewise. * tests/cond17.test: Likewise. * tests/cond18.test: Likewise. * tests/cond19.test: Likewise. * tests/cond20.test: Likewise. * tests/cond21.test: Likewise. * tests/instdat2.test: Likewise. * tests/instdir-texi.test: Likewise. * tests/parallel-tests3.test: Likewise. * tests/remake1a.test: Likewise. * tests/ccnoco.test: Likewise, and add trailing `:' command. * tests/comment4.test: Likewise. * tests/gcj4.test: Likewise. * tests/nodist2.test: Likewise. * tests/nodist3.test: Enable 'errexit' shell flag (this should have been done in commit v1.11-248-g317e17b, but the relevant hunk has been forgotten somehow). * tests/output.test: Likewise. * tests/gnits2.test: Likewise, and display captured stderr to script's stderr, not to script's stdout. * tests/gnits3.test: Likewise. Also, prefer 'cat' over 'echo' to append to Makefile.am, and really check that the exit status of "make installcheck" indicates failure. --- ChangeLog | 34 ++++++++++++++++++++++++++++++++++ tests/ansi5.test | 6 +++--- tests/ansi6.test | 6 +++--- tests/ansi7.test | 6 +++--- tests/ccnoco.test | 9 +++++---- tests/comment4.test | 5 +++-- tests/cond16.test | 6 +++--- tests/cond17.test | 6 +++--- tests/cond18.test | 6 +++--- tests/cond19.test | 6 +++--- tests/cond20.test | 6 +++--- tests/cond21.test | 6 +++--- tests/gcj4.test | 8 +++++--- tests/gnits2.test | 11 +++++++---- tests/gnits3.test | 15 ++++++++++----- tests/instdat2.test | 5 +++-- tests/instdir-texi.test | 7 ++++--- tests/maken3.test | 3 +-- tests/maken4.test | 3 +-- tests/nodist2.test | 8 +++++--- tests/nodist3.test | 4 +++- tests/output.test | 6 ++++-- tests/parallel-tests3.test | 6 +++--- tests/remake1a.test | 6 +++--- 24 files changed, 118 insertions(+), 66 deletions(-) diff --git a/ChangeLog b/ChangeLog index 472dc55..496e1cd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,37 @@ +2010-01-03 Stefano Lattarini + + Tests: normalize use of the 'errexit' shell flag. + * tests/maken3.test (check_targets): Remove redundant call to + 'set -e'. + * tests/maken4.test: Likewise. + * tests/ansi5.test: Call 'set -e' just after './defs' has been + sourced. + * tests/ansi6.test: Likewise. + * tests/ansi7.test: Likewise. + * tests/cond16.test: Likewise. + * tests/cond17.test: Likewise. + * tests/cond18.test: Likewise. + * tests/cond19.test: Likewise. + * tests/cond20.test: Likewise. + * tests/cond21.test: Likewise. + * tests/instdat2.test: Likewise. + * tests/instdir-texi.test: Likewise. + * tests/parallel-tests3.test: Likewise. + * tests/remake1a.test: Likewise. + * tests/ccnoco.test: Likewise, and add trailing `:' command. + * tests/comment4.test: Likewise. + * tests/gcj4.test: Likewise. + * tests/nodist2.test: Likewise. + * tests/nodist3.test: Enable 'errexit' shell flag (this should + have been done in commit v1.11-248-g317e17b, but the relevant + hunk has been forgotten somehow). + * tests/output.test: Likewise. + * tests/gnits2.test: Likewise, and display captured stderr to + script's stderr, not to script's stdout. + * tests/gnits3.test: Likewise. Also, prefer 'cat' over 'echo' + to append to Makefile.am, and really check that the exit status + of "make installcheck" indicates failure. + 2011-01-02 Ralf Wildenhues Sync auxiliary files from upstream. diff --git a/tests/ansi5.test b/tests/ansi5.test index 2652cb7..1e3b21c 100755 --- a/tests/ansi5.test +++ b/tests/ansi5.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. +# Copyright (C) 2001, 2002, 2003, 2011 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 @@ -19,6 +19,8 @@ required=gcc . ./defs || Exit 1 +set -e + cat > configure.in << 'END' AC_INIT(one/joe.c) AM_INIT_AUTOMAKE(liver, 0.23) @@ -63,8 +65,6 @@ main (int argc, char *argv[]) } END -set -e - $ACLOCAL $AUTOCONF $AUTOMAKE -a diff --git a/tests/ansi6.test b/tests/ansi6.test index 10196ea..76f4d22 100755 --- a/tests/ansi6.test +++ b/tests/ansi6.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2002, 2006, 2008 Free Software Foundation, Inc. +# Copyright (C) 2002, 2006, 2008, 2011 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 @@ -20,6 +20,8 @@ required=gcc . ./defs || Exit 1 +set -e + cat > configure.in << 'END' AC_INIT(ansi6, 1.0) AM_INIT_AUTOMAKE @@ -58,8 +60,6 @@ foo () } END -set -e - $ACLOCAL $AUTOCONF $AUTOMAKE -a diff --git a/tests/ansi7.test b/tests/ansi7.test index e97f517..2524d33 100755 --- a/tests/ansi7.test +++ b/tests/ansi7.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2002, 2008 Free Software Foundation, Inc. +# Copyright (C) 2002, 2008, 2011 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 @@ -21,6 +21,8 @@ required=gcc . ./defs || Exit 1 +set -e + cat > configure.in << 'END' AC_INIT(ansi6, 1.0) AM_INIT_AUTOMAKE @@ -60,8 +62,6 @@ foo () } END -set -e - $ACLOCAL $AUTOCONF $AUTOMAKE -a diff --git a/tests/ccnoco.test b/tests/ccnoco.test index d6ed136..d7c0360 100755 --- a/tests/ccnoco.test +++ b/tests/ccnoco.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2001, 2002, 2008 Free Software Foundation, Inc. +# Copyright (C) 2001, 2002, 2008, 2011 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 @@ -20,6 +20,8 @@ required=gcc . ./defs || Exit 1 +set -e + cat > configure.1 << 'END' AC_INIT(a.c) AM_INIT_AUTOMAKE(nonesuch, 0.23) @@ -68,9 +70,6 @@ END chmod +x Mycomp -set -e - - # Ignore user CFLAGS. CFLAGS= export CFLAGS @@ -95,3 +94,5 @@ for conf in configure.1 configure.3; do cd .. done + +: diff --git a/tests/comment4.test b/tests/comment4.test index f6e6a3f..6f3f8cc 100755 --- a/tests/comment4.test +++ b/tests/comment4.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2002 Free Software Foundation, Inc. +# Copyright (C) 2002, 2011 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 @@ -18,6 +18,8 @@ . ./defs || Exit 1 +set -e + cat >> configure.in <<'EOF' AC_OUTPUT EOF @@ -29,7 +31,6 @@ cat > Makefile.am << 'EOF' mumble = UnIqUe_MUMBLE_VALUE EOF -set -e $ACLOCAL $AUTOMAKE # UnIqUe_COPYRIGHT_BOILERPLATE should appear near the top of the file diff --git a/tests/cond16.test b/tests/cond16.test index 467b718..24f18df 100755 --- a/tests/cond16.test +++ b/tests/cond16.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2001, 2002 Free Software Foundation, Inc. +# Copyright (C) 2001, 2002, 2011 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 @@ -20,6 +20,8 @@ required=gcc . ./defs || Exit 1 +set -e + cat > configure.in << 'END' AC_INIT(hello.c) AM_INIT_AUTOMAKE(hello,0.23) @@ -51,8 +53,6 @@ END CFLAGS= export CFLAGS -set -e - $ACLOCAL $AUTOCONF $AUTOMAKE -a diff --git a/tests/cond17.test b/tests/cond17.test index 7368d9a..962dec3 100755 --- a/tests/cond17.test +++ b/tests/cond17.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2001, 2002 Free Software Foundation, Inc. +# Copyright (C) 2001, 2002, 2011 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 @@ -20,6 +20,8 @@ . ./defs || Exit 1 +set -e + cat > configure.in << 'END' AC_INIT(Makefile.am) AM_INIT_AUTOMAKE(hello,0.23) @@ -38,7 +40,5 @@ helldl_SOURCES = foo.c endif END -set -e - $ACLOCAL $AUTOMAKE -a diff --git a/tests/cond18.test b/tests/cond18.test index 3119658..c4ebed2 100755 --- a/tests/cond18.test +++ b/tests/cond18.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2001, 2002 Free Software Foundation, Inc. +# Copyright (C) 2001, 2002, 2011 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 @@ -20,6 +20,8 @@ required='GNUmake gcc' . ./defs || Exit 1 +set -e + cat > configure.in << 'END' AC_INIT(Makefile.am) AM_INIT_AUTOMAKE(hello,0.23) @@ -57,8 +59,6 @@ END CFLAGS= export CFLAGS -set -e - $ACLOCAL $AUTOCONF $AUTOMAKE -a diff --git a/tests/cond19.test b/tests/cond19.test index 14dfb51..93545e0 100755 --- a/tests/cond19.test +++ b/tests/cond19.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2001, 2002 Free Software Foundation, Inc. +# Copyright (C) 2001, 2002, 2011 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 @@ -20,6 +20,8 @@ required='GNUmake gcc' . ./defs || Exit 1 +set -e + cat > configure.in << 'END' AC_INIT(Makefile.am) AM_INIT_AUTOMAKE(hello,0.23) @@ -59,8 +61,6 @@ END CFLAGS= export CFLAGS -set -e - $ACLOCAL $AUTOCONF $AUTOMAKE -a diff --git a/tests/cond20.test b/tests/cond20.test index d0557e5..8e16e9f 100755 --- a/tests/cond20.test +++ b/tests/cond20.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. +# Copyright (C) 2001, 2002, 2003, 2011 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 @@ -19,6 +19,8 @@ . ./defs || Exit 1 +set -e + cat > configure.in << 'END' AC_INIT(Makefile.am) AM_INIT_AUTOMAKE(hello,0.23) @@ -42,8 +44,6 @@ helldl_SOURCES = $(var2) bin_PROGRAMS = helldl END -set -e - $ACLOCAL $AUTOCONF AUTOMAKE_fails -a diff --git a/tests/cond21.test b/tests/cond21.test index 160c76f..37b6b6f 100755 --- a/tests/cond21.test +++ b/tests/cond21.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2002, 2005 Free Software Foundation, Inc. +# Copyright (C) 2002, 2005, 2011 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 @@ -18,6 +18,8 @@ . ./defs || Exit 1 +set -e + cat >> configure.in << 'END' AC_PROG_CC AM_CONDITIONAL(COND1, true) @@ -66,8 +68,6 @@ test: @echo FOO: $(FOO) :FOO END -set -e - $ACLOCAL $AUTOCONF $AUTOMAKE -a diff --git a/tests/gcj4.test b/tests/gcj4.test index f3828ea..b7e14ab 100755 --- a/tests/gcj4.test +++ b/tests/gcj4.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2002, 2007 Free Software Foundation, Inc. +# Copyright (C) 2002, 2007, 2011 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 @@ -19,6 +19,8 @@ required=gcj . ./defs || Exit 1 +set -e + cat >> configure.in << 'END' AM_PROG_GCJ AC_OUTPUT @@ -29,8 +31,6 @@ bin_PROGRAMS = convert convert_SOURCES = convert.java END -set -e - $ACLOCAL $AUTOCONF $AUTOMAKE @@ -47,3 +47,5 @@ test `wc -l < filt` = 1 # Accept any outcome but `none' # (at the time of writing it should be gcc or gcc3). grep -v none filt + +: diff --git a/tests/gnits2.test b/tests/gnits2.test index 4c5d54f..bb6abaa 100755 --- a/tests/gnits2.test +++ b/tests/gnits2.test @@ -1,5 +1,6 @@ #! /bin/sh -# Copyright (C) 2002, 2003, 2004, 2007 Free Software Foundation, Inc. +# Copyright (C) 2002, 2003, 2004, 2007, 2011 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 @@ -19,6 +20,8 @@ required=gcc . ./defs || Exit 1 +set -e + cat >> configure.in << 'END' AC_PROG_CC AC_OUTPUT @@ -90,8 +93,6 @@ chmod +x sub/scriptnok.sh # (alpha.test checks the case where it must be distributed.) : > README-alpha -set -e - $ACLOCAL $AUTOCONF $AUTOMAKE -a @@ -106,5 +107,7 @@ cd build $MAKE all $MAKE test-install $MAKE -k installcheck 2>stderr || : # Never trust the exit status of make -k. -cat stderr +cat stderr >&2 $MAKE grep-stderr + +: diff --git a/tests/gnits3.test b/tests/gnits3.test index 7a08fb8..3224652 100755 --- a/tests/gnits3.test +++ b/tests/gnits3.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2002, 2007 Free Software Foundation, Inc. +# Copyright (C) 2002, 2007, 2011 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 @@ -19,6 +19,8 @@ required=gcc . ./defs || Exit 1 +set -e + cat >> configure.in << 'END' AC_PROG_CC AC_OUTPUT @@ -70,8 +72,6 @@ chmod +x sub/nok.sh : > ChangeLog : > THANKS -set -e - $ACLOCAL $AUTOCONF $AUTOMAKE -a @@ -83,14 +83,19 @@ cd build ../configure "--prefix=`pwd`/../inst-dir" --program-prefix=p $MAKE $MAKE install +$MAKE installcheck && Exit 1 $MAKE -k installcheck 2>stderr || : # Never trust the exit status of make -k. -cat stderr +cat stderr >&2 $MAKE grep-stderr # Make sure there is no more error when all targets are exempted. cd .. -echo 'AM_INSTALLCHECK_STD_OPTIONS_EXEMPT += sub/nok$(EXEEXT) sub/nok.sh' >> Makefile.am +cat >> Makefile.am <<'END' +AM_INSTALLCHECK_STD_OPTIONS_EXEMPT += sub/nok$(EXEEXT) sub/nok.sh +END $AUTOMAKE cd build ./config.status # Don't rely on the rebuild rules (they need GNU make). $MAKE installcheck + +: diff --git a/tests/instdat2.test b/tests/instdat2.test index 966f0cf..c637397 100755 --- a/tests/instdat2.test +++ b/tests/instdat2.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2001, 2002 Free Software Foundation, Inc. +# Copyright (C) 2001, 2002, 2011 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 @@ -19,6 +19,8 @@ . ./defs || Exit 1 +set -e + cat >Makefile.am << 'EOF' # User directories. inclexecdir = $(exec_prefix)/include @@ -62,7 +64,6 @@ pkgdata_SCRIPTS = script ##pkginclude_SCRIPTS = script EOF -set -e $ACLOCAL || Exit 1 $AUTOMAKE diff --git a/tests/instdir-texi.test b/tests/instdir-texi.test index 50617c8..b3e3c84 100755 --- a/tests/instdir-texi.test +++ b/tests/instdir-texi.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2009 Free Software Foundation, Inc. +# Copyright (C) 2009, 2011 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 @@ -20,12 +20,12 @@ required='makeinfo-html tex texi2dvi' . ./defs || Exit 1 +set -e + (dvips --help 2>/dev/null >/dev/null) || Exit 77 (pdfetex --help 2>/dev/null >/dev/null) || (pdftex --help 2>/dev/null >/dev/null) || Exit 77 -set -e - cat >>configure.in <<'END' AC_OUTPUT END @@ -67,4 +67,5 @@ $MAKE -e uninstall > stdout || { cat stdout; Exit 1; } cat stdout grep 'rm -f' stdout && Exit 1 $MAKE -e uninstall DESTDIR="$destdir" + : diff --git a/tests/maken3.test b/tests/maken3.test index b839d0d..a3768bd 100755 --- a/tests/maken3.test +++ b/tests/maken3.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2009 Free Software Foundation, Inc. +# Copyright (C) 2009, 2011 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 @@ -122,7 +122,6 @@ $AUTOCONF check_targets () { - set -e for target in \ all install install-strip uninstall clean distclean check \ info html dvi pdf ps \ diff --git a/tests/maken4.test b/tests/maken4.test index ae5ce27..09aba67 100755 --- a/tests/maken4.test +++ b/tests/maken4.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2009 Free Software Foundation, Inc. +# Copyright (C) 2009, 2011 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 @@ -124,7 +124,6 @@ $AUTOCONF check_targets () { - set -e for target in \ all install install-strip uninstall clean distclean check \ info html dvi pdf ps \ diff --git a/tests/nodist2.test b/tests/nodist2.test index 3d9e6ce..4c875b1 100755 --- a/tests/nodist2.test +++ b/tests/nodist2.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2001, 2002, 2007 Free Software Foundation, Inc. +# Copyright (C) 2001, 2002, 2007, 2011 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 @@ -19,6 +19,8 @@ . ./defs || Exit 1 +set -e + cat >> configure.in <<'EOF' AC_OUTPUT EOF @@ -29,10 +31,10 @@ EOF : > baz.h -set -e - $ACLOCAL $AUTOCONF $AUTOMAKE -a ./configure --prefix "`pwd`/install" $MAKE install-data + +: diff --git a/tests/nodist3.test b/tests/nodist3.test index c5470e7..ec21eaf 100755 --- a/tests/nodist3.test +++ b/tests/nodist3.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2003, 2004, 2010 Free Software Foundation, Inc. +# Copyright (C) 2003, 2004, 2010, 2011 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 @@ -18,6 +18,8 @@ . ./defs || Exit 1 +set -e + cat >> configure.in << 'END' AC_PROG_CC END diff --git a/tests/output.test b/tests/output.test index 3931fc5..ad29300 100755 --- a/tests/output.test +++ b/tests/output.test @@ -1,6 +1,6 @@ #! /bin/sh -# Copyright (C) 1996, 2000, 2001, 2002, 2010 Free Software Foundation, -# Inc. +# Copyright (C) 1996, 2000, 2001, 2002, 2010, 2011 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 @@ -19,6 +19,8 @@ . ./defs || Exit 1 +set -e + cat > configure.in <> configure.in << 'END' AC_OUTPUT END diff --git a/tests/remake1a.test b/tests/remake1a.test index ce80c19..ec8c641 100755 --- a/tests/remake1a.test +++ b/tests/remake1a.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2010 Free Software Foundation, Inc. +# Copyright (C) 2010, 2011 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 @@ -19,10 +19,10 @@ . ./defs || Exit 1 -fingerprint='=/FiNgErPrInT/=' - set -e +fingerprint='=/FiNgErPrInT/=' + cat > configure.in <