Yet another testsuite-tweaking patch (the last one for today). Regards, Stefano
-*-*-*- 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. --- ChangeLog | 29 +++++++++++++++++++++++++++++ tests/suffix.test | 16 ++++++++++------ tests/suffix10.test | 8 ++++++-- tests/suffix11.test | 16 +++++++++++----- tests/suffix12.test | 10 +++++++--- tests/suffix13.test | 4 +++- tests/suffix2.test | 18 ++++++++---------- tests/suffix3.test | 13 ++++++++----- tests/suffix4.test | 13 ++++++++----- tests/suffix5.test | 16 +++++++++------- tests/suffix6.test | 16 +++++++++------- tests/suffix7.test | 12 ++++++------ tests/suffix8.test | 13 +++++++++---- tests/suffix9.test | 11 ++++++++--- 14 files changed, 131 insertions(+), 64 deletions(-)
From 0f027c73e44697416b267ec2f3c6787ce4c5ac78 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini <stefano.lattar...@gmail.com> Date: Sat, 19 Jun 2010 17:32:31 +0200 Subject: [PATCH] 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. --- ChangeLog | 29 +++++++++++++++++++++++++++++ tests/suffix.test | 16 ++++++++++------ tests/suffix10.test | 8 ++++++-- tests/suffix11.test | 16 +++++++++++----- tests/suffix12.test | 10 +++++++--- tests/suffix13.test | 4 +++- tests/suffix2.test | 18 ++++++++---------- tests/suffix3.test | 13 ++++++++----- tests/suffix4.test | 13 ++++++++----- tests/suffix5.test | 16 +++++++++------- tests/suffix6.test | 16 +++++++++------- tests/suffix7.test | 12 ++++++------ tests/suffix8.test | 13 +++++++++---- tests/suffix9.test | 11 ++++++++--- 14 files changed, 131 insertions(+), 64 deletions(-) diff --git a/ChangeLog b/ChangeLog index b5f1433..92dca75 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,32 @@ +2010-06-19 Stefano Lattarini <stefano.lattar...@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.lattar...@gmail.com> Add useful comment in test script obsolete.test. diff --git a/tests/suffix.test b/tests/suffix.test index b77e19d..c790c66 100755 --- a/tests/suffix.test +++ b/tests/suffix.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,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 +: diff --git a/tests/suffix10.test b/tests/suffix10.test index 85525d0..131359c 100755 --- a/tests/suffix10.test +++ b/tests/suffix10.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 @@ -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 + +: diff --git a/tests/suffix11.test b/tests/suffix11.test index 35cb41a..3cade28 100755 --- a/tests/suffix11.test +++ b/tests/suffix11.test @@ -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 + # 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 + +: diff --git a/tests/suffix12.test b/tests/suffix12.test index e2a8c44..21089a5 100755 --- a/tests/suffix12.test +++ b/tests/suffix12.test @@ -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 + +: diff --git a/tests/suffix13.test b/tests/suffix13.test index df5f4d5..2b39460 100755 --- a/tests/suffix13.test +++ b/tests/suffix13.test @@ -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 + : diff --git a/tests/suffix2.test b/tests/suffix2.test index 59a72f4..405ce90 100755 --- a/tests/suffix2.test +++ b/tests/suffix2.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 @@ -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 +: diff --git a/tests/suffix3.test b/tests/suffix3.test index 1e8a00d..fc445bf 100755 --- a/tests/suffix3.test +++ b/tests/suffix3.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,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 + +: diff --git a/tests/suffix4.test b/tests/suffix4.test index b1d6068..e952283 100755 --- a/tests/suffix4.test +++ b/tests/suffix4.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 @@ -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 + +: diff --git a/tests/suffix5.test b/tests/suffix5.test index 1fd55d3..b3b36aa 100755 --- a/tests/suffix5.test +++ b/tests/suffix5.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,14 +14,15 @@ # 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 <mis...@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 + +: diff --git a/tests/suffix6.test b/tests/suffix6.test index 79759d6..ab7cf64 100755 --- a/tests/suffix6.test +++ b/tests/suffix6.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,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 + +: diff --git a/tests/suffix7.test b/tests/suffix7.test index 170660b..60058b8 100755 --- a/tests/suffix7.test +++ b/tests/suffix7.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,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 +: diff --git a/tests/suffix8.test b/tests/suffix8.test index fd12a0a..70ff3a5 100755 --- a/tests/suffix8.test +++ b/tests/suffix8.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 @@ -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 + +: diff --git a/tests/suffix9.test b/tests/suffix9.test index 5b2407f..815ec56 100755 --- a/tests/suffix9.test +++ b/tests/suffix9.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,7 +21,11 @@ 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 + +: -- 1.6.5