Modernize, improve and/or fix various test scripts.
authorStefano Lattarini <stefano.lattarini@gmail.com>
Wed, 9 Jun 2010 22:15:04 +0000 (00:15 +0200)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sat, 12 Jun 2010 12:12:47 +0000 (14:12 +0200)
* 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 <Ralf.Wildenhues@gmx.de>
15 files changed:
ChangeLog
tests/Makefile.am
tests/Makefile.in
tests/cygwin32.test
tests/forcemiss.test [moved from tests/symlink3.test with 76% similarity]
tests/forcemiss2.test [new file with mode: 0755]
tests/postproc.test
tests/recurs.test
tests/recurs2.test
tests/scripts.test
tests/strip.test
tests/substre2.test
tests/substref.test
tests/substtarg.test
tests/symlink2.test

index d818103..04602e2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,37 @@
 2010-06-12  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
+       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.
index 3a0a776..70058a1 100644 (file)
@@ -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 \
index b344e7c..849dc8f 100644 (file)
@@ -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 \
index 6b8d70a..ec3f43d 100755 (executable)
@@ -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
+
+:
similarity index 76%
rename from tests/symlink3.test
rename to tests/forcemiss.test
index 12cb714..4b9f63c 100755 (executable)
@@ -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
 
 . ./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 (executable)
index 0000000..408ea8a
--- /dev/null
@@ -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 <http://www.gnu.org/licenses/>.
+
+# 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
+
+:
index 197f267..44570fe 100755 (executable)
@@ -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
 
 . ./defs || Exit 1
 
-cat >configure.in <<'END'
-AC_INIT([mumble], [0.1])
+set -e
+
+cat >configure.in <<END
+AC_INIT([$me], [1.0])
 AM_INIT_AUTOMAKE
 AC_PROG_CC
 AC_CONFIG_FILES([myMakefile])
@@ -32,9 +34,9 @@ bin_PROGRAMS = fred
 fred_SOURCES = fred.c
 END
 
-$ACLOCAL || Exit 1
-$AUTOCONF || Exit 1
-$AUTOMAKE -- myMakefile || Exit 1
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -- myMakefile
 
 mv myMakefile.in myMakefile.old
 echo '# Post-processed by post-processor 3.14.' > myMakefile.in
index 026fb0d..4937f4f 100755 (executable)
@@ -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
 
 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
+
+:
index 5062bf0..c025984 100755 (executable)
@@ -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
 
 . ./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
index 6d3f0e8..b9aed7f 100755 (executable)
@@ -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
 
 . ./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
index 3dcddaf..a005a9a 100755 (executable)
@@ -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
 
 . ./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
+
+:
index 30e7c94..ffe9e8b 100755 (executable)
@@ -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
+
+:
index 41d782a..3d4da05 100755 (executable)
@@ -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
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# 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
+
+:
index 7d5e098..d828954 100755 (executable)
@@ -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
 
 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'
index cb2cd30..97a3d26 100755 (executable)
@@ -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
 
 . ./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
+
+: