Modernize, improve and extend tests `suffix*.test'.
authorStefano Lattarini <stefano.lattarini@gmail.com>
Sat, 19 Jun 2010 15:32:31 +0000 (17:32 +0200)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sun, 20 Jun 2010 18:31:41 +0000 (20:31 +0200)
* tests/suffix3.test: Enable `errexit' shell flag, and related
changes.
* tests/suffix4.test: Likewise.
* tests/suffix6.test: Likewise, and do not create a useless dummy
source file.
* tests/suffix7.test: Likewise.
* tests/suffix5.test: Enable `errexit' shell flag, and related
changes.  Make grepping of Makefile.in slighty stricter.
* tests/suffix.test: Enable `errexit' shell flag, and related
changes.  Also, do not redirect grep output to /dev/null, as this
might unmotivatedly hide useful information.
* tests/suffix2.test: Move setting of `errexit' shell flag earlier
in the script (just after inclusion of ./defs).  Use a more
idiomatic way to count text occurrences in Makefile.in with
grep.  Do not create useless dummy source files.
* tests/suffix10.test: Ensure verbose printing of captured make
stdout.  Minor cosmetic changes.
* tests/suffix8.test: Likewise.  Also, drop useless call to the
env(1) utility, and make grepping of make output stricter by using
$FGREP rather than plain grep.
* tests/suffix11.test: Likewise.
* tests/suffix12.test: Likewise.
* tests/suffix9.test: Prefet cat + here-doc over echo to append to
the `configure.in' stub.  Cosmetic changes.
* tests/suffix13.test: Cosmetic spacing change.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
14 files changed:
ChangeLog
tests/suffix.test
tests/suffix10.test
tests/suffix11.test
tests/suffix12.test
tests/suffix13.test
tests/suffix2.test
tests/suffix3.test
tests/suffix4.test
tests/suffix5.test
tests/suffix6.test
tests/suffix7.test
tests/suffix8.test
tests/suffix9.test

index c9a7defea485036846f9bcf0a6aef96320c354ba..c05f61a6b38fab5d5f5262325301da4b854aabeb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,32 @@
+2010-06-20  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       Modernize, improve and extend tests `suffix*.test'.
+       * tests/suffix3.test: Enable `errexit' shell flag, and related
+       changes.
+       * tests/suffix4.test: Likewise.
+       * tests/suffix6.test: Likewise, and do not create a useless dummy
+       source file.
+       * tests/suffix7.test: Likewise.
+       * tests/suffix5.test: Enable `errexit' shell flag, and related
+       changes.  Make grepping of Makefile.in slighty stricter.
+       * tests/suffix.test: Enable `errexit' shell flag, and related
+       changes.  Also, do not redirect grep output to /dev/null, as this
+       might unmotivatedly hide useful information.
+       * tests/suffix2.test: Move setting of `errexit' shell flag earlier
+       in the script (just after inclusion of ./defs).  Use a more
+       idiomatic way to count text occurrences in Makefile.in with
+       grep.  Do not create useless dummy source files.
+       * tests/suffix10.test: Ensure verbose printing of captured make
+       stdout.  Minor cosmetic changes.
+       * tests/suffix8.test: Likewise.  Also, drop useless call to the
+       env(1) utility, and make grepping of make output stricter by using
+       $FGREP rather than plain grep.
+       * tests/suffix11.test: Likewise.
+       * tests/suffix12.test: Likewise.
+       * tests/suffix9.test: Prefet cat + here-doc over echo to append to
+       the `configure.in' stub.  Cosmetic changes.
+       * tests/suffix13.test: Cosmetic spacing change.
+
 2010-06-13  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        Add useful comment in test script ext.test.
index b77e19df60674cbebeeffa51a2fcfd6983a90214..c790c66a46605c6fc16e839e64c25e0192359970 100755 (executable)
@@ -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,6 +18,8 @@
 
 . ./defs || Exit 1
 
