On Tuesday 07 September 2010, Ralf Wildenhues wrote: > * Ralf Wildenhues wrote on Sun, Aug 08, 2010 at 01:58:45PM CEST: > > * Stefano Lattarini wrote on Sun, Jun 27, 2010 at 06:14:41PM CEST: > > > Modernize, improve and/or extend test scripts `conf*.test'. > > [...] > > > > * tests/confh.test: Use the `configure.in' stub created by > > > ./defs, rather than writing one from scratch, and do not call > > > AC_OUTPUT. Enable `errexit' shell flag, and related changes. > > > Prefer diff over cmp to compare text files. Prefer perl over > > > sed to fetch the value of $(DIST_COMMON) from Makefile.in. > > > Make grepping of the contents of $(DIST_COMMON) stricter. > > > > > > --- a/tests/confh.test > > > +++ b/tests/confh.test > > > > > > @@ -33,24 +33,26 @@ mkdir include > > > > > > : > include/Makefile.am > > > : > include/config.h.in > > > > > > -$ACLOCAL || Exit 1 > > > -$AUTOMAKE || Exit 1 > > > - > > > -(sed -n -e '/^DIST_COMMON =.*\\$/ { > > > - :loop > > > - p > > > - n > > > - t clear > > > - :clear > > > - s/\\$/\\/ > > > - t loop > > > - p > > > - n > > > - }' -e '/^DIST_COMMON =/ p' Makefile.in | grep acconfig.h) > > > || Exit 1 +$ACLOCAL > > > +$AUTOMAKE > > > + > > > +perl -ne ' > > > +if (s/^DIST_COMMON *=//) > > > +{ > > > + $_ .= <> while (s/\\$//); > > > + $_ = " $_ "; > > > + s/\s+/ /g; > > > + print "$_\n"; > > > + exit 0; > > > +}' Makefile.in > dc.txt > > > > This could instead use extract_variable which we've discussed > > before somewhere, right? ;-) > > Also, this causes two maintainer-check failures (exit and perl). Ouch. The `perl' failure is a genuine one, while the `exit' one is clearly spurious. Anyway, I think that the best fix here is stop to (try to) munge the generated Makefile.in, and rewite the tests (in this case `confh.test' and friends) to be more "semantic" -- i.e. make them run also "autoconf", "./configure" and "make check", after having added proper test*/check* rules.
What about the attached patch (for maint)? As an aside, I'd like to vouch again for my patch "Refactoring maintainer checks (use perl, add whitelisting)", which would provide an easy way to white-list spurious failures. Thanks for the report, Stefano
From 39f27d875f20b640c4f5c31c30644495a5bda0d0 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini <stefano.lattar...@gmail.com> Date: Tue, 7 Sep 2010 12:11:12 +0200 Subject: [PATCH] Make some `confh*.test' tests more "semantic" (plus tweakings). * tests/confh.test: Run "autoconf", "configure" and "make check", instead of munging/grepping the generated `Makefile.in'. * tests/confh4.test: Relax the grepping of Makefile.in w.r.t. white spaces. Do not create usless dummy source file `foo.c' and useless dummy header file `acconfig.h'. (configure.in): Remove superfluous call to `AC_OUTPUT'. * tests/confh6.test: Add trailing `:' command. * tests/confh7.test: In comments, add reference to ... * tests/confh8.test: ... this new test, "semantic" sister of `confh7.test'. * tests/Makefile.am (TESTS): Updated. Prompted by a report from Ralf Wildenhues. --- ChangeLog | 16 ++++++++++++ tests/Makefile.am | 1 + tests/confh.test | 35 ++++++++++++++++----------- tests/confh4.test | 6 +---- tests/confh6.test | 2 + tests/confh7.test | 1 + tests/confh8.test | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 110 insertions(+), 19 deletions(-) create mode 100755 tests/confh8.test diff --git a/ChangeLog b/ChangeLog index 688f4be..d2e0e34 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2010-09-07 Stefano Lattarini <stefano.lattar...@gmail.com> + + Make some `confh*.test' tests more "semantic" (plus tweakings). + * tests/confh.test: Run "autoconf", "configure" and "make check", + instead of munging/grepping the generated `Makefile.in'. + * tests/confh4.test: Relax the grepping of Makefile.in w.r.t. + white spaces. Do not create usless dummy source file `foo.c' + and useless dummy header file `acconfig.h'. + (configure.in): Remove superfluous call to `AC_OUTPUT'. + * tests/confh6.test: Add trailing `:' command. + * tests/confh7.test: In comments, add reference to ... + * tests/confh8.test: ... this new test, "semantic" sister + of `confh7.test'. + * tests/Makefile.am (TESTS): Updated. + Prompted by a report from Ralf Wildenhues. + 2010-08-27 Stefano Lattarini <stefano.lattar...@gmail.com> Fix bug in test missing6.test. diff --git a/tests/Makefile.am b/tests/Makefile.am index 3ecc341..3c8230b 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -223,6 +223,7 @@ confh4.test \ confh5.test \ confh6.test \ confh7.test \ +confh8.test \ confincl.test \ conflnk.test \ conflnk2.test \ diff --git a/tests/confh.test b/tests/confh.test index 552ce5c..34674cc 100755 --- a/tests/confh.test +++ b/tests/confh.test @@ -24,29 +24,36 @@ set -e cat >> configure.in << 'END' AM_CONFIG_HEADER([include/config.h]) +AC_OUTPUT END -: > Makefile.am -: > acconfig.h +cat > Makefile.am << 'END' +.PHONY: test1 test2 +test1: + @echo DIST_COMMON = $(DIST_COMMON) ## for debugging + echo ' ' $(DIST_COMMON) ' ' | grep '[ /]acconfig\.h ' +test2: distdir + ls -l $(distdir)/* ## for debugging + test -f $(distdir)/acconfig.h +check-local: test1 test2 +END mkdir include -: > include/Makefile.am : > include/config.h.in +: > acconfig.h + +# The test used to fail if `include/Makefile.am' was created (!) +: > include/Makefile.am $ACLOCAL +$AUTOCONF $AUTOMAKE -perl -ne ' -if (s/^DIST_COMMON *=//) -{ - $_ .= <> while (s/\\$//); - $_ = " $_ "; - s/\s+/ /g; - print "$_\n"; - exit 0; -}' Makefile.in > dc.txt -cat dc.txt # might be useful for debugging. -$FGREP ' acconfig.h ' dc.txt +./configure + +$MAKE test1 +$MAKE test2 +$MAKE distcheck # Make sure re-running automake in a different way generates same # Makefile.in. diff --git a/tests/confh4.test b/tests/confh4.test index bab2d53..8e36cfa 100755 --- a/tests/confh4.test +++ b/tests/confh4.test @@ -31,7 +31,6 @@ cat >> configure.in << 'END' AC_CONFIG_FILES([include/Makefile]) AM_CONFIG_HEADER([include/config.h]) AC_PROG_CC -AC_OUTPUT END cat > Makefile.am << 'END' @@ -39,9 +38,6 @@ bin_PROGRAMS = foo foo_SOURCES = foo.c END -: > foo.c -: > acconfig.h - mkdir include : > include/Makefile.am : > include/config.h.in @@ -49,6 +45,6 @@ mkdir include $ACLOCAL $AUTOMAKE -grep '^DEFAULT_INCLUDES =.* -I\$(top_builddir)/include' Makefile.in +grep '^ *DEFAULT_INCLUDES *=.* -I\$(top_builddir)/include' Makefile.in : diff --git a/tests/confh6.test b/tests/confh6.test index de55be7..532a2fd 100755 --- a/tests/confh6.test +++ b/tests/confh6.test @@ -45,3 +45,5 @@ $MAKE subdir/config.h $FGREP gRePmE subdir/config.h $MAKE distcheck + +: diff --git a/tests/confh7.test b/tests/confh7.test index 3d0e54a..4e4f7da 100755 --- a/tests/confh7.test +++ b/tests/confh7.test @@ -16,6 +16,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # Test to make sure several config headers are allowed. +# See also sister "semantic" test `confh8.test'. . ./defs || Exit 1 diff --git a/tests/confh8.test b/tests/confh8.test new file mode 100755 index 0000000..df985ec --- /dev/null +++ b/tests/confh8.test @@ -0,0 +1,68 @@ +#! /bin/sh +# Copyright (C) 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 several config headers are allowed. +# See also sister "minimalistic" test `confh7.test'. + +. ./defs || Exit 1 + +set -e + +cat >> configure.in << 'END' +AM_CONFIG_HEADER([one.h two.h]) +AC_OUTPUT +END + +cat > Makefile.am << 'END' +.PHONY: test0 test1 test2 +test0: + @echo DIST_COMMON = $(DIST_COMMON) ## for debugging + echo ' ' $(DIST_COMMON) ' ' | grep '[ /]one\.h\.in ' + echo ' ' $(DIST_COMMON) ' ' | grep '[ /]two\.h\.in ' + : Processed header files should not be distributed. + if echo ' ' $(DIST_COMMON) ' ' | grep '\.h '; then \ + exit 1; \ + else \ + exit 0; \ + fi +test1: all + test -f one.h + test -f two.h +test2: distdir + ls -l $(distdir)/* ## for debugging + test -f $(distdir)/one.h.in + test -f $(distdir)/two.h.in + : Processed header files should not be distributed. + test ! -r $(distdir)/one.h + test ! -r $(distdir)/two.h +check-local: test0 test1 test2 +END + +: > one.h.in +: > two.h.in + +$ACLOCAL +$AUTOCONF +$AUTOMAKE + +./configure + +$MAKE test0 +$MAKE test1 +$MAKE test2 +$MAKE distcheck + +: -- 1.7.1