automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] {yacc-work} tests: more coverage on yacc/lex silent-rules, plus


From: Stefano Lattarini
Subject: [PATCH] {yacc-work} tests: more coverage on yacc/lex silent-rules, plus minor cleanups
Date: Fri, 21 Jan 2011 13:16:35 +0100
User-agent: KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; )

Hello automakers.

The `silent-yacc*.test' and `silent-lex*.test' tests were testing
non-generic rules for C sources only, not for Lex/Yacc sources.

Also, the output emitted by automake-generated rules when updating
a yacc-generated header wasn't being tested anywhere.

The attached patch should fix these shortcomings.

OK for the 'yacc-work' branch (branch which, BTW, might as well
be made public at this point), to be merged into 'master'?

Regards,
   Stefano
From 35d6a96a0237a122109decca642870b20703905b Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <address@hidden>
Date: Fri Jan 21 12:49:32 2011 +0100
Subject: [PATCH] tests: more coverage on yacc/lex silent-rules, plus minor 
cleanups

* tests/silent-yacc-gcc.test: Add sanity checks verifying that the
generated Makefile.in files really contains the non-generic rules
we expect.  Do not redundantly remove by hand files we know to be
already removed "make maintainer-clean".
(Makefile.am): Ensure we cover also non-generic yacc rules, by
setting target-specific YFLAGS.
(sub/Makefile.am): Likewise.
* tests/silent-yacc-generic.test: Likewise.
* tests/silent-lex-gcc.test: Likewise, but with LFLAGS instead of
YFLAGS.
* tests/silent-lex-generic.test: Likewise.
* tests/silent-many-gcc.test: Likewise, but with both LFLAGS and
YFLAGS.  Also ...
(do_and_check_verbose_build): Remove redundant blank line.
* tests/silent-many-generic.test: Likewise.
* tests/silent-yacc-headers.test: New test.
* tests/Makefile.am (TESTS): Update.
---
 ChangeLog                      |   21 +++++++
 tests/Makefile.am              |    1 +
 tests/Makefile.in              |    1 +
 tests/silent-lex-gcc.test      |   19 +++++-
 tests/silent-lex-generic.test  |   19 +++++-
 tests/silent-many-gcc.test     |   39 +++++++++++-
 tests/silent-many-generic.test |   40 ++++++++++++-
 tests/silent-yacc-gcc.test     |   17 +++++-
 tests/silent-yacc-generic.test |   17 +++++-
 tests/silent-yacc-headers.test |  129 ++++++++++++++++++++++++++++++++++++++++
 10 files changed, 289 insertions(+), 14 deletions(-)
 create mode 100755 tests/silent-yacc-headers.test

diff --git a/ChangeLog b/ChangeLog
index 31adec7..55a083b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
+2011-01-21   Stefano Lattarini  <address@hidden>
+
+       tests: more coverage on yacc/lex silent-rules, plus minor cleanups
+       * tests/silent-yacc-gcc.test: Add sanity checks verifying that the
+       generated Makefile.in files really contains the non-generic rules
+       we expect.  Do not redundantly remove by hand files we know to be
+       already removed "make maintainer-clean".
+       (Makefile.am): Ensure we cover also non-generic yacc rules, by
+       setting target-specific YFLAGS.
+       (sub/Makefile.am): Likewise.
+       * tests/silent-yacc-generic.test: Likewise.
+       * tests/silent-lex-gcc.test: Likewise, but with LFLAGS instead of
+       YFLAGS.
+       * tests/silent-lex-generic.test: Likewise.
+       * tests/silent-many-gcc.test: Likewise, but with both LFLAGS and
+       YFLAGS.  Also ...
+       (do_and_check_verbose_build): Remove redundant blank line.
+       * tests/silent-many-generic.test: Likewise.
+       * tests/silent-yacc-headers.test: New test.
+       * tests/Makefile.am (TESTS): Update.
+
 2011-01-12   Stefano Lattarini  <address@hidden>
 
        docs: clustered '-d' not recognized in YFLAGS
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 39f1a39..e639b6c 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -648,6 +648,7 @@ silent-lex-gcc.test \
 silent-lex-generic.test \
 silent-yacc-gcc.test \
 silent-yacc-generic.test \
