tests: tweak tests on silent-rules for makes without nested vars
authorStefano Lattarini <stefano.lattarini@gmail.com>
Mon, 26 Dec 2011 17:23:24 +0000 (18:23 +0100)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Mon, 26 Dec 2011 21:23:57 +0000 (22:23 +0100)
* tests/silent-nested-vars.test: Define $MAKE to `./mymake' in
the environment, so that it will be automatically picked up by
configure.  Related tweaks and simplifications.
Remove the checks verifying that silent rules are respected also
when the 'subdir-objects' option is set, the checks testing the
old syntax for user-defined silent rules, and the tests using
the default $MAKE programs: they are redundant w.r.t. other test
cases.  Related simplifications.
Remove the temporary files used in a sanity check as soon as they
are not needed anymore.
Do not capture also the standard error of configure: we only want
to grep its standard output.
Consistently use `stdout' for the name of files where to save the
standard output captured from make and configure, for consistency
with other tests.
Make grepping of configure output and of the generated Makefile
stricter.
Improve and tweak the `mymake' script a little.
* tests/silent6.test: Make grepping of make stdout slightly
stricter.  After having configured with silent rules disabled,
try to force the use silent rules with `make V=1'.

ChangeLog
tests/silent-nested-vars.test
tests/silent6.test

index 7d6a44a..03ba90d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,28 @@
+2011-12-26  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: tweak tests on silent-rules for makes without nested vars
+       * tests/silent-nested-vars.test: Define $MAKE to `./mymake' in
+       the environment, so that it will be automatically picked up by
+       configure.  Related tweaks and simplifications.
+       Remove the checks verifying that silent rules are respected also
+       when the 'subdir-objects' option is set, the checks testing the
+       old syntax for user-defined silent rules, and the tests using
+       the default $MAKE programs: they are redundant w.r.t. other test
+       cases.  Related simplifications.
+       Remove the temporary files used in a sanity check as soon as they
+       are not needed anymore.
+       Do not capture also the standard error of configure: we only want
+       to grep its standard output.
+       Consistently use `stdout' for the name of files where to save the
+       standard output captured from make and configure, for consistency
+       with other tests.
+       Make grepping of configure output and of the generated Makefile
+       stricter.
+       Improve and tweak the `mymake' script a little.
+       * tests/silent6.test: Make grepping of make stdout slightly
+       stricter.  Also try to force the use silent rules with `V=1'
+       after having configured with silent rules disabled.
+
 2011-12-25  Paul Eggert  <eggert@cs.ucla.edu>
 
        silent-rules: fallback for makes without nested vars
index 4b0fa3c..0024b5d 100755 (executable)
 
 set -e
 
-mkdir sub
-
 cat >>configure.in <<'EOF'
 AM_SILENT_RULES
-AM_CONDITIONAL([HAVE_NESTED_VARIABLES],
-  [expr "x$AM_V" : '.*\$' >/dev/null])
-AC_CONFIG_FILES([sub/Makefile])
 AC_PROG_CC
 AM_PROG_CC_C_O
 AC_OUTPUT
@@ -37,7 +32,6 @@ cat > Makefile.am <<'EOF'
 # Need generic and non-generic rules.
 bin_PROGRAMS = foo bar
 bar_CFLAGS = $(AM_CFLAGS)
-SUBDIRS = sub
 
 # Check that AM_V and AM_DEFAULT_V work as advertised.
 pkg_verbose = $(pkg_verbose_@AM_V@)
@@ -50,24 +44,6 @@ oop:
 
 mostlyclean-local:
        rm -f oop
-
-if HAVE_NESTED_VARIABLES
-# Check that the older form (documented in Automake 1.11) works.
-older_pkg_verbose = $(older_pkg_verbose_$(V))
-older_pkg_verbose_ = $(older_pkg_verbose_$(AM_DEFAULT_VERBOSITY))
-older_pkg_verbose_0 = @echo OLDER-PKG-GEN $@;
-
-bin_SCRIPTS += older-oop
-older-oop:
-       $(older_pkg_verbose)echo $@ >$@
-endif
-EOF
-
-cat > sub/Makefile.am <<'EOF'
-AUTOMAKE_OPTIONS = subdir-objects
-# Need generic and non-generic rules.
-bin_PROGRAMS = baz bla
-bla_CFLAGS = $(AM_CFLAGS)
 EOF
 
 cat > foo.c <<'EOF'
@@ -77,14 +53,10 @@ int main ()
 }
 EOF
 cp foo.c bar.c
-cp foo.c sub/baz.c
-cp foo.c sub/bla.c
 
 cat >mymake <<'EOF'
 #! /bin/sh
 makerules=
-LC_ALL=C
-export LC_ALL
 
 case $1 in
   -f)
@@ -98,8 +70,8 @@ case $1 in
     done ;;
 esac
 
+nested_var_pat='^[^#].*\$([^)]*\$'
 if
-  nested_var_pat='^[^#]*\$([a-zA-Z0-9_]*\$'
   case $makefile in
     -) printf '%s\n' "$makerules" | grep "$nested_var_pat";;
     *) grep "$nested_var_pat" $makefile;;
@@ -116,7 +88,8 @@ esac
 EOF
 chmod a+x mymake
 mymake_MAKE=${MAKE-make}
-export mymake_MAKE
+MAKE=./mymake
+export MAKE mymake_MAKE
 
 # As a sanity check, verify that `mymake' rejects Makefiles that
 # use nested variables.
@@ -125,69 +98,52 @@ a = $(b$(c))
 all:
        touch bar
 END
