automake-patches
[Top][All Lists]
Advanced

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

[FYI] {yacc-work} tests: work around bug#7884 in many yacc/lex tests


From: Stefano Lattarini
Subject: [FYI] {yacc-work} tests: work around bug#7884 in many yacc/lex tests
Date: Tue, 7 Feb 2012 09:36:09 +0100

Due to automake bug#7884, many test cases on Yacc/Lex support are
failing when run with FreeBSD make.  Since these failures are all
due to the same bug, and that bug is well understood and already
explicitly exposed in the dedicated 'yacc-dist-nobuild.test' test,
the reported failures are mostly noise, that not only is annoying,
but which might end up covering different real bugs or regressions.

Thus we minimize such spurious failures, by ensuring the commands
triggering them (most of them being "make distcheck" invocations)
will be skipped when $MAKE suffers of the bug/limitation that
triggers automake bug#7884.

* tests/defs.in (useless_vpath_rebuild): New function.
(yl_distcheck): Likewise.
* tests/lex3.test, tests/subpkg-yacc.test, tests/yacc-basic.test,
tests/yacc-cxx.test, tests/yacc-d-basic.test, tests/yacc-d-cxx.test,
tests/yacc-dist-nobuild-subdir.test : Use them to avoid extra
failures caused by automake bug#7884.  Where possible, throw in
some related simplifications.
---

This patch will be especially useful to avoid a deluge of new
failures on FreeBSD after we merge yacc-work into master (which
I intend to do soonish).

 tests/defs.in                       |   44 +++++++++++++++++++++++++++++++++++
 tests/lex3.test                     |    2 +-
 tests/subpkg-yacc.test              |   25 ++-----------------
 tests/yacc-basic.test               |    2 +-
 tests/yacc-cxx.test                 |    2 +-
 tests/yacc-d-basic.test             |    2 +-
 tests/yacc-d-cxx.test               |    2 +-
 tests/yacc-dist-nobuild-subdir.test |    4 +++
 8 files changed, 56 insertions(+), 27 deletions(-)

diff --git a/tests/defs.in b/tests/defs.in
index 620f658..94a87da 100644
--- a/tests/defs.in
+++ b/tests/defs.in
@@ -487,6 +487,50 @@ is_newest ()
   test -z "$is_newest_files"
 }
 
+# useless_vpath_rebuild
+# ---------------------
+# Tell whether $MAKE suffers of the bug triggering automake bug#7884.
+# For example, this happens with FreeBSD make, since in a VPATH build
+# it tends to rebuilt files for which there is an explicit or even just
+# a suffix rule, even if said files are already available in the VPATH
+# directory.
+useless_vpath_rebuild ()
+{
+  case $am__useless_vpath_rebuild in
+    yes) return 0;;
+     no) return 1;;
+     "") ;;
+      *) fatal_ "no_useless_builddir_remake: internal error";;
+  esac
+  if using_gmake; then
+    am__useless_vpath_rebuild=no
+    return 1
+  else
+    mkdir am__vpath.dir$$
+    cd am__vpath.dir$$
+    touch foo.a foo.b bar baz
+    mkdir build
+    cd build
+    unindent > Makefile << 'END'
+        .SUFFIXES: .a .b
+        VPATH = ..
+        all: foo.b baz
+        .PHONY: all
+        .a.b: ; cp $< $@
+        baz: bar ; cp ../baz bar
+END
+    if $MAKE all && test ! -f foo.b && test ! -f bar; then
+      am__useless_vpath_rebuild=no
+    else
+      am__useless_vpath_rebuild=yes
+    fi
+    cd ../..
+    rm -rf am__vpath.dir$$
+  fi
+}
+
+yl_distcheck () { useless_vpath_rebuild || $MAKE distcheck ${1+"$@"}; }
+
 # using_gmake
 # -----------
 # Return success if $MAKE is GNU make, return failure otherwise.
diff --git a/tests/lex3.test b/tests/lex3.test
index eabeb22..b52e78b 100755
--- a/tests/lex3.test
+++ b/tests/lex3.test
@@ -75,7 +75,7 @@ $MAKE distdir
 test -f $distdir/foo.c
 
 # Sanity check on distribution.
-$MAKE distcheck
+yl_distcheck
 
 # While we are at it, make sure that foo.c is erased by
 # maintainer-clean, and not by distclean.
diff --git a/tests/subpkg-yacc.test b/tests/subpkg-yacc.test
index ee8af66..ef5f101 100755
--- a/tests/subpkg-yacc.test
+++ b/tests/subpkg-yacc.test
@@ -117,34 +117,15 @@ $AUTOHEADER
 $AUTOMAKE -Wno-override --add-missing
 cd ..
 
-# Some checks here are slightly more tricky than we'd like, but we cannot
-# simply use "make distcheck", to avoid triggering a spurious failure due
-# to issues with FreeBSD make and VPATH builds (see automake bug#7884).
-
 ./configure
-$MAKE
-$MAKE dist
-test -f lib-dist-hook-has-run
-test -f subpack-1.tar.gz
-test ! -d subpack-1 # Make sure "dist" cleans up after itself.
 
-mkdir workdir
-cd workdir
-gzip -c -d ../subpack-1.tar.gz | tar xf -
-test -d subpack-1
-mkdir build
-cd build
-../subpack-1/configure
-$MAKE
 $MAKE dist
 test -f lib-dist-hook-has-run
 test -f subpack-1.tar.gz
 test ! -d subpack-1 # Make sure "dist" cleans up after itself.
 
-# Don't trust non-GNU makes to do distcheck with a Yacc-using
-# package (see bug referenced above).
-if using_gmake; then
-  $MAKE distcheck || Exit 1
-fi
+rm -f lib-dist-hook-has-run subpack-1.tar.gz
+
+yl_distcheck
 
 :
diff --git a/tests/yacc-basic.test b/tests/yacc-basic.test
index d562b7f..143f73c 100755
--- a/tests/yacc-basic.test
+++ b/tests/yacc-basic.test
@@ -89,7 +89,7 @@ test -f $distdir/bar-parse.c
 # be distributed, or properly cleaned by automake-generated rules.
 # We don't want to set the exact semantics yet, but want to ensure
 # they are are consistent.
-$MAKE distcheck
+yl_distcheck
 
 # Make sure that the Yacc-derived C sources are erased by
 # maintainer-clean, and not by distclean.
diff --git a/tests/yacc-cxx.test b/tests/yacc-cxx.test
index e4afd95..a805087 100755
--- a/tests/yacc-cxx.test
+++ b/tests/yacc-cxx.test
@@ -113,7 +113,7 @@ test -f $distdir/foo4-parse4.cpp
 # must either not be distributed, or properly cleaned by automake-generated
 # rules.  We don't want to set the exact semantics yet, but want to ensure
 # they are are consistent.
-$MAKE distcheck
+yl_distcheck
 
 # Make sure that the Yacc-derived C++ sources are erased by
 # maintainer-clean, and not by distclean.
diff --git a/tests/yacc-d-basic.test b/tests/yacc-d-basic.test
index 17750cd..8df2765 100755
--- a/tests/yacc-d-basic.test
+++ b/tests/yacc-d-basic.test
@@ -133,7 +133,7 @@ test -f $distdir/baz/zardoz-parse.c
 test -f $distdir/baz/zardoz-parse.h
 
 # Sanity check the distribution.
-$MAKE distcheck
+yl_distcheck
 
 # While we are at it, make sure that `parse.c' and `parse.h' are erased
 # by maintainer-clean, and not by distclean.
diff --git a/tests/yacc-d-cxx.test b/tests/yacc-d-cxx.test
index 1308c18..13bb094 100755
--- a/tests/yacc-d-cxx.test
+++ b/tests/yacc-d-cxx.test
@@ -197,7 +197,7 @@ test -f $distdir/qux/maude-parse.hxx
 # The Yacc-derived C++ sources must be created, and not removed once
 # compiled (i.e., not treated like "intermediate files" in the GNU
 # make sense).
-$MAKE distcheck
+yl_distcheck
 
 # Check that we can recover from deleted headers.
 $MAKE clean
diff --git a/tests/yacc-dist-nobuild-subdir.test 
b/tests/yacc-dist-nobuild-subdir.test
index 0076062..f3099c0 100755
--- a/tests/yacc-dist-nobuild-subdir.test
+++ b/tests/yacc-dist-nobuild-subdir.test
@@ -23,6 +23,10 @@ required=yacc
 
 set -e
 
+# This test is bounded to fail for any implementation that
+# triggers automake bug#7884.
+useless_vpath_rebuild && skip_ "would trip on automake bug#7884"
+
 cat >> configure.in << 'END'
 AC_PROG_CC
 AM_PROG_CC_C_O
-- 
1.7.7.3




reply via email to

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