From 96286138989c8e3d32d00c7373ccd154e6638695 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Thu, 10 Jun 2010 00:15:04 +0200 Subject: [PATCH] Modernize, improve and/or fix various test scripts. * tests/symlink3.test: Deleted, separated into two new, more complete tests ... * tests/forcemiss.test: ... this one ... * tests/forcemiss2.test: ... and this one. * tests/symlink2.test: Enable `errexit' shell flag, make test stricter, and skip it if symlink creation is not supported. * tests/postproc.test: Enable `errexit' shell flag, related changes, and a couple of unrelated cosmetic changes. * tests/recurs.test: Use the `configure.in' stub created by `./defs', rather than writing one from scratch. Make grepping of Automake stderr slighty stricter. * tests/substtarg.test: Likewise. * tests/strip.test: Likewise, and move the call to `set -e' earlier (just after the inclusion of `./defs'). Also, make sure that the script installed by `make install-script' is equal to the original one. * tests/substref.test: Use the `configure.in' stub created by `./defs', rather than writing one from scratch. Move the call to `set -e' earlier (just after the inclusion of `./defs'). Avoid to explicitly export CC for configure (that's already done in ./defs). Avoid potential problems with unpredictable make output. Finally, make grepping of Makefile.in stricter. * tests/substre2.test: Ensure verbose printing of the captured make's output, and make its grepping slighty stricter. * tests/cygwin32.test: Enable `errexit' shell flag, and related changes. Also, do not create useless dummy source/data files. * tests/scripts.test: Likewise. * tests/recurs2.test: Likewise. Also, use the `configure.in' stub created by `./defs'. * tests/Makefile.am (TESTS): Updated. Signed-off-by: Ralf Wildenhues --- ChangeLog | 32 +++++++++++++++++++++++ tests/Makefile.am | 3 ++- tests/Makefile.in | 3 ++- tests/cygwin32.test | 14 +++++----- tests/{symlink3.test => forcemiss.test} | 19 ++++++++------ tests/forcemiss2.test | 45 +++++++++++++++++++++++++++++++++ tests/postproc.test | 14 +++++----- tests/recurs.test | 12 ++++----- tests/recurs2.test | 14 +++------- tests/scripts.test | 11 +++----- tests/strip.test | 20 ++++++++------- tests/substre2.test | 8 +++--- tests/substref.test | 36 +++++++++++++------------- tests/substtarg.test | 14 +++++----- tests/symlink2.test | 17 ++++++++++--- 15 files changed, 176 insertions(+), 86 deletions(-) rename tests/{symlink3.test => forcemiss.test} (76%) create mode 100755 tests/forcemiss2.test diff --git a/ChangeLog b/ChangeLog index d818103..04602e2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,37 @@ 2010-06-12 Stefano Lattarini + Modernize, improve and/or fix various test scripts. + * tests/symlink3.test: Deleted, separated into two new, more + complete tests ... + * tests/forcemiss.test: ... this one ... + * tests/forcemiss2.test: ... and this one. + * tests/symlink2.test: Enable `errexit' shell flag, make test + stricter, and skip it if symlink creation is not supported. + * tests/postproc.test: Enable `errexit' shell flag, related + changes, and a couple of unrelated cosmetic changes. + * tests/recurs.test: Use the `configure.in' stub created by + `./defs', rather than writing one from scratch. Make grepping + of Automake stderr slighty stricter. + * tests/substtarg.test: Likewise. + * tests/strip.test: Likewise, and move the call to `set -e' + earlier (just after the inclusion of `./defs'). Also, make sure + that the script installed by `make install-script' is equal to + the original one. + * tests/substref.test: Use the `configure.in' stub created by + `./defs', rather than writing one from scratch. Move the call + to `set -e' earlier (just after the inclusion of `./defs'). + Avoid to explicitly export CC for configure (that's already done + in ./defs). Avoid potential problems with unpredictable make + output. Finally, make grepping of Makefile.in stricter. + * tests/substre2.test: Ensure verbose printing of the captured + make's output, and make its grepping slighty stricter. + * tests/cygwin32.test: Enable `errexit' shell flag, and related + changes. Also, do not create useless dummy source/data files. + * tests/scripts.test: Likewise. + * tests/recurs2.test: Likewise. Also, use the `configure.in' + stub created by `./defs'. + * tests/Makefile.am (TESTS): Updated. + Modernize, improve and/or fix tests `pluseq*.test. * tests/pluseq5.test: Append to configure.in using cat with an here-doc, not using echo. diff --git a/tests/Makefile.am b/tests/Makefile.am index 3a0a776..70058a1 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -317,6 +317,8 @@ fn99.test \ fn99subdir.test \ fnoc.test \ fo.test \ +forcemiss.test \ +forcemiss2.test \ fort1.test \ fort2.test \ fort4.test \ @@ -688,7 +690,6 @@ suffix12.test \ suffix13.test \ symlink.test \ symlink2.test \ -symlink3.test \ syntax.test \ tags.test \ tagsub.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index b344e7c..849dc8f 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -555,6 +555,8 @@ fn99.test \ fn99subdir.test \ fnoc.test \ fo.test \ +forcemiss.test \ +forcemiss2.test \ fort1.test \ fort2.test \ fort4.test \ @@ -926,7 +928,6 @@ suffix12.test \ suffix13.test \ symlink.test \ symlink2.test \ -symlink3.test \ syntax.test \ tags.test \ tagsub.test \ diff --git a/tests/cygwin32.test b/tests/cygwin32.test index 6b8d70a..ec3f43d 100755 --- a/tests/cygwin32.test +++ b/tests/cygwin32.test @@ -1,5 +1,6 @@ #! /bin/sh -# Copyright (C) 1997, 1999, 2001, 2002, 2008 Free Software Foundation, Inc. +# Copyright (C) 1997, 1999, 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 @@ -18,6 +19,8 @@ . ./defs || Exit 1 +set -e + cat >> configure.in << 'END' AC_PROG_CC END @@ -29,11 +32,10 @@ EXTRA_www_SOURCES = xtra.c www_LDADD = @extra_stuff@ END -: > www.c -: > xtra.c - -$ACLOCAL || Exit 1 -$AUTOMAKE || Exit 1 +$ACLOCAL +$AUTOMAKE grep '^CYGWIN' Makefile.in && Exit 1 grep 'EXEEXT' Makefile.in + +: diff --git a/tests/symlink3.test b/tests/forcemiss.test similarity index 76% rename from tests/symlink3.test rename to tests/forcemiss.test index 12cb714..4b9f63c 100755 --- a/tests/symlink3.test +++ b/tests/forcemiss.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,16 +18,19 @@ . ./defs || Exit 1 +set -e + rm -f install-sh -rm -f mkinstalldirs -echo zot > zot -echo zot > mkinstalldirs +echo zot > install-sh : > Makefile.am -$ACLOCAL || Exit 1 -$AUTOMAKE --add-missing --force-missing || Exit 1 +$ACLOCAL +$AUTOMAKE --add-missing --force-missing + +ls -l install-sh +test -f install-sh +grep zot install-sh && Exit 1 -grep zot mkinstalldirs && Exit 1 -Exit 0 +: diff --git a/tests/forcemiss2.test b/tests/forcemiss2.test new file mode 100755 index 0000000..408ea8a --- /dev/null +++ b/tests/forcemiss2.test @@ -0,0 +1,45 @@ +#! /bin/sh +# 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 +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Test to make sure that `automake --force-missing' works, even with +# symlinked files. + +. ./defs || Exit 1 + +set -e + +rm -f install-sh + +echo zot > foo +cp foo foo2 + +ln -s foo2 install-sh || { + echo "$me: cannot create symlinks to files" >&2 + Exit 77 +} + +: > Makefile.am + +$ACLOCAL +ls -l install-sh +$AUTOMAKE --add-missing --force-missing +ls -l install-sh + +test -f install-sh +grep zot install-sh && Exit 1 +diff foo foo2 + +: diff --git a/tests/postproc.test b/tests/postproc.test index 197f267..44570fe 100755 --- a/tests/postproc.test +++ b/tests/postproc.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2002, 2004, 2009 Free Software Foundation, Inc. +# Copyright (C) 2002, 2004, 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 @@ -19,8 +19,10 @@ . ./defs || Exit 1 -cat >configure.in <<'END' -AC_INIT([mumble], [0.1]) +set -e + +cat >configure.in < myMakefile.in diff --git a/tests/recurs.test b/tests/recurs.test index 026fb0d..4937f4f 100755 --- a/tests/recurs.test +++ b/tests/recurs.test @@ -1,5 +1,6 @@ #! /bin/sh -# Copyright (C) 1998, 2001, 2002, 2003 Free Software Foundation, Inc. +# Copyright (C) 1998, 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,13 +21,10 @@ set -e -cat > configure.in << 'END' -AC_INIT -AM_INIT_AUTOMAKE(nonesuch, nonesuch) +cat >> configure.in << 'END' AC_PROG_CC AM_CONDITIONAL(ONE, true) AM_CONDITIONAL(TWO, false) -AC_OUTPUT(Makefile) END cat > Makefile.am << 'END' @@ -36,4 +34,6 @@ END $ACLOCAL AUTOMAKE_fails -grep 'Makefile.am:.*bin_PROGRAMS.*recursively defined' stderr +grep 'Makefile\.am:.*bin_PROGRAMS.*recursively defined' stderr + +: diff --git a/tests/recurs2.test b/tests/recurs2.test index 5062bf0..c025984 100755 --- a/tests/recurs2.test +++ b/tests/recurs2.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,12 +19,7 @@ . ./defs || Exit 1 -cat > configure.in << 'END' -AC_INIT -AM_INIT_AUTOMAKE(nonesuch, nonesuch) -AC_PROG_CC -AC_OUTPUT(Makefile) -END +set -e cat > Makefile.am << 'END' man_MANS = chgrp.1 @@ -32,8 +27,5 @@ man_aux = $(man_MANS:.1=.x) EXTRA_DIST = $(man_aux) $(man_MANS) END -> chgrp.1 -> chgrp.x - -$ACLOCAL || Exit 1 +$ACLOCAL $AUTOMAKE diff --git a/tests/scripts.test b/tests/scripts.test index 6d3f0e8..b9aed7f 100755 --- a/tests/scripts.test +++ b/tests/scripts.test @@ -1,5 +1,6 @@ #! /bin/sh -# Copyright (C) 1996, 1998, 2000, 2001, 2002 Free Software Foundation, Inc. +# Copyright (C) 1996, 1998, 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,15 +20,11 @@ . ./defs || Exit 1 -cat > configure.in << 'END' -AC_INIT -AM_INIT_AUTOMAKE(nonesuch, nonesuch) -AC_OUTPUT(Makefile) -END +set -e cat > Makefile.am << 'END' noinst_SCRIPTS = foo END -$ACLOCAL || Exit 1 +$ACLOCAL $AUTOMAKE diff --git a/tests/strip.test b/tests/strip.test index 3dcddaf..a005a9a 100755 --- a/tests/strip.test +++ b/tests/strip.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2002, 2007 Free Software Foundation, Inc. +# Copyright (C) 2002, 2007, 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,12 +18,11 @@ . ./defs || Exit 1 -cat > configure.in << 'END' -AC_INIT(foo, 0.1, dev@null) -AM_INIT_AUTOMAKE($PACKAGE, $VERSION) +set -e + +cat >> configure.in << 'END' AC_PROG_CC -AM_CONDITIONAL(FOOTEST, false) -AC_CONFIG_FILES(Makefile) +AM_CONDITIONAL([FOOTEST], [false]) AC_OUTPUT END @@ -38,13 +37,16 @@ END chmod +x foo -set -e - mkdir install $ACLOCAL $AUTOCONF $AUTOMAKE -a -./configure "--prefix=`cd install && pwd`" + +prefix=`cd install && pwd` || Exit 1 +./configure --prefix="$prefix" $MAKE $MAKE install-strip +diff foo "$prefix"/bin/foo + +: diff --git a/tests/substre2.test b/tests/substre2.test index 30e7c94..ffe9e8b 100755 --- a/tests/substre2.test +++ b/tests/substre2.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 @@ -46,6 +46,8 @@ $ACLOCAL $AUTOCONF $AUTOMAKE -a ./configure -$MAKE echorule >output +$MAKE echorule >output || { cat output; Exit 1; } cat output -grep 'BEG: foo1.obj foo4.obj bar3.obj bar4.obj :END' output +$FGREP 'BEG: foo1.obj foo4.obj bar3.obj bar4.obj :END' output + +: diff --git a/tests/substref.test b/tests/substref.test index 41d782a..3d4da05 100755 --- a/tests/substref.test +++ b/tests/substref.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 @@ -14,18 +14,18 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Test for bug in variable substitution references when left hand pattern is -# null. +# Test for bug in variable substitution references when left hand +# pattern is null. # Report from Richard Boulton required=gcc . ./defs || Exit 1 -cat > configure.in << 'END' -AC_INIT(hello.c) -AM_INIT_AUTOMAKE(hello,0.23) +set -e + +cat >> configure.in << 'END' AC_PROG_CC -AC_OUTPUT(Makefile) +AC_OUTPUT END cat > hello.c << 'END' @@ -39,30 +39,32 @@ var2 = $(var1:=.) helldl_SOURCES = $(var2:=c) -echorule: - @echo $(helldl_SOURCES) $(helldl_OBJECTS) - bin_PROGRAMS = helldl + +got: + @echo $(helldl_SOURCES) $(helldl_OBJECTS) >got + END # Ignore user CFLAGS. CFLAGS= export CFLAGS -set -e - $ACLOCAL $AUTOCONF $AUTOMAKE -a -CC='gcc' ./configure +./configure -val=`$MAKE -s echorule`; -echo $val -test "x$val" = "xdlmain.c dlmain.o" +echo dlmain.c dlmain.o >exp +$MAKE got +cat got +diff exp got # This is unrelated to the rest of this test. But while we are # at it, make sure we don't use am__helldl_SOURCES_DIST here, since # it's not needed. DIST_SOURCES should contains $(helldl_SOURCES). grep am__helldl_SOURCES_DIST Makefile && Exit 1 -grep 'DIST_SOURCES.*\(helldl_SOURCES\)' Makefile +grep 'DIST_SOURCES.*\$(helldl_SOURCES)' Makefile + +: diff --git a/tests/substtarg.test b/tests/substtarg.test index 7d5e098..d828954 100755 --- a/tests/substtarg.test +++ b/tests/substtarg.test @@ -1,5 +1,6 @@ #! /bin/sh -# Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. +# Copyright (C) 2001, 2002, 2003, 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 @@ -21,15 +22,14 @@ set -e -cat > configure.in << 'END' -AC_INIT(fakelib.c) -AM_INIT_AUTOMAKE(fakelib,0.0) +cat >> configure.in << 'END' +AC_CONFIG_SOURCE([fakelib.c]) AC_PROG_CC RANLIB=: -AC_SUBST(RANLIB) +AC_SUBST([RANLIB]) SUBST=hei -AC_SUBST(SUBST) -AC_OUTPUT(Makefile) +AC_SUBST([SUBST]) +AC_OUTPUT END cat > Makefile.am << 'END' diff --git a/tests/symlink2.test b/tests/symlink2.test index cb2cd30..97a3d26 100755 --- a/tests/symlink2.test +++ b/tests/symlink2.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,11 +18,20 @@ . ./defs || Exit 1 +set -e + rm -f install-sh -rm -f mkinstalldirs -ln -s Zardoz mkinstalldirs +ln -s Zardoz install-sh || { + echo "$me: cannot create broken symlinks" >&2 + Exit 77 +} : > Makefile.am -$ACLOCAL || Exit 1 +$ACLOCAL $AUTOMAKE --add-missing + +test -f install-sh +test ! -r Zardoz + +: -- 2.7.4