+set -e
+
 cat >> configure.in << 'END'
 AC_PROG_CC
 END
@@ -26,10 +28,12 @@ cat > Makefile.am << 'END'
 noinst_PROGRAMS = foo
 END
 
-$ACLOCAL || Exit 1
-$AUTOMAKE -i || Exit 1
+$ACLOCAL
+
+$AUTOMAKE -i
+grep '^\.c\.o' Makefile.in
 
-grep '^\.c\.o' Makefile.in > /dev/null || Exit 1
+$AUTOMAKE
+grep '^\.c\.o' Makefile.in
 
-$AUTOMAKE || Exit 1
-grep '^\.c\.o' Makefile.in > /dev/null || Exit 1
+:
index 85525d0f428163e6ee1c2bafb8d254bc24f29eba..131359c8fc58eff6c365650de4a195777213b72c 100755 (executable)
@@ -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
@@ -45,7 +45,11 @@ libtoolize --force
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE --add-missing
+
 ./configure
-$MAKE print >stdout
+
+$MAKE print >stdout || { cat stdout; Exit 1; }
 cat stdout
 grep 'BEGIN: foo.lo :END' stdout
+
+:
index e38926a622ce92eadb055f9a3ae66e0396a1280f..91d2cf4d38b97e62f64567c8e76ca6538ce0e07e 100755 (executable)
@@ -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
@@ -37,7 +37,7 @@ baz_SOURCES = baz1.x_ baz2.y-z
   .z_.c   .w_.x_ :
        cp $< $@
 
-
+.PHONY: print
 print:
        @echo BEGIN: $(foo_OBJECTS) :END
        @echo BEGIN: $(bar_OBJECTS) :END
@@ -46,14 +46,20 @@ END
 
 $ACLOCAL
 $AUTOCONF
+
 # What we do is not portable.  Automake should warn.
 AUTOMAKE_fails -a
-grep 'Inference rules can have only one target before the colon' stderr
+grep '[iI]nference rules can have only one target before the colon' stderr
+
 # But this should work anyway.
 $AUTOMAKE -a -Wno-portability
+
 ./configure
-env OBJEXT=foo $MAKE -e print >stdout
+
+OBJEXT=foo $MAKE -e print >stdout || { cat stdout; Exit 1; }
 cat stdout
-grep 'BEGIN: foo.foo :END' stdout
-grep 'BEGIN: bar.foo :END' stdout
-grep 'BEGIN: baz1.foo baz2.foo :END' stdout
+$FGREP 'BEGIN: foo.foo :END' stdout
+$FGREP 'BEGIN: bar.foo :END' stdout
+$FGREP 'BEGIN: baz1.foo baz2.foo :END' stdout
+
+:
index e2a8c44da37e6846c3968f98b88936919536227c..21089a549db78272a3758cc9ee838217d59878f4 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2003, 2006  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 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
@@ -35,6 +35,8 @@ SUFFIXES = .baz .o
 
 bin_PROGRAMS = foo
 foo_SOURCES = foo.c sub/bar.baz
+
+.PHONY: print
 print:
        @echo BEGIN: $(foo_OBJECTS) :END
 END
@@ -47,6 +49,8 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -a
 ./configure
-env OBJEXT=OBJ $MAKE -e print >stdout
+OBJEXT=OBJ $MAKE -e print >stdout || { cat stdout; Exit 1; }
 cat stdout
-grep 'BEGIN: foo.OBJ sub/bar.OBJ :END' stdout
+$FGREP 'BEGIN: foo.OBJ sub/bar.OBJ :END' stdout
+
+:
index df5f4d573fb27b39ab9786906afe82d01f197086..2b394607e7d72ddf6b527c633b50a7ffd4a02d69 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2002, 2003, 2006, 2009  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2006, 2009, 2010 Free Software Foundation,
+# Inc.
 #
 # This file is part of GNU Automake.
 #
@@ -72,4 +73,5 @@ $AUTOMAKE --force
 ./configure
 $MAKE
 $MAKE distcheck