+silent-yacc-headers.test \
 sinclude.test \
 srcsub.test \
 srcsub2.test \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 0ea9825..5eedb76 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -915,6 +915,7 @@ silent-lex-gcc.test \
 silent-lex-generic.test \
 silent-yacc-gcc.test \
 silent-yacc-generic.test \
+silent-yacc-headers.test \
 sinclude.test \
 srcsub.test \
 srcsub2.test \
diff --git a/tests/silent-lex-gcc.test b/tests/silent-lex-gcc.test
index 426dc50..acaa4f9 100755
--- a/tests/silent-lex-gcc.test
+++ b/tests/silent-lex-gcc.test
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (C) 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
@@ -37,6 +37,7 @@ cat > Makefile.am <<'EOF'
 bin_PROGRAMS = foo1 foo2
 foo1_SOURCES = foo.l
 foo2_SOURCES = $(foo1_SOURCES)
+foo2_LFLAGS = -n
 foo2_CFLAGS = $(AM_CFLAGS)
 SUBDIRS = sub
 LDADD = $(LEXLIB)
@@ -48,6 +49,7 @@ AUTOMAKE_OPTIONS = subdir-objects
 bin_PROGRAMS = bar1 bar2
 bar1_SOURCES = bar.l
 bar2_SOURCES = $(bar1_SOURCES)
+bar2_LFLAGS = -n
 bar2_CFLAGS = $(AM_CFLAGS)
 LDADD = $(LEXLIB)
 EOF
@@ -64,6 +66,18 @@ $ACLOCAL
 $AUTOMAKE --add-missing
 $AUTOCONF
 
+# Check that the expected non-generic rules has been truly generated.
+# Otherwise, the coverage offered by this test will be weaker then
+# expected and planned.
+$FGREP 'foo2-foo.c' Makefile.in
+$FGREP 'foo2-foo2-foo.o' Makefile.in
+$FGREP '$(foo2_LFLAGS)' Makefile.in
+$FGREP '$(foo2_CFLAGS)' Makefile.in
+$FGREP 'bar2-bar.c' sub/Makefile.in
+$FGREP 'bar2-bar2-bar.o' sub/Makefile.in
+$FGREP '$(bar2_LFLAGS)' sub/Makefile.in
+$FGREP '$(bar2_CFLAGS)' sub/Makefile.in
+
 # Force gcc ("fast") depmode.
 # This apparently useless "for" loop is here to simplify the syncing
 # with sister test `silent-lex-gcc.test'.
@@ -108,7 +122,7 @@ do
 
   # Ensure a truly clean rebuild.
   $MAKE clean
-  rm -f foo.c sub/bar.c
+  rm -f *foo.c sub/*bar.c
 
   $MAKE V=1 >stdout || { cat stdout; Exit 1; }
   cat stdout
@@ -136,7 +150,6 @@ do
   # Ensure a truly clean reconfiguration/rebuild.
   $MAKE clean
   $MAKE maintainer-clean
-  rm -f foo.c sub/bar.c
 
 done
 
diff --git a/tests/silent-lex-generic.test b/tests/silent-lex-generic.test
index 66535e8..953c8f7 100755
--- a/tests/silent-lex-generic.test
+++ b/tests/silent-lex-generic.test
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (C) 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
@@ -37,6 +37,7 @@ cat > Makefile.am <<'EOF'
 bin_PROGRAMS = foo1 foo2
 foo1_SOURCES = foo.l
 foo2_SOURCES = $(foo1_SOURCES)
+foo2_LFLAGS = -n
 foo2_CFLAGS = $(AM_CFLAGS)
 SUBDIRS = sub
 LDADD = $(LEXLIB)
@@ -48,6 +49,7 @@ AUTOMAKE_OPTIONS = subdir-objects
 bin_PROGRAMS = bar1 bar2
 bar1_SOURCES = bar.l
 bar2_SOURCES = $(bar1_SOURCES)
+bar2_LFLAGS = -n
 bar2_CFLAGS = $(AM_CFLAGS)
 LDADD = $(LEXLIB)
 EOF
@@ -64,6 +66,18 @@ $ACLOCAL
 $AUTOMAKE --add-missing
 $AUTOCONF
 
+# Check that the expected non-generic rules has been truly generated.
+# Otherwise, the coverage offered by this test will be weaker then
+# expected and planned.
+$FGREP 'foo2-foo.c' Makefile.in
+$FGREP 'foo2-foo2-foo.o' Makefile.in
+$FGREP '$(foo2_LFLAGS)' Makefile.in
+$FGREP '$(foo2_CFLAGS)' Makefile.in
+$FGREP 'bar2-bar.c' sub/Makefile.in
+$FGREP 'bar2-bar2-bar.o' sub/Makefile.in
+$FGREP '$(bar2_LFLAGS)' sub/Makefile.in
+$FGREP '$(bar2_CFLAGS)' sub/Makefile.in
+
 # Force dependency tracking explicitly, so that slow dependency
 # extractors are not rejected.  Try also with dependency tracking
 # explicitly disabled.
@@ -108,7 +122,7 @@ do
 
   # Ensure a truly clean rebuild.
   $MAKE clean
-  rm -f foo.c sub/bar.c
+  rm -f *foo.c sub/*bar.c
 
   $MAKE V=1 >stdout || { cat stdout; Exit 1; }
   cat stdout
@@ -136,7 +150,6 @@ do
   # Ensure a truly clean reconfiguration/rebuild.
   $MAKE clean
   $MAKE maintainer-clean
-  rm -f foo.c sub/bar.c
 
 done
 
diff --git a/tests/silent-many-gcc.test b/tests/silent-many-gcc.test
index 5e6d191..c9fbe02 100755
--- a/tests/silent-many-gcc.test
+++ b/tests/silent-many-gcc.test
@@ -73,7 +73,6 @@ do_and_check_silent_build ()
 # Avoids too much code duplication.
 do_and_check_verbose_build ()
 {
-
   case $1 in
     --rebuild) rebuild=true;;
             *) rebuild=false;;
@@ -118,6 +117,8 @@ fo2_SOURCES = $(foo_SOURCES)
 fo2_CPPFLAGS = $(AM_CPPFLAGS)
 fo2_FFLAGS = $(AM_FFLAGS)
 fo2_FCFLAGS = $(AM_FCFLAGS)
+fo2_YFLAGS = -v
+fo2_LFLAGS = -n
 SUBDIRS = sub
 AM_YFLAGS = -d
 LDADD = $(LEXLIB)
@@ -134,6 +135,8 @@ ba2_SOURCES = $(baz_SOURCES)
 ba2_CPPFLAGS = $(AM_CPPFLAGS)
 ba2_FFLAGS = $(AM_FFLAGS)
 ba2_FCFLAGS = $(AM_FCFLAGS)
+ba2_YFLAGS = -v
+ba2_LFLAGS = -n
 AM_YFLAGS = -d
 LDADD = $(LEXLIB)
 BUILT_SOURCES = baz6.h
@@ -182,6 +185,38 @@ $ACLOCAL
 $AUTOMAKE --add-missing
 $AUTOCONF
 
+# Check that the expected non-generic rules has been truly generated.
+# Otherwise, the coverage offered by this test will be weaker then
+# expected and planned.
+
+$FGREP 'bar-bar.o' Makefile.in
+$FGREP '$(bar_CFLAGS)' Makefile.in
+$FGREP '$(fo2_CPPFLAGS)' Makefile.in
+$FGREP '$(fo2_LFLAGS)' Makefile.in
+$FGREP '$(fo2_YFLAGS)' Makefile.in
+$FGREP '$(fo2_FFLAGS)' Makefile.in
+$FGREP '$(fo2_FCFLAGS)' Makefile.in
+$FGREP 'fo2-foo1.o' Makefile.in
+$FGREP 'fo2-foo2.o' Makefile.in
+$FGREP 'fo2-foo3.o' Makefile.in
+: "Yes, this is not a blunder: there's no baz4!"
+$FGREP 'fo2-foo5.c' Makefile.in
+$FGREP 'fo2-foo6.c' Makefile.in
+
+$FGREP 'bla-bla.o' sub/Makefile.in
+$FGREP '$(bla_CFLAGS)' sub/Makefile.in
+$FGREP '$(ba2_CPPFLAGS)' sub/Makefile.in
+$FGREP '$(ba2_LFLAGS)' sub/Makefile.in
+$FGREP '$(ba2_YFLAGS)' sub/Makefile.in
+$FGREP '$(ba2_FFLAGS)' sub/Makefile.in
+$FGREP '$(ba2_FCFLAGS)' sub/Makefile.in
+$FGREP 'ba2-baz1.o' sub/Makefile.in
+$FGREP 'ba2-baz2.o' sub/Makefile.in
+$FGREP 'ba2-baz3.o' sub/Makefile.in
+: "Yes, this is not a blunder: there's no baz4!"
+$FGREP 'ba2-baz5.c' sub/Makefile.in
+$FGREP 'ba2-baz6.c' sub/Makefile.in
+
 # Force gcc ("fast") depmode.
 # This apparently useless "for" loop is here to simplify the syncing
 # with sister test `silent-many-gcc.test'.
@@ -202,7 +237,7 @@ do
   $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]
+  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
diff --git a/tests/silent-many-generic.test b/tests/silent-many-generic.test
index ed27448..1fa8908 100755
--- a/tests/silent-many-generic.test
+++ b/tests/silent-many-generic.test
@@ -75,7 +75,6 @@ do_and_check_silent_build ()
 # Avoids too much code duplication.
 do_and_check_verbose_build ()
 {
-
   case $1 in
     --rebuild) rebuild=true;;
             *) rebuild=false;;
@@ -120,6 +119,8 @@ fo2_SOURCES = $(foo_SOURCES)
 fo2_CPPFLAGS = $(AM_CPPFLAGS)
 fo2_FFLAGS = $(AM_FFLAGS)
 fo2_FCFLAGS = $(AM_FCFLAGS)
+fo2_YFLAGS = -v
+fo2_LFLAGS = -n
 SUBDIRS = sub
 AM_YFLAGS = -d
 LDADD = $(LEXLIB)
@@ -136,6 +137,8 @@ ba2_SOURCES = $(baz_SOURCES)
 ba2_CPPFLAGS = $(AM_CPPFLAGS)
 ba2_FFLAGS = $(AM_FFLAGS)
 ba2_FCFLAGS = $(AM_FCFLAGS)
+ba2_YFLAGS = -v
+ba2_LFLAGS = -n
 AM_YFLAGS = -d
 LDADD = $(LEXLIB)
 BUILT_SOURCES = baz6.h
@@ -184,6 +187,39 @@ $ACLOCAL
 $AUTOMAKE --add-missing
 $AUTOCONF
 
+# Check that the expected non-generic rules has been truly generated.
+# Otherwise, the coverage offered by this test will be weaker then
+# expected and planned.
+
+$FGREP 'bar-bar.o' Makefile.in
+$FGREP '$(bar_CFLAGS)' Makefile.in
+$FGREP '$(fo2_CPPFLAGS)' Makefile.in
+$FGREP '$(fo2_LFLAGS)' Makefile.in
+$FGREP '$(fo2_YFLAGS)' Makefile.in
+$FGREP '$(fo2_FFLAGS)' Makefile.in
+$FGREP '$(fo2_FCFLAGS)' Makefile.in
+$FGREP 'fo2-foo1.o' Makefile.in
+$FGREP 'fo2-foo2.o' Makefile.in
+$FGREP 'fo2-foo3.o' Makefile.in
+: "Yes, this is not a blunder: there's no baz4!"
+$FGREP 'fo2-foo5.c' Makefile.in
+$FGREP 'fo2-foo6.c' Makefile.in
+
+$FGREP 'bla-bla.o' sub/Makefile.in
+$FGREP '$(bla_CFLAGS)' sub/Makefile.in
+$FGREP '$(ba2_CPPFLAGS)' sub/Makefile.in
+$FGREP '$(ba2_LFLAGS)' sub/Makefile.in
+$FGREP '$(ba2_YFLAGS)' sub/Makefile.in
+$FGREP '$(ba2_FFLAGS)' sub/Makefile.in
+$FGREP '$(ba2_FCFLAGS)' sub/Makefile.in
+$FGREP 'ba2-baz1.o' sub/Makefile.in
+$FGREP 'ba2-baz2.o' sub/Makefile.in
+$FGREP 'ba2-baz3.o' sub/Makefile.in
+: "Yes, this is not a blunder: there's no baz4!"
+$FGREP 'ba2-baz5.c' sub/Makefile.in
+$FGREP 'ba2-baz6.c' sub/Makefile.in
+
+
 # Force dependency tracking explicitly, so that slow dependency
 # extractors are not rejected.  Try also with dependency tracking
 # explicitly disabled.
@@ -204,7 +240,7 @@ do
   $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]
+  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
diff --git a/tests/silent-yacc-gcc.test b/tests/silent-yacc-gcc.test
index 83e6ebe..b957734 100755
--- a/tests/silent-yacc-gcc.test
+++ b/tests/silent-yacc-gcc.test
@@ -37,6 +37,7 @@ cat > Makefile.am <<'EOF'
 bin_PROGRAMS = foo1 foo2
 foo1_SOURCES = foo.y
 foo2_SOURCES = $(foo1_SOURCES)
+foo2_YFLAGS = -v
 foo2_CFLAGS = $(AM_CPPFLAGS)
 SUBDIRS = sub
 EOF
@@ -47,6 +48,7 @@ AUTOMAKE_OPTIONS = subdir-objects
 bin_PROGRAMS = bar1 bar2
 bar1_SOURCES = bar.y
 bar2_SOURCES = $(bar1_SOURCES)
+bar2_YFLAGS = -v
 bar2_CFLAGS = $(AM_CPPFLAGS)
 EOF
 
@@ -66,6 +68,18 @@ $ACLOCAL
 $AUTOMAKE --add-missing
 $AUTOCONF
 
+# Check that the expected non-generic rules has been truly generated.
+# Otherwise, the coverage offered by this test will be weaker then
+# expected and planned.
+$FGREP 'foo2-foo.c' Makefile.in
+$FGREP 'foo2-foo2-foo.o' Makefile.in
+$FGREP '$(foo2_YFLAGS)' Makefile.in
+$FGREP '$(foo2_CFLAGS)' Makefile.in
+$FGREP 'bar2-bar.c' sub/Makefile.in
+$FGREP 'bar2-bar2-bar.o' sub/Makefile.in
+$FGREP '$(bar2_YFLAGS)' sub/Makefile.in
+$FGREP '$(bar2_CFLAGS)' sub/Makefile.in
+
 # Force gcc ("fast") depmode.
 # This apparently useless "for" loop is here to simplify the syncing
 # with sister test `silent-yacc-gcc.test'.
@@ -110,7 +124,7 @@ do
 
   # Ensure a truly clean rebuild.
   $MAKE clean
-  rm -f foo.[ch] sub/bar.[ch]
+  rm -f *foo.[ch] sub/*bar.[ch]
 
   $MAKE V=1 >stdout || { cat stdout; Exit 1; }
   cat stdout
@@ -138,7 +152,6 @@ do
   # Ensure a truly clean reconfiguration/rebuild.
   $MAKE clean
   $MAKE maintainer-clean
-  rm -f foo.[ch] sub/bar.[ch]
 
 done
 
diff --git a/tests/silent-yacc-generic.test b/tests/silent-yacc-generic.test
index 553e78b..31edf27 100755
--- a/tests/silent-yacc-generic.test
+++ b/tests/silent-yacc-generic.test
@@ -37,6 +37,7 @@ cat > Makefile.am <<'EOF'
 bin_PROGRAMS = foo1 foo2
 foo1_SOURCES = foo.y
 foo2_SOURCES = $(foo1_SOURCES)
+foo2_YFLAGS = -v
 foo2_CFLAGS = $(AM_CPPFLAGS)
 SUBDIRS = sub
 EOF
@@ -47,6 +48,7 @@ AUTOMAKE_OPTIONS = subdir-objects
 bin_PROGRAMS = bar1 bar2
 bar1_SOURCES = bar.y
 bar2_SOURCES = $(bar1_SOURCES)
+bar2_YFLAGS = -v
 bar2_CFLAGS = $(AM_CPPFLAGS)
 EOF
 
@@ -66,6 +68,18 @@ $ACLOCAL
 $AUTOMAKE --add-missing
 $AUTOCONF
 
+# Check that the expected non-generic rules has been truly generated.
+# Otherwise, the coverage offered by this test will be weaker then
+# expected and planned.
+$FGREP 'foo2-foo.c' Makefile.in
+$FGREP 'foo2-foo2-foo.o' Makefile.in
+$FGREP '$(foo2_YFLAGS)' Makefile.in
+$FGREP '$(foo2_CFLAGS)' Makefile.in
+$FGREP 'bar2-bar.c' sub/Makefile.in
+$FGREP 'bar2-bar2-bar.o' sub/Makefile.in
+$FGREP '$(bar2_YFLAGS)' sub/Makefile.in
+$FGREP '$(bar2_CFLAGS)' sub/Makefile.in
+
 # Force dependency tracking explicitly, so that slow dependency
 # extractors are not rejected.  Try also with dependency tracking
 # explicitly disabled.
@@ -110,7 +124,7 @@ do
 
   # Ensure a truly clean rebuild.
   $MAKE clean
-  rm -f foo.[ch] sub/bar.[ch]
+  rm -f *foo.[ch] sub/*bar.[ch]
 
   $MAKE V=1 >stdout || { cat stdout; Exit 1; }
   cat stdout
@@ -138,7 +152,6 @@ do
   # Ensure a truly clean reconfiguration/rebuild.
   $MAKE clean
   $MAKE maintainer-clean
-  rm -f foo.[ch] sub/bar.[ch]
 
 done
 
diff --git a/tests/silent-yacc-headers.test b/tests/silent-yacc-headers.test
new file mode 100755
index 0000000..06e40f1
--- /dev/null
+++ b/tests/silent-yacc-headers.test
@@ -0,0 +1,129 @@
+#!/bin/sh
+# Copyright (C) 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
+# 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 <http://www.gnu.org/licenses/>.
+
+# Check silent-rules mode for Yacc, when used with the `-d' option.
+# Keep this in sync with sister test `silent-yacc-d-gcc.test'.
+
+required=yacc
+. ./defs || Exit 1
+
+set -e
+
+mkdir sub
+
+cat >>configure.in <<'EOF'
+AM_SILENT_RULES
+AC_PROG_YACC
+AC_PROG_CC
+AC_OUTPUT
+EOF
+
+cat > Makefile.am <<'EOF'
+# Need generic and non-generic rules.
+AM_YFLAGS = -d
+bin_PROGRAMS = foo bar
+foo_SOURCES = parse.y
+bar_SOURCES = $(foo_SOURCES)
+bar_YFLAGS = $(AM_YFLAGS)
+EOF
+
+cat > parse.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
+
+$ACLOCAL
+$AUTOMAKE --add-missing
+$AUTOCONF
+
+# Check that the expected non-generic rules has been truly generated.
+# Otherwise, the coverage offered by this test will be weaker then
+# expected and planned.
+$FGREP 'bar-parse.c' Makefile.in
+$FGREP '$(bar_YFLAGS)' Makefile.in
+
+./configure --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  *parse\.c' stdout
+grep 'updating  *parse\.h' stdout
+grep 'YACC  *bar-parse\.c' stdout
+grep 'updating  *bar-parse\.h' stdout
+
+grep ' CC  *parse\.' stdout
+grep ' CC  *bar-parse\.' stdout
+grep 'CCLD  *foo' stdout
+grep 'CCLD  *bar' 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 *.c" and "updating *.h", as yacc shouldn't
+# have been re-run.
+grep ' CC  *parse\.' stdout
+grep ' CC  *bar-parse\.' stdout
+grep 'CCLD  *foo' stdout
+grep 'CCLD  *bar' stdout
+
+# Ensure a truly clean rebuild.
+$MAKE maintainer-clean
+
+./configure --enable-silent-rules
+
+$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
+
+:
-- 
1.7.2.3


reply via email to

[Prev in Thread] Current Thread [Next in Thread]