From: Stefano Lattarini Date: Thu, 10 Jun 2010 06:34:00 +0000 (+0200) Subject: Modernize, improve and/or fix tests `pluseq*.test. X-Git-Tag: v1.11.1b~74^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b563243e60d1886f639b2f6741340e7e1c0d0aef;p=thirdparty%2Fautomake.git Modernize, improve and/or fix tests `pluseq*.test. * tests/pluseq5.test: Append to configure.in using cat with an here-doc, not using echo. * tests/pluseq10.test: Make sure that the captured output of `make' command is always displayed. Where possible, use $FGREP instead of grep (this change makes some checks slighty stricter). * tests/pluseq8.test: Enable `errexit' shell flag, with related changes. * tests/pluseq.test: Likewise. Also, do not create useless dummy data files, and use better m4 quoting in generated configure.in. * tests/pluseq2.test: Likewise. Also, append to configure.in using cat with an here-doc, not using echo. * tests/pluseq3.test: Likewise. * tests/pluseq4.test: Likewise. * tests/pluseq6.test: Likewise. * tests/pluseq7.test: Do not create useless dummy source file. * tests/pluseq9.test: Slighty extended w.r.t. the grepping of Automake stderr. Some unrelated cosmetic changes. Signed-off-by: Ralf Wildenhues --- diff --git a/ChangeLog b/ChangeLog index b571cf295..d81810377 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,24 @@ 2010-06-12 Stefano Lattarini + Modernize, improve and/or fix tests `pluseq*.test. + * tests/pluseq5.test: Append to configure.in using cat with an + here-doc, not using echo. + * tests/pluseq10.test: Make sure that the captured output of + `make' command is always displayed. Where possible, use $FGREP + instead of grep (this change makes some checks slighty stricter). + * tests/pluseq8.test: Enable `errexit' shell flag, with related + changes. + * tests/pluseq.test: Likewise. Also, do not create useless dummy + data files, and use better m4 quoting in generated configure.in. + * tests/pluseq2.test: Likewise. Also, append to configure.in + using cat with an here-doc, not using echo. + * tests/pluseq3.test: Likewise. + * tests/pluseq4.test: Likewise. + * tests/pluseq6.test: Likewise. + * tests/pluseq7.test: Do not create useless dummy source file. + * tests/pluseq9.test: Slighty extended w.r.t. the grepping of + Automake stderr. Some unrelated cosmetic changes. + 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 diff --git a/tests/pluseq.test b/tests/pluseq.test index 05a5fce71..66eec8f31 100755 --- a/tests/pluseq.test +++ b/tests/pluseq.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 @@ -23,9 +23,8 @@ data_DATA = zar data_DATA += doz END -: > zar -: > doz - -$ACLOCAL || Exit 1 -$AUTOMAKE || Exit 1 +$ACLOCAL +$AUTOMAKE $FGREP 'zar doz' Makefile.in + +: diff --git a/tests/pluseq10.test b/tests/pluseq10.test index 5548e6dfc..92734155d 100755 --- a/tests/pluseq10.test +++ b/tests/pluseq10.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 @@ -21,11 +21,11 @@ set -e -cat >>configure.in <>configure.in << 'END' +AM_CONDITIONAL([A], [true]) +AM_CONDITIONAL([B], [false]) AC_OUTPUT -EOF +END cat > Makefile.am << 'END' foo = 0.h @@ -40,6 +40,7 @@ foo += b0.h \ b1.h endif +.PHONY: print print: @echo BEG: $(foo) :END END @@ -47,7 +48,10 @@ END $ACLOCAL $AUTOCONF $AUTOMAKE + ./configure -$MAKE print >stdout +$MAKE print >stdout || { cat stdout; Exit 1; } cat stdout -grep 'BEG: 0.h a0.h a1.h a2.h a3.h :END' stdout +$FGREP 'BEG: 0.h a0.h a1.h a2.h a3.h :END' stdout + +: diff --git a/tests/pluseq2.test b/tests/pluseq2.test index 28f9848c5..f9db345a0 100755 --- a/tests/pluseq2.test +++ b/tests/pluseq2.test @@ -1,5 +1,6 @@ #! /bin/sh -# Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc. +# Copyright (C) 1998, 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,7 +19,11 @@ . ./defs || Exit 1 -echo 'AM_CONDITIONAL(CHECK, true)' >> configure.in +set -e + +cat >> configure.in << 'END' +AM_CONDITIONAL([CHECK], [true]) +END cat > Makefile.am << 'END' @@ -36,11 +41,9 @@ endif END -: > zar -: > doz -: > dog - -$ACLOCAL || Exit 1 -$AUTOMAKE || Exit 1 -grep 'CHECK_TRUE.*zar doz' Makefile.in || Exit 1 +$ACLOCAL +$AUTOMAKE +grep 'CHECK_TRUE.*zar doz' Makefile.in grep 'CHECK_FALSE.*dog' Makefile.in + +: diff --git a/tests/pluseq3.test b/tests/pluseq3.test index 64ddd6902..755002c4d 100755 --- a/tests/pluseq3.test +++ b/tests/pluseq3.test @@ -1,5 +1,6 @@ #! /bin/sh -# Copyright (C) 1998, 1999, 2001, 2002, 2004 Free Software Foundation, Inc. +# Copyright (C) 1998, 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 @@ -18,7 +19,11 @@ . ./defs || Exit 1 -echo 'AM_CONDITIONAL(CHECK, true)' >> configure.in +set -e + +cat >> configure.in << 'END' +AM_CONDITIONAL([CHECK], [true]) +END cat > Makefile.am << 'END' @@ -37,13 +42,7 @@ endif END -: > zar -: > doz -: > dog - -set -e - -$ACLOCAL || Exit 1 +$ACLOCAL $AUTOMAKE grep '^@CHECK_TRUE@data_DATA = zarrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr \\$' Makefile.in @@ -51,4 +50,4 @@ grep '^@CHECK_TRUE@ doz$' Makefile.in grep '^@CHECK_FALSE@data_DATA = dog$' Makefile.in -Exit 0 +: diff --git a/tests/pluseq4.test b/tests/pluseq4.test index febc33bd0..744b4899b 100755 --- a/tests/pluseq4.test +++ b/tests/pluseq4.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,15 +18,19 @@ . ./defs || Exit 1 -echo AC_PROG_CC >> configure.in +set -e + +cat >> configure.in << 'END' +AC_PROG_CC +END cat > Makefile.am << 'END' bin_PROGRAMS = foo CC += -Dwhatever END -: > foo.c - -$ACLOCAL || Exit 1 -$AUTOMAKE || Exit 1 +$ACLOCAL +$AUTOMAKE $FGREP '@CC@ -Dwhatever' Makefile.in + +: diff --git a/tests/pluseq5.test b/tests/pluseq5.test index 1f1c98cfc..4e03d37a3 100755 --- a/tests/pluseq5.test +++ b/tests/pluseq5.test @@ -1,5 +1,6 @@ #! /bin/sh -# Copyright (C) 1999, 2001, 2002, 2003 Free Software Foundation, Inc. +# Copyright (C) 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 @@ -20,7 +21,9 @@ set -e -echo 'AM_CONDITIONAL(CHECK, true)' >> configure.in +cat >> configure.in << 'END' +AM_CONDITIONAL([CHECK], [true]) +END cat > Makefile.am << 'END' if CHECK @@ -56,3 +59,5 @@ AUTOMAKE_fails grep AM_CPPFLAGS stderr && Exit 1 # !CHECK should still be mentioned. grep ':.*!CHECK$' stderr + +: diff --git a/tests/pluseq6.test b/tests/pluseq6.test index bb546cfb0..af0523900 100755 --- a/tests/pluseq6.test +++ b/tests/pluseq6.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,7 +18,11 @@ . ./defs || Exit 1 -echo 'AC_SUBST(ZZZ)' >> configure.in +set -e + +cat >> configure.in << 'END' +AC_SUBST([ZZZ]) +END # If you do this in a real Makefile.am, I will kill you. cat > Makefile.am << 'END' @@ -26,9 +30,11 @@ mandir += foo zq = zzz END -$ACLOCAL || Exit 1 -$AUTOMAKE || Exit 1 -$FGREP '@mandir@ foo' Makefile.in || Exit 1 +$ACLOCAL +$AUTOMAKE +$FGREP '@mandir@ foo' Makefile.in num=`grep '^mandir =' Makefile.in | wc -l` test $num -eq 1 + +: diff --git a/tests/pluseq7.test b/tests/pluseq7.test index f74e62c0b..071646208 100755 --- a/tests/pluseq7.test +++ b/tests/pluseq7.test @@ -1,5 +1,6 @@ #! /bin/sh -# Copyright (C) 1999, 2001, 2002, 2003 Free Software Foundation, Inc. +# Copyright (C) 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 @@ -32,8 +33,8 @@ libq_a_SOURCES = q.c AR += qq END -: > q.c - $ACLOCAL AUTOMAKE_fails grep 'Makefile.am:3:.*AR' stderr + +: diff --git a/tests/pluseq8.test b/tests/pluseq8.test index a39059aaf..901f8b641 100755 --- a/tests/pluseq8.test +++ b/tests/pluseq8.test @@ -1,5 +1,6 @@ #! /bin/sh -# Copyright (C) 1999, 2001, 2002, 2004, 2006 Free Software Foundation, Inc. +# Copyright (C) 1999, 2001, 2002, 2004, 2006, 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' VAR = \ one \ @@ -25,8 +28,8 @@ VAR = \ VAR += three END -$ACLOCAL || Exit 1 -$AUTOMAKE || Exit 1 +$ACLOCAL +$AUTOMAKE sed -n -e '/^VAR =/ { :loop @@ -39,3 +42,5 @@ sed -n -e '/^VAR =/ { p n }' Makefile.in | grep three + +: diff --git a/tests/pluseq9.test b/tests/pluseq9.test index 31e1c8d8d..fb30a1d8b 100755 --- a/tests/pluseq9.test +++ b/tests/pluseq9.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2002, 2003 Free Software Foundation, Inc. +# Copyright (C) 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,11 +20,11 @@ set -e -cat >>configure.in <>configure.in << 'END' +AM_CONDITIONAL([COND1], [true]) +AM_CONDITIONAL([COND2], [true]) +AM_CONDITIONAL([COND3], [true]) +END cat > Makefile.am << 'END' if COND1 @@ -65,6 +65,9 @@ AUTOMAKE_fails # COND1_FALSE (merging the last two conditions), so we'll support # this case in the check too. +grep '[cC]annot apply.*+=' stderr grep ': !COND1 and !COND3$' stderr # Make sure there is exactly one missing condition. test `grep ': ' stderr | wc -l` = 1 + +: