]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
Improved test silent5.test.
authorStefano Lattarini <stefano.lattarini@gmail.com>
Tue, 27 Apr 2010 00:12:50 +0000 (02:12 +0200)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sun, 6 Jun 2010 10:11:16 +0000 (12:11 +0200)
* 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.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
ChangeLog
tests/silent5.test

index 1fb4ba8c5d69c0eb06fe631cfcbe5b7b14357d5b..ad4f6170374a127c8eac43091a4ba475801f26ce 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2010-06-06  Stefano Lattarini  <stefano.lattarini@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.
index dfddb58a1737a94c16db556d8232935b1adc6a6b..e1134e864d24dee43488603c1489fa435019ee56 100755 (executable)
@@ -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
 # 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
+  $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
+
+  grep '(CC|CXX|FC|F77|LD) ' stdout && Exit 1
+
+  if $rebuild; then :; else
+    grep 'ylwrap ' stdout
+    grep '(LEX|YACC) ' stdout && Exit 1
+  fi
+
+  unset rebuild
+}
+
 mkdir sub
 
 cat >>configure.in <<'EOF'
@@ -109,63 +178,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
 
 :