From: Stefano Lattarini Date: Mon, 14 Jun 2010 15:40:42 +0000 (+0200) Subject: Modernize, improve and/or tweak some test scripts. X-Git-Tag: ng-0.5a~317^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=deef1c3bc249879e07345f7146ab09231dc65648;p=thirdparty%2Fautomake.git Modernize, improve and/or tweak some test scripts. * tests/maintclean.test: Use proper m4 quoting. Add trailing `:' command. * tests/sinclude.test: Likewise, and add a couple of blank lines, for clarity. * tests/make.test: Move setting of `errexit' shell flag earlier in the script (just after inclusion of ./defs). Use the configure.in stub created by ./defs, rather than writing it from scratch. Some cosmetic changes in spacing. Ensure we wait enough time before touching configure.in to trigger the rebuild rules. * tests/makej.test: Use `$me' instead of hard-coding the test name. Add trailing `:' command. * tests/version7.test: Likewise. * tests/space.test: Enable `errexit' shell flag, and related changes. * tests/makevars.test: Likewise. Also, prefer trailing `:' over trailing `Exit 0', and be more tolerant of white spaces when grepping Makefile.in. --- diff --git a/ChangeLog b/ChangeLog index 2cbce3be1..cea4d572a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +2010-11-25 Stefano Lattarini + + Modernize, improve and/or tweak some test scripts. + * tests/maintclean.test: Use proper m4 quoting. Add trailing `:' + command. + * tests/sinclude.test: Likewise, and add a couple of blank lines, + for clarity. + * tests/make.test: Move setting of `errexit' shell flag earlier in + the script (just after inclusion of ./defs). Use the configure.in + stub created by ./defs, rather than writing it from scratch. Some + cosmetic changes in spacing. Ensure we wait enough time before + touching configure.in to trigger the rebuild rules. + * tests/makej.test: Use `$me' instead of hard-coding the test + name. Add trailing `:' command. + * tests/version7.test: Likewise. + * tests/space.test: Enable `errexit' shell flag, and related + changes. + * tests/makevars.test: Likewise. Also, prefer trailing `:' over + trailing `Exit 0', and be more tolerant of white spaces when + grepping Makefile.in. + 2010-11-21 Stefano Lattarini Tests: consistently use "|| Exit 1" after ". ./defs". diff --git a/tests/maintclean.test b/tests/maintclean.test index a66464b03..e4f09fd5c 100755 --- a/tests/maintclean.test +++ b/tests/maintclean.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. +# Copyright (C) 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 @@ -21,7 +21,7 @@ set -e cat >> configure.in << 'END' -AC_CONFIG_FILES(bar) +AC_CONFIG_FILES([bar]) AC_OUTPUT END @@ -74,3 +74,5 @@ test ! -f foo.c test ! -f Makefile test ! -f config.status test ! -d autom4te.cache + +: diff --git a/tests/make.test b/tests/make.test index 1e3184ddd..f866b3132 100755 --- a/tests/make.test +++ b/tests/make.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 @@ -20,17 +20,15 @@ required=GNUmake . ./defs || Exit 1 -cat > configure.in << 'END' -AC_INIT(Makefile.am) -AM_INIT_AUTOMAKE(foo,0,no) +set -e + +cat >> configure.in << 'END' AM_MAKE_INCLUDE -AC_OUTPUT(Makefile) +AC_OUTPUT END : > Makefile.am -set -e - $ACLOCAL $AUTOCONF $AUTOMAKE @@ -45,14 +43,11 @@ export AUTOMAKE save="$MAKE" for flag in '' -w; do MAKE="$save $flag" ./configure - $FGREP 'am__include = include' Makefile - + $sleep touch configure.in $MAKE $flag - $FGREP 'am__include = include' Makefile - rm -f config.cache done diff --git a/tests/makej.test b/tests/makej.test index e5d55a107..d85be0f0d 100755 --- a/tests/makej.test +++ b/tests/makej.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 @@ -26,9 +26,9 @@ required=GNUmake set -e -cat >configure.in <<'END' +cat >configure.in < version.m4 $MAKE -j ./configure --version | grep '3\.141' + +: diff --git a/tests/makevars.test b/tests/makevars.test index f4a80aaf9..31fdd56d0 100755 --- a/tests/makevars.test +++ b/tests/makevars.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,15 +19,17 @@ . ./defs || Exit 1 +set -e + # Find the macros wanted by Automake. -$ACLOCAL || Exit 1 +$ACLOCAL # Create some dummy Makefile.in. : > Makefile.am -$AUTOMAKE || Exit 1 +$AUTOMAKE # We are definitely not needing a compiler or preprocessor. -$EGREP '^(CC|CPP|CXX|CXXCPP) =' Makefile.in && Exit 1 +$EGREP '^ *(CC|CPP|CXX|CXXCPP) *=' Makefile.in && Exit 1 -Exit 0 +: diff --git a/tests/sinclude.test b/tests/sinclude.test index cc8898be6..7aff5257e 100755 --- a/tests/sinclude.test +++ b/tests/sinclude.test @@ -1,5 +1,6 @@ #! /bin/sh -# Copyright (C) 1998, 2001, 2002, 2003, 2005 Free Software Foundation, Inc. +# Copyright (C) 1998, 2001, 2002, 2003, 2005, 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 @@ -31,27 +32,28 @@ sinclude([doesntexist.m4]) EOF mkdir sub + cat > sub/p.m4 << 'END' -AC_SUBST(MAGICALPIG) +AC_SUBST([MAGICALPIG]) END cat > sub/h.m4 << 'END' -AC_SUBST(MAGICALHOG) +AC_SUBST([MAGICALHOG]) END cat > sub/g.m4 << 'END' -AC_SUBST(GREPME) +AC_SUBST([GREPME]) END : > Makefile.am -echo 'sinclude(sub/g.m4)' >> acinclude.m4 -echo 'm4_sinclude(sub/doesntexist.m4)' >> acinclude.m4 +echo 'sinclude([sub/g.m4])' >> acinclude.m4 +echo 'm4_sinclude([sub/doesntexist.m4])' >> acinclude.m4 $ACLOCAL -echo 'm4_sinclude(sub/p.m4)' >> aclocal.m4 -echo 'm4_include(sub/h.m4)' >> aclocal.m4 +echo 'm4_sinclude([sub/p.m4])' >> aclocal.m4 +echo 'm4_include([sub/h.m4])' >> aclocal.m4 $AUTOMAKE @@ -59,3 +61,5 @@ grep doesntexist Makefile.in && Exit 1 grep MAGICALPIG Makefile.in grep MAGICALHOG Makefile.in grep GREPME Makefile.in + +: diff --git a/tests/space.test b/tests/space.test index a4ab5a800..05a90dd15 100755 --- a/tests/space.test +++ b/tests/space.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. +# Copyright (C) 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 @@ -18,6 +18,8 @@ . ./defs || Exit 1 +set -e + echo AC_PROG_CC >> configure.in cat > Makefile.am << 'END' @@ -25,5 +27,5 @@ cat > Makefile.am << 'END' foo_SOURCES = foo.c END -$ACLOCAL || Exit 1 +$ACLOCAL $AUTOMAKE diff --git a/tests/version7.test b/tests/version7.test index 4df84edfc..a87b2b81e 100755 --- a/tests/version7.test +++ b/tests/version7.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2002, 2008 Free Software Foundation, Inc. +# Copyright (C) 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 @@ -24,9 +24,9 @@ required='makeinfo tex texi2dvi GNUmake' set -e -cat >configure.in <<'END' +cat >configure.in < version.m4 $MAKE distcheck ./configure --version | grep '3\.141' grep '3\.141' version.texi + +: