From: Stefano Lattarini Date: Thu, 26 Jul 2012 17:01:49 +0000 (+0200) Subject: Merge branch 'master' into ng/master X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=94bde9aab7efff7650222e317ef97295c8cfcaed;p=thirdparty%2Fautomake.git Merge branch 'master' into ng/master * master: (39 commits) typofix: in a comment in Makefile.am maintcheck: fixup list of files in $(xdefs) tests: never source test-defs.sh directly, source test-lib.sh instead runtest: sanitize test environment tests: remove an obsolescent self test tests: "am_using_tap=yes" -> "am_test_protocol=tap" tests: protect test libs against multiple inclusion configure: testsuite shell can return early from "dot-sourced" files tests: move sanitization and "Bournification" in the generic test lib tests: source test defs in the generic test lib test defs: no need to re-add $srcdir/t/ax to $PATH tests: split test libs into "generic" and "automake-specific" test setup: move actual calling of testsuite setup in ./defs test setup: merge definitions of function for simple tests test init: refactor: new function 'am_test_setup' test init: refactor: move displaying of debugging info later test init: refactor: new function 'am_setup_testdir' test init: refactor: new function 'am_set_exit_traps' configure: testsuite shell set exit traps in shell functions test init: refactor: new function 'am_exit_trap' ... + Extra non-trivial edits: * Makefile.am (perf_TESTS): Define here, as 't/list-of-tests.mk' is gone in the 'ng/master' branch. (all_TESTS): Don't list tests in 't/perf'; this reflects the removal of $(perf_TESTS) from $(handwritten_TESTS) done in 't/list-of-tests.mk' on the 'master' branch. * t/depcomp-shuffle.sh: Source 'test-lib.sh', not './defs-static'. Also, simply use: . depcomp-shuffle.sh instead of: . "$am_testauxdir"/depcomp-shuffle.sh to source the helper shell script 'depcomp-shuffle.sh'. See recent commit 'v1.12.2-49-g42fb45b' for a rationale. * t/depcomp-shuffle-sub-vpath.sh: Likewise. * t/depcomp-shuffle-sub.sh: Likewise. * t/depcomp-shuffle-vpath.sh: Likewise. Signed-off-by: Stefano Lattarini --- 94bde9aab7efff7650222e317ef97295c8cfcaed diff --cc .gitignore index 51a8b82a4,c42aef3c8..8fee6b76f --- a/.gitignore +++ b/.gitignore @@@ -38,8 -38,8 +38,8 @@@ /test-suite.log /t/wrap/aclocal-1.* /t/wrap/automake-1.* - /defs-static + /t/ax/test-defs.sh -/t/testsuite-part.am +/testsuite-autodeps.am /t/*-w.tap /t/*-w.sh /t/depcomp-*.tap diff --cc Makefile.am index 51258ccfb,98a67a0dd..362be992b --- a/Makefile.am +++ b/Makefile.am @@@ -296,67 -325,7 +296,66 @@@ AM_TAP_LOG_DRIVER_FLAGS = --merg EXTRA_DIST += t/README t/ax/is t/ax/is_newest -TESTS = ## Will be updated later. +# Hand-written tests for stuff in 'contrib/'. +include $(srcdir)/contrib/t/local.am + +# All tests, both hand-written and autogenerated. +# IMPORTANT: This assumes that the autogenerated tests are placed +# in the $(srcdir) as well! +all_TESTS = \ + $(wildcard $(srcdir)/t/*.sh) \ + $(wildcard $(srcdir)/t/*.tap) \ - $(wildcard $(srcdir)/t/pm/*.pl) \ - $(wildcard $(srcdir)/t/perf/*.sh) ++ $(wildcard $(srcdir)/t/pm/*.pl) + +# This is to ensure longer-running tests will be run earlier, which is +# useful when running the testsuite in parallel on multicore machines. +# Here too we assume that the autogenerated tests are placed in $(srcdir). +long_running_TESTS = \ + $(srcdir)/t/dist-many.sh \ + $(srcdir)/t/parallel-tests-many.sh \ + $(srcdir)/t/add-missing.tap \ + $(srcdir)/t/instspc.tap \ + $(wildcard $(srcdir)/t/depcomp-*.tap) \ + $(wildcard $(srcdir)/t/*libtool*.sh) \ + $(wildcard $(srcdir)/t/lt*.sh) \ + $(wildcard $(srcdir)/t/remake*.sh) + +TESTS = \ + $(long_running_TESTS) \ + $(filter-out $(long_running_TESTS), $(all_TESTS)) \ + $(contrib_TESTS) + +EXTRA_DIST += $(TESTS) + +# FIXME: this "expected failures" are in truth an hack used to +# FIXME: to verify that some incorrect usages of our perl libraries +# FIXME: raise an error. We should find a cleaner way to check that. +perl_fake_XFAIL_TESTS = \ + t/pm/Cond2.pl \ + t/pm/Cond3.pl \ + t/pm/DisjCon2.pl \ + t/pm/DisjCon3.pl \ + t/pm/Version2.pl \ + t/pm/Version3.pl + +XFAIL_TESTS = \ + t/all.sh \ + t/override-suggest-local.sh \ + t/comments-in-var-def.sh \ + t/cond17.sh \ + t/dist-srcdir2.sh \ + t/gcj6.sh \ + t/override-conditional-2.sh \ + t/dist-pr109765.sh \ + t/instdir-cond2.sh \ + t/interp3.sh \ + t/java-nobase.sh \ + t/objext-pr10128.sh \ + t/pr8365-remake-timing.sh \ + t/remake-am-pr10111.sh \ + t/remake-m4-pr10111.sh \ + t/var-undef-append.sh \ + $(perl_fake_XFAIL_TESTS) # Some testsuite-influential variables should be overridable from the # test scripts, but not from the environment. @@@ -376,44 -348,85 +378,60 @@@ AM_TESTS_ENVIRONMENT = AM_TESTS_FD_REDIRECT = 9>&2 AM_TESTS_ENVIRONMENT += stderr_fileno_=9; export stderr_fileno_; + # For sourcing of extra "shell libraries" by our test scripts. As per + # POSIX, sourcing a file with '.' will cause it to be looked up in $PATH + # in case it is given with a relative name containing no slashes. + AM_TESTS_ENVIRONMENT += \ + if test $(srcdir) != .; then \ + PATH='$(abs_srcdir)/t/ax'$(PATH_SEPARATOR)$$PATH; \ + fi; \ + PATH='$(abs_builddir)/t/ax'$(PATH_SEPARATOR)$$PATH; \ + export PATH; + -# Hand-written tests. - -include $(srcdir)/t/list-of-tests.mk - -TESTS += $(handwritten_TESTS) -EXTRA_DIST += $(handwritten_TESTS) - -# Automatically-generated tests wrapping hand-written ones. -# Also, automatically-computed dependencies for tests. - -include $(srcdir)/t/testsuite-part.am - -TESTS += $(generated_TESTS) -EXTRA_DIST += $(generated_TESTS) +# Automatically-computed dependencies for tests. +include $(srcdir)/testsuite-autodeps.am -$(srcdir)/t/testsuite-part.am: - $(AM_V_at)rm -f t/testsuite-part.tmp $@ - $(AM_V_GEN)$(PERL) $(srcdir)/gen-testsuite-part \ - --srcdir $(srcdir) > t/testsuite-part.tmp - $(AM_V_at)chmod a-w t/testsuite-part.tmp - $(AM_V_at)mv -f t/testsuite-part.tmp $@ -EXTRA_DIST += gen-testsuite-part - -## The dependecies declared here are not truly complete, but such +## The dependencies declared here are not truly complete, but such ## completeness would cause more issues than it would solve. See ## automake bug#11347. -$(generated_TESTS): $(srcdir)/gen-testsuite-part -$(srcdir)/t/testsuite-part.am: $(srcdir)/gen-testsuite-part Makefile.am - -# Hand-written tests for stuff in 'contrib/'. -include $(srcdir)/contrib/t/local.am -TESTS += $(contrib_TESTS) -EXTRA_DIST += $(contrib_TESTS) +$(srcdir)/testsuite-autodeps.am: $(srcdir)/gen-testsuite-part + $(AM_V_at)rm -f $(@F)-t $@ + $(AM_V_GEN)$(PERL) $< --srcdir $(srcdir) > $(@F)-t + $(AM_V_at)chmod a-w $(@F)-t && mv -f $(@F)-t $@ +EXTRA_DIST += gen-testsuite-part - # Static dependencies valid for each test case. - check_SCRIPTS = t/wrap/aclocal-$(APIVERSION) t/wrap/automake-$(APIVERSION) - dist_check_DATA = \ - t/ax/test-init.sh \ - t/ax/plain-functions.sh \ + # Static dependencies valid for each test case (also further + # extended later). Note that use 'noinst_' rather than 'check_' + # as the prefix, because we really want them to be built by + # "make all". This makes it easier to run the test cases by + # hand after having simply configured and built the package. + + nodist_noinst_SCRIPTS = \ + t/wrap/aclocal-$(APIVERSION) \ + t/wrap/automake-$(APIVERSION) + + dist_noinst_DATA = \ + t/ax/test-lib.sh \ + t/ax/am-test-lib.sh \ t/ax/tap-functions.sh - nodist_check_DATA = defs-static # Few more static dependencies. t/distcheck-missing-m4.log: t/ax/distcheck-hook-m4.am t/distcheck-outdated-m4.log: t/ax/distcheck-hook-m4.am EXTRA_DIST += t/ax/distcheck-hook-m4.am - defs-static: defs-static.in Makefile + t/ax/test-defs.sh: t/ax/test-defs.in Makefile $(AM_V_at)rm -f $@ $@-t - $(AM_V_GEN)in=t/ax/test-defs.in \ - && $(do_subst) <$(srcdir)/$$in >$@-t + $(AM_V_GEN)$(do_subst) $(generated_file_finalize) - EXTRA_DIST += defs-static.in - CLEANFILES += defs-static + EXTRA_DIST += t/ax/test-defs.in + CLEANFILES += t/ax/test-defs.sh + nodist_noinst_DATA = t/ax/test-defs.sh runtest: runtest.in Makefile $(AM_V_at)rm -f $@ $@-t -- $(AM_V_GEN)in=runtest.in \ -- && $(MKDIR_P) t/ax \ -- && $(do_subst) <$(srcdir)/runtest.in >$@-t \ -- && chmod a+x $@-t ++ $(AM_V_GEN)$(do_subst) ++ $(AM_V_at)chmod a+x $@-t $(generated_file_finalize) EXTRA_DIST += runtest.in CLEANFILES += runtest @@@ -472,8 -485,21 +490,19 @@@ check-local: check-tests-synta # Run the testsuite with the installed aclocal and automake. installcheck-local: installcheck-testsuite installcheck-testsuite: - am_running_installcheck=yes $(MAKE) $(AM_MAKEFLAGS) check + am_running_installcheck=yes $(MAKE) check + # Performance tests. ++perf_TESTS = $(wildcard $(srcdir)/t/perf/*.sh) \ ++ $(wildcard $(srcdir)/t/perf/*.tap) + .PHONY: perf + perf: all + $(MAKE) $(AM_MAKEFLAGS) TEST_SUITE_LOG='$(PERF_TEST_SUITE_LOG)' \ + TESTS='$(perf_TESTS)' check + PERF_TEST_SUITE_LOG = t/perf/test-suite.log + CLEANFILES += $(PERF_TEST_SUITE_LOG) + EXTRA_DIST += $(perf_TESTS) + clean-local: clean-local-check .PHONY: clean-local-check clean-local-check: diff --cc gen-testsuite-part index a67ce55e8,21c26c46d..50f8a7049 --- a/gen-testsuite-part +++ b/gen-testsuite-part @@@ -89,25 -96,28 +96,26 @@@ sub write_wrapper_script ($$$ print $file_handle unindent <&2 + w="\$am_top_srcdir/$wrapped_test" + if test -f "\$w"; then + echo "\$0: will source '\$w'" + . "\$w" + exit \$? + fi + echo "\$0: cannot find wrapped test '\$w'" >&2 exit 99 EOF } sub get_list_of_tests () { - my @tests_list = split /\s+/, `cd '$srcdir' && ls t/*.sh t/*.tap`; - my $make = defined $ENV{MAKE} ? $ENV{MAKE} : "make"; - # Unset MAKEFLAGS, for when we are called from make itself. - my $cmd = "MAKEFLAGS= && unset MAKEFLAGS && cd '$srcdir' && " - . "$make -s -f $testdir/list-of-tests.mk print-list-of-tests"; - my @tests_list = split /\s+/, `$cmd`; ++ my @tests_list = split /\s+/, ++ `cd '$srcdir' && echo $testdir/*.sh $testdir/*.tap`; + # Tests whose names matches this pattern are already autogenerated, + # so we shouldn't re-process them. + @tests_list = grep { !/-w[0-9]*\.(sh|tap)$/ } @tests_list; die "$me: cannot get list of tests\n" unless $? == 0 && @tests_list; my $ok = 1; foreach my $test (@tests_list) @@@ -151,13 -157,8 +155,13 @@@ my %deps_extractor use_trivial_test_driver => { line_matcher => qr/\btrivial-test-driver\b/, - dist_prereqs => "t/$auxdir/trivial-test-driver", + dist_prereqs => "$testauxdir/trivial-test-driver", }, + depcomp_shuffle => + { + line_matcher => qr/\bdepcomp-shuffle\.sh\b/, - dist_prereqs => "t/$auxdir/depcomp-shuffle.sh", ++ dist_prereqs => "$testauxdir/depcomp-shuffle.sh", + }, check_testsuite_summary => { line_matcher => qr/\btestsuite-summary-checks\.sh\b/, @@@ -343,9 -347,11 +347,9 @@@ foreach my $lt (TRUE, FALSE "depmode=$m", "depcomp_with_libtool=" . ($lt ? "yes" : "no"), ); - my $test = "$testdir/depcomp" . ($lt ? "-lt-" : "-") . "$m.tap"; - # Register wrapper test as "autogenerated" ... - push @generated_tests, $test; - # ... and create it. - atomic_write ($test, sub + my $testname = "depcomp" . ($lt ? "-lt-" : "-") . $m . ".tap"; + # Create wrapper test. - atomic_write ("$srcdir/t/$testname", sub ++ atomic_write ("$srcdir/$testdir/$testname", sub { my $file_handle = shift; print $file_handle unindent < Makefile << 'END' - .SUFFIXES: .u .v .w - .u.v: ; cp $< $@ - .v.w: ; cp $< $@ -END - echo make can chain suffix rules > foo.u - if $MAKE foo.w && diff foo.u foo.w; then - am__can_chain_suffix_rules=yes - else - am__can_chain_suffix_rules=no - fi - cd .. - rm -rf am__chain.dir$$ - fi - fi - case $am__can_chain_suffix_rules in - yes) return 0;; - no) return 1;; - *) fatal_ "make_can_chain_suffix_rules: internal error";; - esac -} -am__can_chain_suffix_rules="" # Avoid interferences from the environment. - -# 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 () -{ - if test -z "$am__useless_vpath_rebuild"; then - if using_gmake; then - am__useless_vpath_rebuild=no - return 1 - fi - 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 ! -e foo.b && test ! -e bar; then - am__useless_vpath_rebuild=no - else - am__useless_vpath_rebuild=yes - fi - cd ../.. - rm -rf am__vpath.dir$$ - fi - case $am__useless_vpath_rebuild in - yes) return 0;; - no) return 1;; - "") ;; - *) fatal_ "no_useless_builddir_remake: internal error";; - esac --} -am__useless_vpath_rebuild="" - -yl_distcheck () { useless_vpath_rebuild || $MAKE distcheck ${1+"$@"}; } -- # count_test_results total=N pass=N fail=N xpass=N xfail=N skip=N error=N # ----------------------------------------------------------------------- # Check that a testsuite run driven by the parallel-tests harness has diff --cc t/depcomp-shuffle-sub-vpath.sh index 18fde7e29,f77f4396a..0eee3a8cf --- a/t/depcomp-shuffle-sub-vpath.sh +++ b/t/depcomp-shuffle-sub-vpath.sh @@@ -14,10 -14,19 +14,10 @@@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# A test for missing _SOURCES variable. +# Dependency tracking in the face of added/removed/renamed files. +# - VPATH build +# - use of subdir objects - . ./defs-static || exit '99' -. ./defs || exit 1 - -cat >> configure.ac << 'END' -AC_PROG_CC -END - -cat > Makefile.am << 'END' -bin_PROGRAMS = pavel -END - -$ACLOCAL -$AUTOMAKE - -grep 'pavel\.[co]' Makefile.in ++. test-lib.sh +xdir='sub' vpath='yes' - . "$am_testauxdir"/depcomp-shuffle.sh ++. depcomp-shuffle.sh diff --cc t/depcomp-shuffle-sub.sh index 21f703baa,e2404ba6f..8bf843d98 --- a/t/depcomp-shuffle-sub.sh +++ b/t/depcomp-shuffle-sub.sh @@@ -14,10 -14,18 +14,10 @@@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Test for error for bad syntax. +# Dependency tracking in the face of added/removed/renamed files. +# - in-tree build +# - use of subdir objects - . ./defs-static || exit 99 -. ./defs || exit 1 - -cat > Makefile.am << 'END' -foo = q \ - -bin_SCRIPTS = foo.sh -END - -$ACLOCAL -AUTOMAKE_fails -Wnone -grep '^Makefile\.am:2:.*blank line following trailing backslash' stderr - -: ++. test-lib.sh +xdir='sub' vpath='no' - . "$am_testauxdir"/depcomp-shuffle.sh ++. depcomp-shuffle.sh diff --cc t/depcomp-shuffle-vpath.sh index 4baf20fa6,1bc60f008..11d4a7ed7 --- a/t/depcomp-shuffle-vpath.sh +++ b/t/depcomp-shuffle-vpath.sh @@@ -14,10 -14,19 +14,10 @@@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Make sure comments following trailing backslashes are diagnosed. -# Report from Harald Dunkel. +# Dependency tracking in the face of added/removed/renamed files. +# - VPATH build +# - no use of subdir objects - . ./defs-static || exit 99 -. ./defs || exit 1 - -cat > Makefile.am << 'END' -SUBDIRS = foo \ -# bar - -END - -mkdir foo - -$ACLOCAL -AUTOMAKE_fails -grep backslash stderr ++. test-lib.sh +xdir='' vpath='yes' - . "$am_testauxdir"/depcomp-shuffle.sh ++. depcomp-shuffle.sh diff --cc t/depcomp-shuffle.sh index 23ce20c64,000000000..70b64ac33 mode 100755,000000..100755 --- a/t/depcomp-shuffle.sh +++ b/t/depcomp-shuffle.sh @@@ -1,23 -1,0 +1,23 @@@ +#! /bin/sh +# Copyright (C) 2012 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 . + +# Dependency tracking in the face of added/removed/renamed files. +# - in-tree build +# - no use of subdir objects + - . ./defs-static || exit 99 ++. test-lib.sh +xdir='' vpath='no' - . "$am_testauxdir"/depcomp-shuffle.sh ++. depcomp-shuffle.sh