From: Stefano Lattarini Date: Thu, 25 Nov 2010 21:06:14 +0000 (+0100) Subject: Fix spurious silent*.test failures for $CC != gcc X-Git-Tag: v1.12.0b~429 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=22ee3bdfb7d140f61e276eae28fbabe321f6c32a;p=platform%2Fupstream%2Fautomake.git Fix spurious silent*.test failures for $CC != gcc In some tests on automake-produced silent rules, we forced the use of gcc depmode to improve testsuite coverage; but this has unsurprisingly led to spurious failures when some non-GNU C compilers were used. So we are now careful to require GCC in tests that force gcc depmode. From reports by Ralf Wildenhues. * silent5.test: Test removed, its content split into ... * silent-many-generic.test, silent-many-gcc.test: ... these new sister tests, the latter of which forces gcc depmode and lists "gcc" in $required. * silentlex.test: Test removed, its content split into ... * silent-lex-generic.test, silent-lex-gcc.test: ... these new sister tests, the latter of which forces gcc depmode and lists "gcc" in $required. * silentyacc.test: Test removed, its content split into ... * silent-yacc-generic.test, silent-yacc-gcc.test: ... these new sister tests, the latter of which forces gcc depmode and lists "gcc" in $required. * tests/Makefile.am (TESTS): Updated. --- diff --git a/ChangeLog b/ChangeLog index 2cbce3b..7024f4b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,26 @@ +2010-11-25 Stefano Lattarini + + Fix spurious failures in `silent*.test' for $CC != gcc + In some tests on automake-produced silent rules, we forced the + use of gcc depmode to improve testsuite coverage; but this has + unsurprisingly led to spurious failures when some non-GNU C + compilers were used. So we are now careful to require GCC in + tests that force gcc depmode. + From reports by Ralf Wildenhues. + * silent5.test: Test removed, its content split into ... + * silent-many-generic.test, silent-many-gcc.test: ... these new + sister tests, the latter of which forces gcc depmode and lists + "gcc" in $required. + * silentlex.test: Test removed, its content split into ... + * silent-lex-generic.test, silent-lex-gcc.test: ... these new + sister tests, the latter of which forces gcc depmode and lists + "gcc" in $required. + * silentyacc.test: Test removed, its content split into ... + * silent-yacc-generic.test, silent-yacc-gcc.test: ... these new + sister tests, the latter of which forces gcc depmode and lists + "gcc" in $required. + * tests/Makefile.am (TESTS): Updated. + 2010-11-21 Stefano Lattarini Tests: consistently use "|| Exit 1" after ". ./defs". diff --git a/tests/Makefile.am b/tests/Makefile.am index 5f1ab9e..dab04e3 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -632,15 +632,18 @@ silent.test \ silent2.test \ silent3.test \ silent4.test \ -silent5.test \ silent6.test \ silent7.test \ silent9.test \ silentcxx.test \ silentf77.test \ silentf90.test \ -silentlex.test \ -silentyacc.test \ +silent-many-gcc.test \ +silent-many-generic.test \ +silent-lex-gcc.test \ +silent-lex-generic.test \ +silent-yacc-gcc.test \ +silent-yacc-generic.test \ sinclude.test \ srcsub.test \ srcsub2.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 140b178..de21f43 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -899,15 +899,18 @@ silent.test \ silent2.test \ silent3.test \ silent4.test \ -silent5.test \ silent6.test \ silent7.test \ silent9.test \ silentcxx.test \ silentf77.test \ silentf90.test \ -silentlex.test \ -silentyacc.test \ +silent-many-gcc.test \ +silent-many-generic.test \ +silent-lex-gcc.test \ +silent-lex-generic.test \ +silent-yacc-gcc.test \ +silent-yacc-generic.test \ sinclude.test \ srcsub.test \ srcsub2.test \ diff --git a/tests/silent-lex-gcc.test b/tests/silent-lex-gcc.test new file mode 100755 index 0000000..426dc50 --- /dev/null +++ b/tests/silent-lex-gcc.test @@ -0,0 +1,143 @@ +#!/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 . + +# Check silent-rules mode for Lex, forcing gcc depmode. +# Keep this in sync with sister test `silent-lex-generic.test'. + +required='flex gcc' +. ./defs || Exit 1 + +set -e + +mkdir sub + +cat >>configure.in <<'EOF' +AM_SILENT_RULES +AM_PROG_CC_C_O +AC_PROG_LEX +AC_CONFIG_FILES([sub/Makefile]) +AC_OUTPUT +EOF + +cat > Makefile.am <<'EOF' +# Need generic and non-generic rules. +bin_PROGRAMS = foo1 foo2 +foo1_SOURCES = foo.l +foo2_SOURCES = $(foo1_SOURCES) +foo2_CFLAGS = $(AM_CFLAGS) +SUBDIRS = sub +LDADD = $(LEXLIB) +EOF + +cat > sub/Makefile.am <<'EOF' +AUTOMAKE_OPTIONS = subdir-objects +# Need generic and non-generic rules. +bin_PROGRAMS = bar1 bar2 +bar1_SOURCES = bar.l +bar2_SOURCES = $(bar1_SOURCES) +bar2_CFLAGS = $(AM_CFLAGS) +LDADD = $(LEXLIB) +EOF + +cat > foo.l <<'EOF' +%% +"END" return EOF; +. +%% +EOF +cp foo.l sub/bar.l + +$ACLOCAL +$AUTOMAKE --add-missing +$AUTOCONF + +# Force gcc ("fast") depmode. +# This apparently useless "for" loop is here to simplify the syncing +# with sister test `silent-lex-gcc.test'. +for config_args in \ + am_cv_CC_dependencies_compiler_type=gcc +do + ./configure $config_args --enable-silent-rules + + $MAKE >stdout || { cat stdout; Exit 1; } + cat stdout + + $EGREP ' (-c|-o)' stdout && Exit 1 + $EGREP '(mv|ylwrap) ' stdout && Exit 1 + + grep 'LEX .*foo\.' stdout + grep 'LEX .*bar\.' stdout + grep ' CC .*foo\.' stdout + grep ' CC .*bar\.' stdout + grep 'CCLD .*foo1' stdout + grep 'CCLD .*bar1' stdout + grep 'CCLD .*foo2' stdout + grep 'CCLD .*bar2' stdout + + # Cleaning and then rebuilding with the same V flag (and without + # removing the generated sources in between) shouldn't trigger a + # different set of rules. + $MAKE clean + + $MAKE >stdout || { cat stdout; Exit 1; } + cat stdout + + $EGREP ' (-c|-o)' stdout && Exit 1 + $EGREP '(mv|ylwrap) ' stdout && Exit 1 + + # Don't look for LEX, as probably lex hasn't been re-run. + grep ' CC .*foo\.' stdout + grep ' CC .*bar\.' stdout + grep 'CCLD .*foo1' stdout + grep 'CCLD .*bar1' stdout + grep 'CCLD .*foo2' stdout + grep 'CCLD .*bar2' stdout + + # Ensure a truly clean rebuild. + $MAKE clean + rm -f foo.c sub/bar.c + + $MAKE V=1 >stdout || { cat stdout; Exit 1; } + cat stdout + + grep ' -c ' stdout + grep ' -o ' stdout + grep 'ylwrap ' stdout + + $EGREP '(LEX|CC|CCLD) ' stdout && Exit 1 + + # Cleaning and then rebuilding with the same V flag (and without + # removing the generated sources in between) shouldn't trigger a + # different set of rules. + $MAKE clean + + $MAKE V=1 >stdout || { cat stdout; Exit 1; } + cat stdout + + # Don't look for ylwrap, as probably lex hasn't been re-run. + grep ' -c ' stdout + grep ' -o ' stdout + + $EGREP '(LEX|CC|CCLD) ' stdout && Exit 1 + + # Ensure a truly clean reconfiguration/rebuild. + $MAKE clean + $MAKE maintainer-clean + rm -f foo.c sub/bar.c + +done + +: diff --git a/tests/silentlex.test b/tests/silent-lex-generic.test similarity index 92% rename from tests/silentlex.test rename to tests/silent-lex-generic.test index 5ad430e..66535e8 100755 --- a/tests/silentlex.test +++ b/tests/silent-lex-generic.test @@ -15,6 +15,7 @@ # along with this program. If not, see . # Check silent-rules mode for Lex. +# Keep this in sync with sister test `silent-lex-gcc.test'. required='flex' . ./defs || Exit 1 @@ -63,11 +64,11 @@ $ACLOCAL $AUTOMAKE --add-missing $AUTOCONF -# configure once for fastdep, once for non-fastdep, once for nodep +# Force dependency tracking explicitly, so that slow dependency +# extractors are not rejected. Try also with dependency tracking +# explicitly disabled. for config_args in \ - '' \ - am_cv_CC_dependencies_compiler_type=gcc \ - --disable-dependency-tracking + --enable-dependency-tracking --disable-dependency-tracking do ./configure $config_args --enable-silent-rules diff --git a/tests/silent-many-gcc.test b/tests/silent-many-gcc.test new file mode 100755 index 0000000..d770a46 --- /dev/null +++ b/tests/silent-many-gcc.test @@ -0,0 +1,220 @@ +#!/bin/sh +# Copyright (C) 2009, 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 . + +# Check silent-rules mode, with gcc depmode and many languages at once. +# This test partly overlaps with other silent*.test, but it serves as +# a stress test by using many different languages at once -- so don't +# remove this test script. +# This test requires the GNU compilers; keep it in sync with sister test +# `silent-many-generic.test', which should work with generic compilers. + +required='gcc g++ gfortran flex bison' +. ./defs || Exit 1 + +set -e + +# Avoids too much code duplication. +do_and_check_silent_build () +{ + case $1 in + --rebuild) rebuild=true;; + *) rebuild=false;; + esac + + $MAKE >stdout || { cat stdout; Exit 1; } + cat stdout + # Avoid spurious failures with SunStudio Fortran compilers. + sed '/^NOTICE:/d' stdout > t + mv -f t stdout + cat stdout + + $EGREP ' (-c|-o)' stdout && Exit 1 + $EGREP '(mv|ylwrap) ' stdout && Exit 1 + + grep 'CXX .*foo1\.' stdout + grep 'CXX .*baz1\.' stdout + grep 'FC .*foo2\.' stdout + grep 'FC .*baz2\.' stdout + grep 'F77 .*foo3\.' stdout + grep 'F77 .*baz3\.' stdout + grep ' CC .*foo5\.' stdout + grep ' CC .*baz5\.' stdout + grep ' CC .*foo6\.' stdout + grep ' CC .*baz6\.' stdout + + grep 'CXXLD .*foo' stdout + grep 'CCLD .*bar' stdout + grep 'CXXLD .*baz' stdout + grep 'CCLD .*bla' stdout + + if $rebuild; then :; else + grep 'YACC .*foo6\.' stdout + grep 'YACC .*baz6\.' stdout + grep 'LEX .*foo5\.' stdout + grep 'LEX .*baz5\.' stdout + fi + + unset rebuild +} + +# Avoids too much code duplication. +do_and_check_verbose_build () +{ + + case $1 in + --rebuild) rebuild=true;; + *) rebuild=false;; + esac + + $MAKE V=1 >stdout || { cat stdout; Exit 1; } + cat stdout + + grep ' -c ' stdout + grep ' -o ' stdout + + $EGREP '(CC|CXX|FC|F77|LD) ' stdout && Exit 1 + + if $rebuild; then :; else + grep 'ylwrap ' stdout + $EGREP '(LEX|YACC) ' stdout && Exit 1 + fi + + unset rebuild +} + +mkdir sub + +cat >>configure.in <<'EOF' +AM_SILENT_RULES +AM_PROG_CC_C_O +AC_PROG_CXX +AC_PROG_F77 +AC_PROG_FC +AC_PROG_LEX +AC_PROG_YACC +AC_CONFIG_FILES([sub/Makefile]) +AC_OUTPUT +EOF + +cat > Makefile.am <<'EOF' +# Need generic and non-generic rules. +bin_PROGRAMS = foo bar fo2 +bar_CFLAGS = $(AM_CFLAGS) +foo_SOURCES = foo1.cpp foo2.f90 foo3.f foo5.l foo6.y +fo2_SOURCES = $(foo_SOURCES) +fo2_CPPFLAGS = $(AM_CPPFLAGS) +fo2_FFLAGS = $(AM_FFLAGS) +fo2_FCFLAGS = $(AM_FCFLAGS) +SUBDIRS = sub +AM_YFLAGS = -d +LDADD = $(LEXLIB) +BUILT_SOURCES = foo6.h +EOF + +cat > sub/Makefile.am <<'EOF' +AUTOMAKE_OPTIONS = subdir-objects +# Need generic and non-generic rules. +bin_PROGRAMS = baz bla ba2 +bla_CFLAGS = $(AM_CFLAGS) +baz_SOURCES = baz1.cpp baz2.f90 baz3.f baz5.l baz6.y +ba2_SOURCES = $(baz_SOURCES) +ba2_CPPFLAGS = $(AM_CPPFLAGS) +ba2_FFLAGS = $(AM_FFLAGS) +ba2_FCFLAGS = $(AM_FCFLAGS) +AM_YFLAGS = -d +LDADD = $(LEXLIB) +BUILT_SOURCES = baz6.h +EOF + +cat > foo1.cpp <<'EOF' +int main () +{ + return 0; +} +EOF +cat > foo2.f90 <<'EOF' + subroutine foo2 + return + end +EOF +cat > foo3.f <<'EOF' + subroutine foo3 + return + end +EOF +cat > foo5.l <<'EOF' +%% +"END" return EOF; +. +%% +EOF +cat > foo6.y <<'EOF' +%{ +void yyerror (char *s) {} +%} +%token EOF +%% +fubar : 'f' 'o' 'o' 'b' 'a' 'r' EOF {}; +EOF +cp foo1.cpp bar.c +cp foo1.cpp sub/baz.c +cp foo1.cpp sub/bla.c +cp foo1.cpp sub/baz1.cpp +cp foo2.f90 sub/baz2.f90 +cp foo3.f sub/baz3.f +cp foo5.l sub/baz5.l +cp foo6.y sub/baz6.y + +$ACLOCAL +$AUTOMAKE --add-missing +$AUTOCONF + +# Force gcc ("fast") depmode. +# This apparently useless "for" loop is here to simplify the syncing +# with sister test `silent-many-gcc.test'. +for config_args in \ + am_cv_CC_dependencies_compiler_type=gcc +do + + ./configure $config_args --enable-silent-rules + + do_and_check_silent_build + # Cleaning and then rebuilding with the same V flag (and without + # removing the generated sources in between) shouldn't trigger a + # different set of rules. + $MAKE clean + do_and_check_silent_build --rebuild + + # Ensure a clean rebuild. + $MAKE clean + # This is required, since these files are not removed by `make clean' + # (as dictated by the GNU Coding Standards). + rm -f foo5.c foo6.[ch] sub/baz5.c sub/baz6.[ch] + + do_and_check_verbose_build + # Cleaning and then rebuilding with the same V flag (and without + # removing the generated sources in between) shouldn't trigger a + # different set of rules. + $MAKE clean + do_and_check_verbose_build --rebuild + + # Ensure a clean reconfiguration/rebuild. + $MAKE clean + $MAKE maintainer-clean + +done + +: diff --git a/tests/silent5.test b/tests/silent-many-generic.test similarity index 91% rename from tests/silent5.test rename to tests/silent-many-generic.test index 49039b8..223a97c 100755 --- a/tests/silent5.test +++ b/tests/silent-many-generic.test @@ -14,10 +14,13 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Check silent-rules mode, languages other than C. +# Check silent-rules mode, with many languages at once. # This test partly overlaps with other silent*.test, but it serves as # a stress test by using many different languages at once -- so don't # remove this test script. +# This test should work with generic compilers; keep it in sync with +# sister test `silent-many-gcc.test', which requires the GNU compilers +# and forces the use of gcc depmode. # FIXME: generic C++/Fortran compilers should suffice here required='g++ gfortran flex bison' @@ -181,11 +184,11 @@ $ACLOCAL $AUTOMAKE --add-missing $AUTOCONF -# configure once for fastdep, once for non-fastdep, once for nodep +# Force dependency tracking explicitly, so that slow dependency +# extractors are not rejected. Try also with dependency tracking +# explicitly disabled. for config_args in \ - '' \ - am_cv_CC_dependencies_compiler_type=gcc \ - --disable-dependency-tracking + --enable-dependency-tracking --disable-dependency-tracking do ./configure $config_args --enable-silent-rules diff --git a/tests/silent-yacc-gcc.test b/tests/silent-yacc-gcc.test new file mode 100755 index 0000000..33ae8ae --- /dev/null +++ b/tests/silent-yacc-gcc.test @@ -0,0 +1,145 @@ +#!/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 . + +# Check silent-rules mode for Yacc, forcing gcc depmode. +# Keep this in sync with sister test `silent-yacc-generic.test'. + +required='gcc bison' +. ./defs || Exit 1 + +set -e + +mkdir sub + +cat >>configure.in <<'EOF' +AM_SILENT_RULES +AM_PROG_CC_C_O +AC_PROG_YACC +AC_CONFIG_FILES([sub/Makefile]) +AC_OUTPUT +EOF + +cat > Makefile.am <<'EOF' +# Need generic and non-generic rules. +bin_PROGRAMS = foo1 foo2 +foo1_SOURCES = foo.y +foo2_SOURCES = $(foo1_SOURCES) +foo2_CFLAGS = $(AM_CPPFLAGS) +SUBDIRS = sub +EOF + +cat > sub/Makefile.am <<'EOF' +AUTOMAKE_OPTIONS = subdir-objects +# Need generic and non-generic rules. +bin_PROGRAMS = bar1 bar2 +bar1_SOURCES = bar.y +bar2_SOURCES = $(bar1_SOURCES) +bar2_CFLAGS = $(AM_CPPFLAGS) +EOF + +cat > foo.y <<'EOF' +%{ +void yyerror (char *s) {} +int yylex (void) {return 0;} +int main(void) {return 0;} +%} +%token EOF +%% +fubar : 'f' 'o' 'o' 'b' 'a' 'r' EOF {}; +EOF +cp foo.y sub/bar.y + +$ACLOCAL +$AUTOMAKE --add-missing +$AUTOCONF + +# Force gcc ("fast") depmode. +# This apparently useless "for" loop is here to simplify the syncing +# with sister test `silent-yacc-gcc.test'. +for config_args in \ + am_cv_CC_dependencies_compiler_type=gcc +do + ./configure $config_args --enable-silent-rules + + $MAKE >stdout || { cat stdout; Exit 1; } + cat stdout + + $EGREP ' (-c|-o)' stdout && Exit 1 + $EGREP '(mv|ylwrap) ' stdout && Exit 1 + + grep 'YACC .*foo\.' stdout + grep 'YACC .*bar\.' stdout + grep ' CC .*foo\.' stdout + grep ' CC .*bar\.' stdout + grep 'CCLD .*foo1' stdout + grep 'CCLD .*bar1' stdout + grep 'CCLD .*foo2' stdout + grep 'CCLD .*bar2' stdout + + # Cleaning and then rebuilding with the same V flag (and without + # removing the generated sources in between) shouldn't trigger a + # different set of rules. + $MAKE clean + + $MAKE >stdout || { cat stdout; Exit 1; } + cat stdout + + $EGREP ' (-c|-o)' stdout && Exit 1 + $EGREP '(mv|ylwrap) ' stdout && Exit 1 + + # Don't look for YACC, as probably yacc hasn't been re-run. + grep ' CC .*foo\.' stdout + grep ' CC .*bar\.' stdout + grep 'CCLD .*foo1' stdout + grep 'CCLD .*bar1' stdout + grep 'CCLD .*foo2' stdout + grep 'CCLD .*bar2' stdout + + # Ensure a truly clean rebuild. + $MAKE clean + rm -f foo.[ch] sub/bar.[ch] + + $MAKE V=1 >stdout || { cat stdout; Exit 1; } + cat stdout + + grep ' -c ' stdout + grep ' -o ' stdout + grep 'ylwrap ' stdout + + $EGREP '(YACC|CC|CCLD) ' stdout && Exit 1 + + # Cleaning and then rebuilding with the same V flag (and without + # removing the generated sources in between) shouldn't trigger a + # different set of rules. + $MAKE clean + + $MAKE V=1 >stdout || { cat stdout; Exit 1; } + cat stdout + + # Don't look for ylwrap, as probably lex hasn't been re-run. + grep ' -c ' stdout + grep ' -o ' stdout + + $EGREP '(YACC|CC|CCLD) ' stdout && Exit 1 + + # Ensure a truly clean reconfiguration/rebuild. + $MAKE clean + $MAKE maintainer-clean + rm -f foo.[ch] sub/bar.[ch] + +done + +: diff --git a/tests/silentyacc.test b/tests/silent-yacc-generic.test similarity index 92% rename from tests/silentyacc.test rename to tests/silent-yacc-generic.test index d311e3d..b7489da 100755 --- a/tests/silentyacc.test +++ b/tests/silent-yacc-generic.test @@ -15,6 +15,7 @@ # along with this program. If not, see . # Check silent-rules mode for Yacc. +# Keep this in sync with sister test `silent-yacc-gcc.test'. required='bison' . ./defs || Exit 1 @@ -65,11 +66,11 @@ $ACLOCAL $AUTOMAKE --add-missing $AUTOCONF -# configure once for fastdep, once for non-fastdep, once for nodep +# Force dependency tracking explicitly, so that slow dependency +# extractors are not rejected. Try also with dependency tracking +# explicitly disabled. for config_args in \ - '' \ - am_cv_CC_dependencies_compiler_type=gcc \ - --disable-dependency-tracking + --enable-dependency-tracking --disable-dependency-tracking do ./configure $config_args --enable-silent-rules