* tests/silent5.test: Remove by hand all generated C files after non-verbose builds, to ensure the following builds are clean. Try to clean and rebuild with the same verbosity and without removing generated sources in between, to check that this does not trigger a different set of rules. Make grepping of make's output stricter. Improved/added some comments.
From 7ae17054e4cb14af9481b1417b6190633013a817 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini <stefano.lattar...@gmail.com> Date: Sun, 25 Apr 2010 22:20:57 +0200 Subject: [PATCH 6/9] Improved test silent5.test.
* tests/silent5.test: Remove by hand all generated C files after non-verbose builds, to ensure the following builds are clean. Try to clean and rebuild with the same verbosity and without removing generated sources in between, to check that this does not trigger a different set of rules. Make grepping of make's output stricter. Improved/added some comments. --- ChangeLog | 8 +++ tests/silent5.test | 140 ++++++++++++++++++++++++++++++++++------------------ 2 files changed, 99 insertions(+), 49 deletions(-) diff --git a/ChangeLog b/ChangeLog index 602485e..047218d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2010-04-25 Stefano Lattarini <stefano.lattar...@gmail.com> + Improved test silent5.test. + * tests/silent5.test: Remove by hand all generated C files after + non-verbose builds, to ensure the following builds are clean. + Try to clean and rebuild with the same verbosity and without + removing generated sources in between, to check that this does + not trigger a different set of rules. Make grepping of make's + output stricter. Improved/added some comments. + New tests for Automake silent-mode with Fortran. * tests/silentf77.test: New test. * tests/silentf90.test: Likewise. diff --git a/tests/silent5.test b/tests/silent5.test index dfddb58..28a4fb7 100755 --- a/tests/silent5.test +++ b/tests/silent5.test @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright (C) 2009, 2010 Free Software Foundation, Inc. +# 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 @@ -15,12 +15,79 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # Check silent-rules mode, languages other than C. +# 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. +# FIXME: generic C++/Fortran compilers should suffice here required='g++ gfortran flex bison' . ./defs 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 + + $EGREP ' (-c|-o)' stdout && Exit 1 + grep 'mv ' 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 + + grep '(CC|CXX|FC|F77|LD) ' stdout && Exit 1 + + if $rebuild; then :; else + grep '(LEX|YACC) ' stdout && Exit 1 + fi + + unset rebuild +} + mkdir sub cat >>configure.in <<'EOF' @@ -109,63 +176,38 @@ $AUTOMAKE --add-missing $AUTOCONF # configure once for fastdep, once for non-fastdep, once for nodep -for config_args in '' am_cv_CC_dependencies_compiler_type=gcc \ +for config_args in \ + '' \ + am_cv_CC_dependencies_compiler_type=gcc \ --disable-dependency-tracking do - ./configure $config_args --enable-silent-rules - $MAKE >stdout || { cat stdout; Exit 1; } - cat stdout - grep ' -c' stdout && Exit 1 - grep ' -o ' stdout && Exit 1 - grep 'mv ' 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 'LEX .*foo5\.' stdout - grep 'LEX .*baz5\.' stdout - grep ' CC .*foo5\.' stdout - grep ' CC .*baz5\.' stdout - grep 'YACC .*foo6\.' stdout - grep 'YACC .*baz6\.' stdout - grep ' CC .*foo6\.' stdout - grep ' CC .*baz6\.' stdout + ./configure $config_args --enable-silent-rules - grep 'CXXLD .*foo' stdout - grep 'CCLD .*bar' stdout - grep 'CXXLD .*baz' stdout - grep 'CCLD .*bla' stdout + 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 - $MAKE V=1 >stdout || { cat stdout; Exit 1; } - cat stdout - grep ' -c' stdout - grep ' -o ' stdout + # 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 - grep 'CXX .*foo1\.' stdout && Exit 1 - grep 'CXX .*baz1\.' stdout && Exit 1 - grep 'FC .*foo2\.' stdout && Exit 1 - grep 'FC .*baz2\.' stdout && Exit 1 - grep 'F77 .*foo3\.' stdout && Exit 1 - grep 'F77 .*baz3\.' stdout && Exit 1 - grep 'LEX .*foo5\.' stdout && Exit 1 - grep 'LEX .*baz5\.' stdout && Exit 1 - grep ' CC .*foo5\.' stdout && Exit 1 - grep ' CC .*baz5\.' stdout && Exit 1 - grep 'YACC .*foo6\.' stdout && Exit 1 - grep 'YACC .*baz6\.' stdout && Exit 1 - grep ' CC .*foo6\.' stdout && Exit 1 - grep ' CC .*baz6\.' stdout && Exit 1 - - grep 'CXXLD .*foo' stdout && Exit 1 - grep 'CCLD .*bar' stdout && Exit 1 - grep 'CXXLD .*baz' stdout && Exit 1 - grep 'CCLD .*bla' stdout && Exit 1 + # Ensure a clean reconfiguration/rebuild. $MAKE clean $MAKE maintainer-clean + done : -- 1.6.5