From: Stefano Lattarini Date: Tue, 7 Feb 2012 08:30:37 +0000 (+0100) Subject: tests: work around bug#7884 in many yacc/lex tests X-Git-Tag: v1.11b~118^2~3^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=818bc406278a138da6480412d3c289f91e6dbfda;p=thirdparty%2Fautomake.git tests: work around bug#7884 in many yacc/lex tests 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. --- diff --git a/tests/defs.in b/tests/defs.in index 620f65870..94a87dada 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 eabeb2277..b52e78b81 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 ee8af66f3..ef5f101bb 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 d562b7f5a..143f73c18 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 e4afd9543..a805087f1 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 17750cd30..8df27659d 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 1308c1874..13bb094f0 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 0076062bb..f3099c08e 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