+
 :
index 59a72f48c56de06af5d4bac3b78b261087285229..405ce90c5ad98d6cd5bad13d1b4a7a14367eefd6 100755 (executable)
@@ -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
@@ -19,6 +20,8 @@ required=libtoolize
 
 . ./defs || Exit 1
 
+set -e
+
 cat >> configure.in << 'END'
 AC_PROG_CC
 AC_PROG_LIBTOOL
@@ -30,9 +33,6 @@ lib_LTLIBRARIES = libltdl.la
 libltdl_la_SOURCES = ltdl.c ltdl.h
 END
 
-: > ltdl.c
-: > ltdl.h
-
 # Create all the files created libtoolize so we don't run libtoolize.
 # We don't want the user to need libtool to run this test.
 : > ltconfig
@@ -40,12 +40,10 @@ END
 : > config.guess
 : > config.sub
 
-set -e
-
-$ACLOCAL || Exit 1
+$ACLOCAL
 $AUTOMAKE -a
 
-grep -c '^\.c\.o:' Makefile.in   | grep '^1$'
-grep -c '^\.c\.obj:' Makefile.in | grep '^1$'
+test `grep -c '^\.c\.o:' Makefile.in` -eq 1
+test `grep -c '^\.c\.obj:' Makefile.in` -eq 1
 
-Exit 0
+:
index 1e8a00d080e9d04ebf1a3a8a0f1f54b213e0a10d..fc445bf51519fd056c04d3398c1ae084f10fc287 100755 (executable)
@@ -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,6 +18,8 @@
 
 . ./defs || Exit 1
 
+set -e
+
 cat >> configure.in << 'END'
 AC_PROG_CXX
 END
@@ -30,13 +32,14 @@ bin_PROGRAMS = foo
 foo_SOURCES = foo.zoo
 END
 
-$ACLOCAL || Exit 1
-$AUTOMAKE || Exit 1
+$ACLOCAL
+$AUTOMAKE
 
 # The foo.cc intermediate step is implicit, it's a mistake if
 # Automake requires this file somewhere.
 $FGREP foo.cc Makefile.in && Exit 1
 # However Automake must figure that foo.zoo is eventually
 # transformed into foo.o, and use this latter file (to link foo).
-$FGREP 'foo.$(OBJEXT)' Makefile.in || Exit 1
-Exit 0
+$FGREP 'foo.$(OBJEXT)' Makefile.in
+
+:
index b1d60685561ad3256f5773f435ea89774ec01a96..e95228315df784fa7976482e8a8d7f7c653faf76 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
@@ -22,6 +22,8 @@
 
 . ./defs || Exit 1
 
+set -e
+
 cat > Makefile.am << 'END'
 .k.o:
        echo $< > $@
@@ -30,7 +32,8 @@ bin_PROGRAMS = foo
 foo_SOURCES = foo.k
 END
 
-$ACLOCAL || Exit 1
-$AUTOMAKE || Exit 1
-grep '.SUFFIXES:.*\.k' Makefile.in || Exit 1
-Exit 0
+$ACLOCAL
+$AUTOMAKE
+grep '.SUFFIXES:.*\.k' Makefile.in
+
+:
index 1fd55d32fa91fa9d09efaa96ede970bb5e4d7643..b3b36aaea5fbf657250acdcb3909359cf2df4ae8 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/>.
 
-required=libtool
-
 # Test to make sure Automake include libtool objects resulting
 # from user-defined implicit rules.
 # Based on a report from Arkadiusz Miskiewicz <misiek@pld.ORG.PL>.
 
+required=libtool
 . ./defs || Exit 1
 
+set -e
+
 cat >> configure.in << 'END'
 AC_PROG_LIBTOOL
 END
@@ -38,7 +39,8 @@ END
 : > config.guess
 : > config.sub
 
