]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
tests: work around bug#7884 in many yacc/lex tests
authorStefano Lattarini <stefano.lattarini@gmail.com>
Tue, 7 Feb 2012 08:30:37 +0000 (09:30 +0100)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Tue, 7 Feb 2012 08:31:03 +0000 (09:31 +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.

tests/defs.in
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

index 620f6587039bb89005062ad5c3ca69b33d43e644..94a87dada46c6cf5c4f4ca316c57a1a05644995e 100644 (file)
@@ -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.
index eabeb2277aa03c0fe9d5ac9909c6057973688eba..b52e78b8127ee3c30d69603b1c45b04263a8505e 100755 (executable)
@@ -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.
index ee8af66f36ada8d31ffef525c4a72d3ea7243474..ef5f101bb4c7e09ada84c6548e5d9374edab7088 100755 (executable)
@@ -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
 
 :
index d562b7f5a706c75c86d9c7dd619aeae50a0a55bd..143f73c18d250bb88a6431490b33e77352c3b64e 100755 (executable)
@@ -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.
index e4afd954376a84776a6c85dd78011f4b6afe8ec8..a805087f19424702848b9efc6867f3d9f39db379 100755 (executable)
@@ -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.
index 17750cd30e93baa46538767cf99e9eb220285283..8df27659dad57a74466fe4dd6ec706f683131a52 100755 (executable)
@@ -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.
index 1308c187461b855da59e53636383cee888e25535..13bb094f0b5ed4d4b3852345cd4e94fd32e5ee4d 100755 (executable)
@@ -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
index 0076062bb7fdcbc7d982b417d46158613ece6367..f3099c08e7fc756b9233b8267fbd75d6e44090b5 100755 (executable)
@@ -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