-./mymake && Exit 99
+$MAKE && Exit 99
 mv -f Makefile foo.mk
-./mymake -f foo.mk && Exit 99
-cat foo.mk | ./mymake -f - && Exit 99
+$MAKE -f foo.mk && Exit 99
+cat foo.mk | $MAKE -f - && Exit 99
 test -f bar && Exit 99
 sed '/a =/d' foo.mk > Makefile
-./mymake && test -f bar || Exit 99
+$MAKE && test -f bar || Exit 99
+rm -f bar Makefile foo.mk
 
 $ACLOCAL
 $AUTOMAKE --add-missing
 $AUTOCONF
 
-for make in ${MAKE-make} ./mymake; do
-  ./configure --enable-silent-rules MAKE=$make >enable.out 2>&1 ||
-    { cat enable.out; Exit 1; }
-  cat enable.out
-  case $make in
-    ./mymake)
-      grep 'AM_V_CC = .*0' Makefile
-      grep 'checking whether ./mymake supports nested variables... no' \
-        enable.out
-      ;;
-  esac
-
-  $make >stdout || { cat stdout; Exit 1; }
-  cat stdout
-  $EGREP ' (-c|-o)' stdout && Exit 1
-  grep 'mv ' stdout && Exit 1
-  grep 'CC    .*foo\.' stdout
-  grep 'CC .*bar\.' stdout
-  grep 'CC .*baz\.' stdout
-  grep 'CC .*bla\.' stdout
-  grep 'CCLD .*foo' stdout
-  grep 'CCLD .*bar' stdout
-  grep 'CCLD .*baz' stdout
-  grep 'CCLD .*bla' stdout
-  grep 'PKG-GEN .*oop' stdout
-  if test $am_cv_make_support_nested_variables = yes; then
-    grep 'OLDER-PKG-GEN .*older-oop' stdout
-  fi
-  $make clean
-
-  ./configure --disable-silent-rules MAKE=$make >disable.out 2>&1 ||
-    { cat disable.out; Exit 1; }
-  cat disable.out
-  case $make in
-    ./mymake)
-      grep 'AM_V_CC = .*1' Makefile
-      grep 'checking whether ./mymake supports nested variables... no' \
-        disable.out
-      ;;
-  esac
-
-  $make >stdout || { cat stdout; Exit 1; }
-  cat stdout
-  grep ' -c' stdout
-  grep ' -o foo' stdout
-  grep 'echo .*oop' stdout
-  if test $am_cv_make_support_nested_variables = yes; then
-    grep 'echo .*older-oop' stdout
-  fi
-  $EGREP '(CC|LD) ' stdout && Exit 1
-  $make clean
-done
+./configure --enable-silent-rules >stdout || { cat stdout; Exit 1; }
+cat stdout
+grep '^checking whether \./mymake supports nested variables\.\.\. no *$' \
+  stdout
+$EGREP 'CC|AM_V|GEN' Makefile # For debugging.
+grep '^AM_V_CC =  *\$(am__v_CC_0) *$' Makefile
+grep '^AM_V_GEN =  *\$(am__v_GEN_0) *$' Makefile
+$MAKE >stdout || { cat stdout; Exit 1; }
+cat stdout
+$EGREP ' (-c|-o)' stdout && Exit 1
+grep 'mv ' stdout && Exit 1
+grep 'echo .*oop' stdout && Exit 1
+grep 'CC .*foo\.' stdout
+grep 'CC .*bar\.' stdout
+grep 'CCLD .*foo' stdout
+grep 'CCLD .*bar' stdout
+grep 'PKG-GEN .*oop' stdout
+$MAKE distclean
+
+./configure --disable-silent-rules > stdout || { cat stdout; Exit 1; }
+cat stdout
+grep '^checking whether \./mymake supports nested variables\.\.\. no *$' \
+  stdout
+$EGREP 'CC|AM_V|GEN' Makefile # For debugging.
+grep '^AM_V_CC =  *\$(am__v_CC_1) *$' Makefile
+grep '^AM_V_GEN =  *\$(am__v_GEN_1) *$' Makefile
+
+$MAKE >stdout || { cat stdout; Exit 1; }
+cat stdout
+grep ' -c' stdout
+grep ' -o foo' stdout
+grep ' -o bar' stdout
+grep 'echo .*>oop' stdout
+$EGREP '(CC|LD) ' stdout && Exit 1
 
 :
index acd9cea..0e474af 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2009, 2010, 2011 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
@@ -47,14 +47,14 @@ $AUTOCONF
 ./configure --enable-silent-rules
 $MAKE >stdout || { cat stdout; Exit 1; }
 cat stdout
-grep 'GEN foo' stdout
+grep '^ *GEN foo *$' stdout
 grep 'cp ' stdout && Exit 1
 
 $MAKE clean
 $MAKE V=1 >stdout || { cat stdout; Exit 1; }
 cat stdout
 grep 'GEN ' stdout && Exit 1
-grep 'cp ' stdout
+grep 'cp \.*/foo\.in foo' stdout
 
 $MAKE distclean
 
@@ -62,7 +62,13 @@ $MAKE distclean
 $MAKE >stdout || { cat stdout; Exit 1; }
 cat stdout
 grep 'GEN ' stdout && Exit 1
-grep 'cp ' stdout
+grep 'cp \.*/foo\.in foo' stdout
+
+$MAKE clean
+$MAKE V=0 >stdout || { cat stdout; Exit 1; }
+cat stdout
+grep '^ *GEN foo *$' stdout
+grep 'cp ' stdout && Exit 1
 
 $MAKE distclean