From 0164f83126647476cfb3112441185accdcb157fb Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Sat, 8 Jun 2013 17:36:07 +0200 Subject: [PATCH] tests: expose automake bug#14560 Automake needlessly generates definition of make variables related to C compilation when two or more user-defined suffix rules are present in a single Makefile.am. * t/suffix-extra-c-stuff-pr14560.sh: New test, exposing the bug. This test is still xfailing. * t/no-extra-c-stuff.sh: New test, check for a potential related regression. This regression is not actually present here (so this test passes), but it still took place in our first attempt at fixing bug#14560 -- so this test has proven to be actually useful. * t/no-extra-makefile-code.sh: Improve comments, and tighten the grepping checks a little. * t/list-of-tests.mk (handwritten_TESTS): Add the new tests. (XFAIL_TESTS): Add the new xfailing test. Signed-off-by: Stefano Lattarini --- t/list-of-tests.mk | 3 ++ t/no-extra-c-stuff.sh | 74 +++++++++++++++++++++++++++++++++++++++ t/no-extra-makefile-code.sh | 9 +++-- t/suffix-extra-c-stuff-pr14560.sh | 37 ++++++++++++++++++++ 4 files changed, 121 insertions(+), 2 deletions(-) create mode 100644 t/no-extra-c-stuff.sh create mode 100644 t/suffix-extra-c-stuff-pr14560.sh diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk index 1d7cf87..f2eb648 100644 --- a/t/list-of-tests.mk +++ b/t/list-of-tests.mk @@ -42,6 +42,7 @@ t/remake-timing-bug-pr8365.sh \ t/lex-subobj-nodep.sh \ t/subobj-indir-pr13928.sh \ t/subobj-vpath-pr13928.sh \ +t/suffix-extra-c-stuff-pr14560.sh \ t/remake-am-pr10111.sh \ t/remake-m4-pr10111.sh \ $(perl_fake_XFAIL_TESTS) @@ -695,6 +696,7 @@ t/mkinst2.sh \ t/mkinst3.sh \ t/mmode.sh \ t/mmodely.sh \ +t/no-extra-c-stuff.sh \ t/no-extra-makefile-code.sh \ t/no-spurious-install-recursive.sh \ t/nobase.sh \ @@ -1069,6 +1071,7 @@ t/suffix-chain.tap \ t/suffix-custom-pr14441.sh \ t/suffix-custom-subobj.sh \ t/suffix-custom-subobj-and-specflg.sh \ +t/suffix-extra-c-stuff-pr14560.sh \ t/symlink.sh \ t/symlink2.sh \ t/syntax.sh \ diff --git a/t/no-extra-c-stuff.sh b/t/no-extra-c-stuff.sh new file mode 100644 index 0000000..de0dd12 --- /dev/null +++ b/t/no-extra-c-stuff.sh @@ -0,0 +1,74 @@ +#! /bin/sh +# Copyright (C) 2013 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 . + +# Check that Automake doesn't generated rules or definitions related +# to compilation of C sources for a project that doesn't use nor need +# a C Compiler. Inspired by the issues reported in automake bug#14560. + +am_create_testdir=empty +. test-init.sh + +cat > configure.ac < Makefile.am < sub/Makefile.am < sub2/Makefile.am <> configure.ac : > Makefile.am +# Automake shouldn't need nor require these. rm -f depcomp compile $ACLOCAL + +# Don't use '--add-missing' here, so that we can implicitly +# check that the auxiliary scripts 'compile' and 'depcomp' +# are not spuriously required by Automake. $AUTOMAKE -$EGREP 'DEFAULT_INCLUDES|@am__isrc@|-compile|\$\(OBJEXT\)|tab\.[ch]' \ +$EGREP 'INCLUDES|@am__isrc@|-compile|\$\(OBJEXT\)|tab\.[ch]' \ Makefile.in && exit 1 : diff --git a/t/suffix-extra-c-stuff-pr14560.sh b/t/suffix-extra-c-stuff-pr14560.sh new file mode 100644 index 0000000..45fdd17 --- /dev/null +++ b/t/suffix-extra-c-stuff-pr14560.sh @@ -0,0 +1,37 @@ +#! /bin/sh +# Copyright (C) 2013 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 . + +# Automake bug#14560: if multiple user-specified suffix rules were +# present, Automake could generate useless definitions and rules +# related to C compilation. + +. test-init.sh + +cat > Makefile.am <<'END' +.foo.bar: + foo2bar -o $@ $< +.baz.qux: + baz2qux -o $@ $< +bin_SCRIPTS = a.bar b.qux +END + +$ACLOCAL +$AUTOCONF +$AUTOMAKE + +$EGREP '\$\(CC\)|COMPILE|AM_V_CC|-compile|INCLUDES' Makefile.in && exit 1 + +: -- 2.7.4