Hello automakers. In view of a (partly-completed, soon-to-be-posted) patch series that should fix Automake bug#7669[1][2], I'd like to improve the testsuite coverage regarding the "cygnus" mode. Attached is a patch (for maint) which does that.
[1] ``option "foreign" after "-Wall" turns off and portability warnings.'' [2] a.k.a. PR/547 in the older gnats database Note that some of the new testcases are not really relevant for the refactoring, but I'd like to add them anyway while I'm at it. OK to apply the attached patch to maint? I'll wait the customary 72 hours before pushing. Regards, Stefano
From 3e75e70e139824f00b461255318cbeaf96cd0168 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini <stefano.lattar...@gmail.com> Date: Tue, 21 Dec 2010 22:59:19 +0100 Subject: [PATCH] Add some tests on 'cygnus' mode. * tests/clean2.test: Renamed to ... * tests/cygnus-distclean.test: ... this, and extended somewhat. * tests/cygnus-check-without-all.test: New test. * tests/cygnus-dependency-tracking.test: Likewise. * tests/cygnus-distclean.test: Likewise. * tests/cygnus-imply-foreign.test: Likewise. * tests/cygnus-no-dist.test: Likewise. * tests/cygnus-no-installinfo.test: Likewise. * tests/cygnus-requires-maintainer-mode.test: Likewise. * tests/Makefile.am (TESTS): Update. --- ChangeLog | 14 +++ tests/Makefile.am | 8 ++- tests/Makefile.in | 8 ++- .../{clean2.test => cygnus-check-without-all.test} | 45 +++++----- tests/cygnus-dependency-tracking.test | 73 +++++++++++++++++ tests/{clean2.test => cygnus-distclean.test} | 21 +++++- tests/cygnus-imply-foreign.test | 60 ++++++++++++++ tests/cygnus-no-dist.test | 86 ++++++++++++++++++++ tests/{clean2.test => cygnus-no-installinfo.test} | 44 +++++----- ...2.test => cygnus-requires-maintainer-mode.test} | 38 +++++----- 10 files changed, 330 insertions(+), 67 deletions(-) copy tests/{clean2.test => cygnus-check-without-all.test} (62%) create mode 100755 tests/cygnus-dependency-tracking.test copy tests/{clean2.test => cygnus-distclean.test} (80%) create mode 100755 tests/cygnus-imply-foreign.test create mode 100755 tests/cygnus-no-dist.test copy tests/{clean2.test => cygnus-no-installinfo.test} (53%) rename tests/{clean2.test => cygnus-requires-maintainer-mode.test} (62%) diff --git a/ChangeLog b/ChangeLog index 26038e1..fe15ace 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,19 @@ 2010-12-22 Stefano Lattarini <stefano.lattar...@gmail.com> + Add some tests on 'cygnus' mode. + * tests/clean2.test: Renamed to ... + * tests/cygnus-distclean.test: ... this, and extended somewhat. + * tests/cygnus-check-without-all.test: New test. + * tests/cygnus-dependency-tracking.test: Likewise. + * tests/cygnus-distclean.test: Likewise. + * tests/cygnus-imply-foreign.test: Likewise. + * tests/cygnus-no-dist.test: Likewise. + * tests/cygnus-no-installinfo.test: Likewise. + * tests/cygnus-requires-maintainer-mode.test: Likewise. + * tests/Makefile.am (TESTS): Update. + +2010-12-22 Stefano Lattarini <stefano.lattar...@gmail.com> + distlinksbrk.test: Work around botched "make -k". * tests/distlinksbrk.test: Run "make" multiple times and grep its output each time for a single error message, rather than diff --git a/tests/Makefile.am b/tests/Makefile.am index dab04e3..22214bb 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -135,7 +135,6 @@ check10.test \ check11.test \ checkall.test \ clean.test \ -clean2.test \ colneq.test \ colneq2.test \ colon.test \ @@ -243,6 +242,13 @@ cxxlibobj.test \ cxxlink.test \ cxxnoc.test \ cxxo.test \ +cygnus-check-without-all.test \ +cygnus-dependency-tracking.test \ +cygnus-distclean.test \ +cygnus-imply-foreign.test \ +cygnus-no-dist.test \ +cygnus-no-installinfo.test \ +cygnus-requires-maintainer-mode.test \ cygwin32.test \ dash.test \ defun.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index de21f43..bbf3b23 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -402,7 +402,6 @@ check10.test \ check11.test \ checkall.test \ clean.test \ -clean2.test \ colneq.test \ colneq2.test \ colon.test \ @@ -510,6 +509,13 @@ cxxlibobj.test \ cxxlink.test \ cxxnoc.test \ cxxo.test \ +cygnus-check-without-all.test \ +cygnus-dependency-tracking.test \ +cygnus-distclean.test \ +cygnus-imply-foreign.test \ +cygnus-no-dist.test \ +cygnus-no-installinfo.test \ +cygnus-requires-maintainer-mode.test \ cygwin32.test \ dash.test \ defun.test \ diff --git a/tests/clean2.test b/tests/cygnus-check-without-all.test similarity index 62% copy from tests/clean2.test copy to tests/cygnus-check-without-all.test index 99e4c2e..964dc59 100755 --- a/tests/clean2.test +++ b/tests/cygnus-check-without-all.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2004 Free Software Foundation, Inc. +# 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 @@ -14,40 +14,39 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -# Make sure distclean works in cygnus mode. -# Report from Daniel Jacobowitz +# Check that, in cygnus mode, target "check" does not depend target +# "all". . ./defs || Exit 1 set -e -cat >> configure.in << 'END' +cat >> configure.in <<'END' AM_MAINTAINER_MODE -AC_CONFIG_FILES([sub/Makefile]) AC_OUTPUT END -cat > Makefile.am << 'END' -SUBDIRS = sub -END - -mkdir sub - -cat > sub/Makefile.am << 'END' -data_DATA = foo - -foo: - touch $@ - -CLEANFILES = $(data_DATA) +cat > Makefile.am <<'END' +all-local: + : > all-target-has-failed + exit 1 +check-local: + touch check-target-has-run END $ACLOCAL -$AUTOCONF $AUTOMAKE --cygnus +$EGREP '(^| )all.*(:|:.* )check' Makefile.in && Exit 1 + +$AUTOCONF ./configure -$MAKE -test -f sub/foo -$MAKE distclean -test ! -f sub/foo + +$MAKE check +test -f check-target-has-run +test ! -r all-target-has-failed +# sanity checks +$MAKE && Exit 1 +test -f all-target-has-failed + +: diff --git a/tests/cygnus-dependency-tracking.test b/tests/cygnus-dependency-tracking.test new file mode 100755 index 0000000..4c56299 --- /dev/null +++ b/tests/cygnus-dependency-tracking.test @@ -0,0 +1,73 @@ +#! /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/>. + +# Check that cygnus mode disables automatically dependency tracking. +# And check that this *cannot* be overridden. + +. ./defs || Exit 1 + +set -e + +cat >> configure.in <<'END' +AM_MAINTAINER_MODE +AC_PROG_CC +AC_OUTPUT +END + +cat > Makefile.am <<'END' +bin_PROGRAMS = foo +foo_SOURCES = foo.c +.PHONY: test-nodeps +test-nodeps: + test ! -d .deps + test ! -d _deps + test ! -d '$(DEPDIR)' +END + +cat > foo.c <<'END' +#include "bar.h" +int main () +{ + GIVE_BACK 0; +} +END + +cat > bar.sav <<'END' +#define GIVE_BACK return +END + +cp bar.sav bar.h + +$ACLOCAL +$AUTOMAKE --include-deps --cygnus --include-deps +$AUTOCONF + +# Unknown options should cause just warnings from configure. +./configure --enable-dependency-tracking +$MAKE +$MAKE test-nodeps + +: > bar.h +$MAKE +$MAKE test-nodeps + +# Sanity check. +$MAKE clean +$MAKE >out 2>&1 && { cat out; Exit 1; } +cat out +$FGREP 'GIVE_BACK' out + +: diff --git a/tests/clean2.test b/tests/cygnus-distclean.test similarity index 80% copy from tests/clean2.test copy to tests/cygnus-distclean.test index 99e4c2e..48165ce 100755 --- a/tests/clean2.test +++ b/tests/cygnus-distclean.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2004 Free Software Foundation, Inc. +# Copyright (C) 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 @@ -29,6 +29,13 @@ END cat > Makefile.am << 'END' SUBDIRS = sub + +data_DATA = bar + +bar: + touch $@ + +DISTCLEANFILES = bar END mkdir sub @@ -48,6 +55,16 @@ $AUTOMAKE --cygnus ./configure $MAKE +ls -l +test -f bar test -f sub/foo $MAKE distclean -test ! -f sub/foo +ls -l +test ! -r bar +test ! -r sub/foo +test ! -r Makefile +test ! -r config.status +test -f Makefile.in +test -f configure + +: diff --git a/tests/cygnus-imply-foreign.test b/tests/cygnus-imply-foreign.test new file mode 100755 index 0000000..69c05d3 --- /dev/null +++ b/tests/cygnus-imply-foreign.test @@ -0,0 +1,60 @@ +#! /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/>. + +# Check that 'cygnus' mode imply 'foreign' mode. + +. ./defs || Exit 1 + +set -e + +cat >> configure.in <<'END' +# This is *required* in cygnus mode +AM_MAINTAINER_MODE +END + +$ACLOCAL + +: > Makefile.am + +# We want complete control automake flags. +AUTOMAKE=`(set $AUTOMAKE && echo $1)` || Exit 99 + +# Sanity check: gnu mode must complain about missing files and +# portability problems. +AUTOMAKE_fails +grep 'required file.*README' stderr + +# But cygnus mode should imply foreign mode, so no complaints. +# And cygnus mode should by able to override gnu and gnits modes. +$AUTOMAKE --cygnus -Werror +$AUTOMAKE --gnu --cygnus -Werror +$AUTOMAKE --gnits --cygnus -Werror + +# Try again, this time enabling cygnus mode from Makefile.am. +cp Makefile.am Makefile.sav +echo 'AUTOMAKE_OPTIONS = gnu cygnus' >> Makefile.am +$AUTOMAKE -Werror +mv -f Makefile.sav Makefile.am + +# Try again, this time enabling cygnus mode from configure.in. +cp configure.in configure.sav +sed 's/^AM_INIT_AUTOMAKE$/&([gnits cygnus])/' configure.sav >configure.in +cmp configure.in configure.sav && Exit 99 # sanity check +$ACLOCAL --force +$AUTOMAKE -Werror +mv -f configure.sav configure.in + +: diff --git a/tests/cygnus-no-dist.test b/tests/cygnus-no-dist.test new file mode 100755 index 0000000..cd29d2d --- /dev/null +++ b/tests/cygnus-no-dist.test @@ -0,0 +1,86 @@ +#! /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/>. + +# Check that cygnus mode forbids creation of distribution tarball. + +. ./defs || Exit 1 + +set -e + +echo AM_MAINTAINER_MODE >> configure.in +mv -f configure.in configure.stub + +cat configure.stub - > configure.in <<'END' +AC_OUTPUT +END + +: > Makefile.am + +$ACLOCAL +$AUTOCONF +$AUTOMAKE --cygnus + +./configure +$MAKE + +for target in dist distdir distcheck dist-all dist-gzip; do + $MAKE -n $target >out 2>&1 && { cat out; Exit 1; } + cat out + grep $target out +done + +# Now check that cygnus mode in a subdirectory disables +# distribution-building in that subdirectory. + +cat > Makefile.am <<'END' +SUBDIRS = sub1 sub2 +END + +mkdir sub1 sub2 +: > sub1/Makefile.am +cat > sub2/Makefile.am <<'END' +# The `-Wall' after `cygnus' should ensure no warning gets +# unintentionally disabled. We are particularily interested +# in overridewarnings, for when (below) we add the `distdir' +# target. +AUTOMAKE_OPTIONS = cygnus -Wall +END + +cat configure.stub - > configure.in <<'END' +AC_CONFIG_FILES([sub1/Makefile sub2/Makefile]) +AC_OUTPUT +END + +$AUTOCONF +$AUTOMAKE + +./configure +$MAKE +cd sub2 +$MAKE -n distdir >out 2>&1 && { cat out; Exit 1; } +grep distdir out +cd .. + +cat >> sub2/Makefile.am <<'END' +distdir: +END +$AUTOMAKE sub2/Makefile +./config.status sub2/Makefile + +$MAKE distdir +$MAKE dist + +: diff --git a/tests/clean2.test b/tests/cygnus-no-installinfo.test similarity index 53% copy from tests/clean2.test copy to tests/cygnus-no-installinfo.test index 99e4c2e..315f6ef 100755 --- a/tests/clean2.test +++ b/tests/cygnus-no-installinfo.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2004 Free Software Foundation, Inc. +# 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 @@ -14,40 +14,42 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -# Make sure distclean works in cygnus mode. -# Report from Daniel Jacobowitz +# Check that cygnus mode enables the 'no-installinfo' option. +required=makeinfo . ./defs || Exit 1 set -e -cat >> configure.in << 'END' +cat >> configure.in <<'END' AM_MAINTAINER_MODE -AC_CONFIG_FILES([sub/Makefile]) AC_OUTPUT END -cat > Makefile.am << 'END' -SUBDIRS = sub +cat > Makefile.am <<'END' +info_TEXINFOS = foo.texi END -mkdir sub - -cat > sub/Makefile.am << 'END' -data_DATA = foo - -foo: - touch $@ - -CLEANFILES = $(data_DATA) +cat > foo.texi <<'END' +...@setfilename foo.info END $ACLOCAL +# FIXME: -Wno-override work around a buglet in definition of $(MAKEINFO) +# in cygnus mode; see also xfailing test `txinfo5.test'. +$AUTOMAKE --cygnus -Wno-override $AUTOCONF -$AUTOMAKE --cygnus -./configure +cwd=`pwd` || Exit 1 +./configure --prefix="$cwd"/_inst $MAKE -test -f sub/foo -$MAKE distclean -test ! -f sub/foo +$MAKE install +test ! -d _inst +test ! -r foo.info +test ! -d _inst/share/info +$MAKE install-info +ls -l _inst +test -f foo.info +test -f _inst/share/info/foo.info + +: diff --git a/tests/clean2.test b/tests/cygnus-requires-maintainer-mode.test similarity index 62% rename from tests/clean2.test rename to tests/cygnus-requires-maintainer-mode.test index 99e4c2e..4f893f2 100755 --- a/tests/clean2.test +++ b/tests/cygnus-requires-maintainer-mode.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2004 Free Software Foundation, Inc. +# 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 @@ -14,40 +14,40 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -# Make sure distclean works in cygnus mode. -# Report from Daniel Jacobowitz +# Check that, in cygnus mode, maintainer mode is required. . ./defs || Exit 1 set -e -cat >> configure.in << 'END' -AM_MAINTAINER_MODE +: > Makefile.am + +$ACLOCAL +AUTOMAKE_fails --cygnus +grep '^configure\.in:.*AM_MAINTAINER_MODE.*required.*cygnus' stderr + +cat >> configure.in <<'END' AC_CONFIG_FILES([sub/Makefile]) -AC_OUTPUT END -cat > Makefile.am << 'END' +cat > Makefile.am <<'END' SUBDIRS = sub END mkdir sub +cat > sub/Makefile.am <<'END' +AUTOMAKE_OPTIONS = cygnus +END -cat > sub/Makefile.am << 'END' -data_DATA = foo - -foo: - touch $@ +$ACLOCAL +AUTOMAKE_fails +grep '^configure\.in:.*AM_MAINTAINER_MODE.*required.*cygnus' stderr -CLEANFILES = $(data_DATA) +cat >> configure.in <<'END' +AM_MAINTAINER_MODE END $ACLOCAL -$AUTOCONF $AUTOMAKE --cygnus -./configure -$MAKE -test -f sub/foo -$MAKE distclean -test ! -f sub/foo +: -- 1.7.1