From: Stefano Lattarini Date: Fri, 11 Jun 2010 15:19:20 +0000 (+0200) Subject: Enable `errexit' shell flag in various tests. X-Git-Tag: v1.11.1b~75^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c1f6cdbdb3ef89d2f6a23e5b9d87baeba73b2735;p=thirdparty%2Fautomake.git Enable `errexit' shell flag in various tests. * tests/backsl.test: Enable the `errexit' shell flag, and related changes. * tests/backsl2.test: Likewise. * tests/block.test: Likewise. * tests/canon2.test: Likewise. * tests/canon4.test: Likewise. * tests/comment2.test: Likewise. * tests/condlib.test: Likewise. * tests/cond15.test: Likewise, and prefer $FGREP over grep. * tests/canon3.test: Likewise. Also, avoid to create an useless dummy source file. * tests/acoutpt2.test: Enable the `errexit' shell flag, and some related changes. Do some cosmetic improvements in the generated `configure.in' file. * tests/cond4.test: Likewise. * tests/cond14.test: Likewise. * tests/condinc.test: Likewise. * tests/cond7.test: Likewise. Also, remove useless setting of AUTOMAKE_OPTIONS to `foreign' in the generated Makefile.am. * tests/ansi.test: Enable the `errexit' shell flag, and related changes. Extended, esp. by running autoconf, ./configure and make, and by looking into the distdir. Signed-off-by: Ralf Wildenhues --- diff --git a/ChangeLog b/ChangeLog index 3c25fb92e..6f6ca10a7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,29 @@ +2010-06-12 Stefano Lattarini + + Enable `errexit' shell flag in various tests. + * tests/backsl.test: Enable the `errexit' shell flag, and + related changes. + * tests/backsl2.test: Likewise. + * tests/block.test: Likewise. + * tests/canon2.test: Likewise. + * tests/canon4.test: Likewise. + * tests/comment2.test: Likewise. + * tests/condlib.test: Likewise. + * tests/cond15.test: Likewise, and prefer $FGREP over grep. + * tests/canon3.test: Likewise. Also, avoid to create an useless + dummy source file. + * tests/acoutpt2.test: Enable the `errexit' shell flag, and some + related changes. Do some cosmetic improvements in the generated + `configure.in' file. + * tests/cond4.test: Likewise. + * tests/cond14.test: Likewise. + * tests/condinc.test: Likewise. + * tests/cond7.test: Likewise. Also, remove useless setting of + AUTOMAKE_OPTIONS to `foreign' in the generated Makefile.am. + * tests/ansi.test: Enable the `errexit' shell flag, and related + changes. Extended, esp. by running autoconf, ./configure and + make, and by looking into the distdir. + 2010-06-12 Stefano Lattarini Ralf Wildenhues diff --git a/tests/acoutpt2.test b/tests/acoutpt2.test index fb8fbcf37..2d0743c0f 100755 --- a/tests/acoutpt2.test +++ b/tests/acoutpt2.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2001, 2002 Free Software Foundation, Inc. +# Copyright (C) 2001, 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 @@ -18,9 +18,11 @@ . ./defs || Exit 1 -cat > configure.in << 'END' -AC_INIT -AM_INIT_AUTOMAKE(nonesuch, nonesuch) +set -e + +cat > configure.in < foo.in : > subdir/foo.in -$ACLOCAL || Exit 1 -$AUTOMAKE || Exit 1 +$ACLOCAL +$AUTOMAKE count=`$FGREP foo.in Makefile.in | wc -l` -test $count -eq 2 || Exit 1 +test $count -eq 2 # This ought to work as well. -$ACLOCAL || Exit 1 +$ACLOCAL $AUTOMAKE --add-missing --force-missing + +: diff --git a/tests/ansi.test b/tests/ansi.test index cd9a07b82..c0778c6ee 100755 --- a/tests/ansi.test +++ b/tests/ansi.test @@ -1,6 +1,6 @@ #! /bin/sh -# Copyright (C) 1996, 1997, 1998, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. +# Copyright (C) 1996, 1997, 1998, 2000, 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 @@ -20,21 +20,36 @@ . ./defs || Exit 1 +set -e + cat > Makefile.am << 'END' AUTOMAKE_OPTIONS = ansi2knr -magic: - @echo $(DISTFILES) +.PHONY: test1 test2 +test1: + echo ' $(DISTFILES) ' | grep ' ansi2knr\.c ' + echo ' $(DISTFILES) ' | grep ' ansi2knr\.1 ' +test2: distdir + test -f $(distdir)/ansi2knr.c + test -f $(distdir)/ansi2knr.1 END cat >> configure.in << 'END' AM_C_PROTOTYPES +AC_OUTPUT END : > ansi2knr.c : > ansi2knr.1 -$ACLOCAL || Exit 1 -$AUTOMAKE || Exit 1 +$ACLOCAL +$AUTOMAKE $FGREP -v @SET_MAKE@ Makefile.in > Makefile.sed -$MAKE -s -f Makefile.sed SHELL=$SHELL magic | grep 'ansi2knr\.c' +$MAKE -f Makefile.sed SHELL=$SHELL test1 + +$AUTOCONF +./configure +$MAKE test1 +$MAKE test2 + +: diff --git a/tests/backsl.test b/tests/backsl.test index e5d2b395a..3947cde6c 100755 --- a/tests/backsl.test +++ b/tests/backsl.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 1996, 2001, 2002 Free Software Foundation, Inc. +# Copyright (C) 1996, 2001, 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 @@ -18,6 +18,8 @@ . ./defs || Exit 1 +set -e + cat >> configure.in << 'END' AC_PROG_CC END @@ -27,8 +29,8 @@ bin_PROGRAMS = \ frob END -$ACLOCAL || Exit 1 -$AUTOMAKE || Exit 1 +$ACLOCAL +$AUTOMAKE grep '^_SOURCE' Makefile.in && Exit 1 Exit 0 diff --git a/tests/backsl2.test b/tests/backsl2.test index ba62db719..35e9b9be1 100755 --- a/tests/backsl2.test +++ b/tests/backsl2.test @@ -1,5 +1,6 @@ #! /bin/sh -# Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +# Copyright (C) 1999, 2000, 2001, 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 @@ -19,12 +20,14 @@ . ./defs || Exit 1 +set -e + cat > Makefile.am << 'END' SUBDIRS = \ . END -$ACLOCAL || Exit 1 -$AUTOMAKE || Exit 1 +$ACLOCAL +$AUTOMAKE -Exit 0 +: diff --git a/tests/block.test b/tests/block.test index 8b4692ac0..862389eb0 100755 --- a/tests/block.test +++ b/tests/block.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 1996, 2001, 2002 Free Software Foundation, Inc. +# Copyright (C) 1996, 2001, 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 @@ -19,6 +19,8 @@ . ./defs || Exit 1 +set -e + cat > Makefile.am << 'END' #START #a @@ -27,8 +29,8 @@ cat > Makefile.am << 'END' #END END -$ACLOCAL || Exit 1 -$AUTOMAKE || Exit 1 +$ACLOCAL +$AUTOMAKE (sed -e '/^#START/,/^#END/ !d' Makefile.in | grep -v '^#') && Exit 1 Exit 0 diff --git a/tests/canon2.test b/tests/canon2.test index e8acb8182..ab2861750 100755 --- a/tests/canon2.test +++ b/tests/canon2.test @@ -1,5 +1,6 @@ #! /bin/sh -# Copyright (C) 1996, 1997, 2001, 2002 Free Software Foundation, Inc. +# Copyright (C) 1996, 1997, 2001, 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 @@ -18,6 +19,8 @@ . ./defs || Exit 1 +set -e + cat > Makefile.am << 'END' info_TEXINFOS = zar-doz.texi zar_doz_TEXINFOS = frob.texi @@ -27,8 +30,9 @@ END echo '@setfilename zar-doz.info' > zar-doz.texi echo '@setfilename frob' > frob.texi -$ACLOCAL || Exit 1 -$AUTOMAKE || Exit 1 +$ACLOCAL +$AUTOMAKE grep zar-doz_TEXINFOS Makefile.in && Exit 1 -Exit 0 + +: diff --git a/tests/canon3.test b/tests/canon3.test index da347ebee..9d5a17238 100755 --- a/tests/canon3.test +++ b/tests/canon3.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 1996, 2001, 2002 Free Software Foundation, Inc. +# Copyright (C) 1996, 2001, 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 @@ -18,6 +18,8 @@ . ./defs || Exit 1 +set -e + cat >> configure.in << 'END' AC_PROG_CC END @@ -28,8 +30,8 @@ END : > perm-number.c -$ACLOCAL || Exit 1 -$AUTOMAKE || Exit 1 +$ACLOCAL +$AUTOMAKE -grep 'perm_number\.c' Makefile.in && Exit 1 +$FGREP 'perm_number.c' Makefile.in && Exit 1 Exit 0 diff --git a/tests/canon4.test b/tests/canon4.test index 607ba2e8a..52e968dc5 100755 --- a/tests/canon4.test +++ b/tests/canon4.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 1996, 2001, 2002 Free Software Foundation, Inc. +# Copyright (C) 1996, 2001, 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 @@ -18,6 +18,8 @@ . ./defs || Exit 1 +set -e + cat >> configure.in << 'END' AC_PROG_CC AC_PROG_RANLIB @@ -28,8 +30,8 @@ noinst_LIBRARIES = libx-y.a libx_y_a_SOURCES = xy.c END -$ACLOCAL || Exit 1 -$AUTOMAKE || Exit 1 +$ACLOCAL +$AUTOMAKE grep '^libx-y.*=' Makefile.in && Exit 1 Exit 0 diff --git a/tests/comment2.test b/tests/comment2.test index 2073328d2..97e6a2610 100755 --- a/tests/comment2.test +++ b/tests/comment2.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 1996, 2001, 2002 Free Software Foundation, Inc. +# Copyright (C) 1996, 2001, 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 @@ -19,6 +19,8 @@ . ./defs || Exit 1 +set -e + cat >> configure.in << 'END' AC_PROG_CC END @@ -27,8 +29,8 @@ cat > Makefile.am << 'END' bin_PROGRAMS = sim_products receive_th receive_pos # image_proc END -$ACLOCAL || Exit 1 -$AUTOMAKE || Exit 1 +$ACLOCAL +$AUTOMAKE grep '^image_proc' Makefile.in && Exit 1 Exit 0 diff --git a/tests/cond14.test b/tests/cond14.test index 218132542..2779a3dd8 100755 --- a/tests/cond14.test +++ b/tests/cond14.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2001, 2002 Free Software Foundation, Inc. +# Copyright (C) 2001, 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 @@ -19,9 +19,11 @@ . ./defs || Exit 1 +set -e + cat >> configure.in << 'END' AC_PROG_CC -AM_CONDITIONAL(COND1, true) +AM_CONDITIONAL([COND1], [true]) END cat > Makefile.am << 'END' @@ -43,8 +45,10 @@ endif bin_PROGRAMS = $(BUILD_helldl) END -$ACLOCAL || Exit 1 -$AUTOMAKE || Exit 1 +$ACLOCAL +$AUTOMAKE num=`grep 'helldl$(EXEEXT):' Makefile.in | wc -l` test $num -eq 2 + +: diff --git a/tests/cond15.test b/tests/cond15.test index a371baa20..0789074c3 100755 --- a/tests/cond15.test +++ b/tests/cond15.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2001, 2002 Free Software Foundation, Inc. +# Copyright (C) 2001, 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 @@ -18,10 +18,12 @@ . ./defs || Exit 1 +set -e + cat >> configure.in << 'END' AC_PROG_CC -AM_CONDITIONAL(COND1, true) -AM_CONDITIONAL(COND2, true) +AM_CONDITIONAL([COND1], [true]) +AM_CONDITIONAL([COND2], [true]) END cat > Makefile.am << 'END' @@ -50,10 +52,12 @@ endif bin_PROGRAMS = helldl END -$ACLOCAL || Exit 1 -$AUTOMAKE || Exit 1 +$ACLOCAL +$AUTOMAKE + +num1=`$FGREP 'helldl$(EXEEXT):' Makefile.in | wc -l` +num2=`$FGREP '@COND1_FALSE@@COND2_TRUE@helldl$(EXEEXT):' Makefile.in | wc -l` +test $num1 -eq 4 +test $num2 -eq 1 -num1=`grep 'helldl$(EXEEXT):' Makefile.in | wc -l` -num2=`grep '@COND1_FALSE@@COND2_TRUE@helldl$(EXEEXT):' Makefile.in | wc -l` -test $num1 -eq 4 || Exit 1 -test $num2 -eq 1 || Exit 1 +: diff --git a/tests/cond4.test b/tests/cond4.test index cc569d6a6..6efc9ce71 100755 --- a/tests/cond4.test +++ b/tests/cond4.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 1998, 2001, 2002 Free Software Foundation, Inc. +# Copyright (C) 1998, 2001, 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 @@ -19,13 +19,13 @@ required='GNUmake gcc' . ./defs || Exit 1 -cat > configure.in << 'END' -AC_INIT(Makefile.am) -AM_INIT_AUTOMAKE(foo,0.0) +set -e + +cat >> configure.in << 'END' AC_PROG_CC -AM_CONDITIONAL(ONE, test "x$CONDITION1" = "xtrue") -AM_CONDITIONAL(TWO, test "x$CONDITION2" = "xtrue") -AC_OUTPUT(Makefile) +AM_CONDITIONAL([ONE], [test "x$CONDITION1" = "xtrue"]) +AM_CONDITIONAL([TWO], [test "x$CONDITION2" = "xtrue"]) +AC_OUTPUT END cat > Makefile.am << 'END' @@ -45,33 +45,35 @@ echo-objects: @echo $(targ_OBJECTS) END -$ACLOCAL || Exit 1 -$AUTOMAKE || Exit 1 +$ACLOCAL +$AUTOMAKE # We should not output useless definitions. -test "`grep '^@TWO_FALSE@' Makefile.in | wc -l`" -eq 0 || Exit 1 +test "`grep '^@TWO_FALSE@' Makefile.in | wc -l`" -eq 0 -$AUTOCONF || Exit 1 +$AUTOCONF # Ignore user CFLAGS. CFLAGS= export CFLAGS -CONDITION1=true CONDITION2=true ./configure || Exit 1 +CONDITION1=true CONDITION2=true ./configure msgtt=`$MAKE --no-print-directory echo-objects` -CONDITION1=true CONDITION2=false ./configure || Exit 1 +CONDITION1=true CONDITION2=false ./configure msgtf=`$MAKE --no-print-directory echo-objects` -CONDITION1=false CONDITION2=true ./configure || Exit 1 +CONDITION1=false CONDITION2=true ./configure msgft=`$MAKE --no-print-directory echo-objects` -CONDITION1=false CONDITION2=false ./configure || Exit 1 +CONDITION1=false CONDITION2=false ./configure msgff=`$MAKE --no-print-directory echo-objects` -echo $msgtt -echo $msgtf -echo $msgft -echo $msgff +: msgtt = $msgtt +: msgtf = $msgtf +: msgft = $msgft +: msgff = $msgff + +test x"$msgtt" = x"main.o one.o two.o" +test x"$msgtf" = x"main.o one.o" +test x"$msgft" = x"main.o two.o" +test x"$msgff" = x"main.o" -test "$msgtt" = "main.o one.o two.o" || Exit 1 -test "$msgtf" = "main.o one.o" || Exit 1 -test "$msgft" = "main.o two.o" || Exit 1 -test "$msgff" = "main.o" || Exit 1 +: diff --git a/tests/cond7.test b/tests/cond7.test index 4d611baed..b11dddf18 100755 --- a/tests/cond7.test +++ b/tests/cond7.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 1998, 2001, 2002 Free Software Foundation, Inc. +# Copyright (C) 1998, 2001, 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 @@ -18,16 +18,15 @@ . ./defs || Exit 1 -cat > configure.in << 'END' -AC_INIT() -AM_INIT_AUTOMAKE(test,0.1) +set -e + +cat >> configure.in << 'END' compat=yes -AM_CONDITIONAL(Compatible, test x$compat = xyes) -AC_OUTPUT(Makefile) +AM_CONDITIONAL([Compatible], [test x$compat = xyes]) +AC_OUTPUT END cat > Makefile.am << 'END' -AUTOMAKE_OPTIONS=foreign if Compatible abdir = none ab_HEADERS = \ @@ -35,7 +34,8 @@ ab_HEADERS = \ endif END -$ACLOCAL || Exit 1 -$AUTOMAKE || Exit 1 +$ACLOCAL +$AUTOMAKE + grep '^[^#].*002' Makefile.in && Exit 1 Exit 0 diff --git a/tests/condinc.test b/tests/condinc.test index eddd3bcdc..cf9e35fce 100755 --- a/tests/condinc.test +++ b/tests/condinc.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc. +# Copyright (C) 1999, 2001, 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 @@ -18,8 +18,10 @@ . ./defs || Exit 1 +set -e + cat >> configure.in << 'END' -AM_CONDITIONAL(TOBE, false) +AM_CONDITIONAL([TOBE], [false]) END cat > Makefile.am << 'END' @@ -33,11 +35,10 @@ target: dependency rule END -$ACLOCAL || Exit 1 -$AUTOMAKE || Exit 1 +$ACLOCAL +$AUTOMAKE grep '^target:' Makefile.in && Exit 1 +grep '^@TOBE_TRUE@target:' Makefile.in -grep '^@TOBE_TRUE@target:' Makefile.in || Exit 1 - -Exit 0 +: diff --git a/tests/condlib.test b/tests/condlib.test index 49cc9f1f5..b6c998d71 100755 --- a/tests/condlib.test +++ b/tests/condlib.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2001, 2002, 2008 Free Software Foundation, Inc. +# Copyright (C) 2001, 2002, 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 @@ -19,6 +19,8 @@ . ./defs || Exit 1 +set -e + cat >> configure.in << 'END' AC_PROG_RANLIB AM_MAINTAINER_MODE @@ -34,8 +36,8 @@ nodist_librsaref_a_SOURCES = desc.c digit.c BUILT_SOURCES = $(nodist_librsaref_a_SOURCES) END -$ACLOCAL || Exit 1 -$AUTOMAKE || Exit 1 +$ACLOCAL +$AUTOMAKE $FGREP librsaref.a.c Makefile.in && Exit 1 Exit 0