-$ACLOCAL || Exit 1
-$AUTOMAKE || Exit 1
-grep '_OBJECTS.*foo.lo' Makefile.in || Exit 1
-Exit 0
+$ACLOCAL
+$AUTOMAKE
+grep '_OBJECTS.*foo\.lo' Makefile.in
+
+:
index 79759d622c767acac5dbc8eb0ba2d6bf6bfd469b..ab7cf645976f6ff042c6882121d11c1c886e59da 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
@@ -19,6 +19,8 @@
 
 . ./defs || Exit 1
 
+set -e
+
 cat > Makefile.am << 'END'
 SUFFIXES = a b .$(OBJEXT) c .o
 bin_PROGRAMS = foo
@@ -31,14 +33,14 @@ c.o:
        cp $< $@
 END
 
-: > fooa
-
-$ACLOCAL || Exit 1
-$AUTOMAKE || Exit 1
+$ACLOCAL
+$AUTOMAKE
 
 # Automake must figure that fooa translates to foo.$(OBJEXT) and
 # foo.$(OBJEXT) using the following rules:
 #  fooa --[ab]--> foob --[b.$(OBJEXT)]--> foo.$(OBJEXT)
-grep '_OBJECTS.* foo\.$(OBJEXT)' Makefile.in || Exit 1
+grep '_OBJECTS.* foo\.\$(OBJEXT)' Makefile.in
 #  fuc --[c.o]--> fu.$(OBJEXT)  ## This is really meant !
-grep '_OBJECTS.* fu\.$(OBJEXT)' Makefile.in || Exit 1
+grep '_OBJECTS.* fu\.\$(OBJEXT)' Makefile.in
+
+:
index 170660b99022bbc30ac1d4d4dfb890e737c1a276..60058b82fd8119105f196ce31905a9d390836b63 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
@@ -19,6 +19,8 @@
 
 . ./defs || Exit 1
 
+set -e
+
 cat > Makefile.am << 'END'
 SUFFIXES = .idl S.cpp C.h
 SUFFIXES += C.cpp S.h
@@ -26,14 +28,12 @@ SUFFIXES += C.cpp S.h
        cp $< $@
 END
 
-: > fooa
-
-$ACLOCAL || Exit 1
-$AUTOMAKE || Exit 1
+$ACLOCAL
+$AUTOMAKE
 
 # Make sure Automake has NOT recognized .cpp and .idlC as two new
 # extensions.
 grep 'SUFFIXES.* \.cpp' Makefile.in && Exit 1
 grep 'SUFFIXES.* \.idlC' Makefile.in && Exit 1
 
-Exit 0
+:
index fd12a0aa70acfe784875c348a71aa634953034f9..70ff3a5906e281c526a1b7c24789cff71104701b 100755 (executable)
@@ -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
@@ -68,9 +68,14 @@ libtoolize
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -a
+
 ./configure
-env OBJEXT=foo $MAKE -e print >stdout
+
+OBJEXT=foo $MAKE -e print >stdout || { cat stdout; Exit 1; }
 cat stdout
-grep 'BEGIN: foo.foo :END' stdout
-grep 'BEGIN: bar.lo :END' stdout
+$FGREP 'BEGIN: foo.foo :END' stdout
+$FGREP 'BEGIN: bar.lo :END' stdout
+
 $MAKE test
+
+:
index 5b2407ff55e60826d3cb19216a651e114a15bf4d..815ec56ef0b0514af89e47bf6239303a05f7a7ba 100755 (executable)
@@ -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
 
 set -e
 
-echo AC_PROG_CC >>configure.in
+cat >>configure.in << 'END'
+AC_PROG_CC
+END
+
+$ACLOCAL
 
 #  x_ -> y -> c -> o
 #   \________/
@@ -43,7 +47,6 @@ foo_SOURCES = foo.x_
        cp $< $@
 END
 
-$ACLOCAL
 $AUTOMAKE -a
 
 # Idem with the rules the another order.
@@ -59,3 +62,5 @@ foo_SOURCES = foo.x_
 END
 
 $AUTOMAKE -a
+
+: