From: Stefano Lattarini Date: Sun, 1 Jul 2012 09:48:56 +0000 (+0200) Subject: Merge branch 'master' into ng/master X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aefbb49b2b6b872f53ba6a160f78b5d439d7aaa4;p=thirdparty%2Fautomake.git Merge branch 'master' into ng/master * master: parallel-tests: silence an overly verbose recipe tests: fix some uses of 'Exit', where 'exit' should now be used instead maintcheck: test scripts should be executable, check for that parallel-tests: recipes for "check" and "recheck" are separated again tests: prefer "test ! -e FILE" to check that a file doesn't exist parallel-tests: "recheck" behaves better in case of compilation failures scripts: quote 'like this', not `like this' + Extra non-trivial edits: * lib/am/parallel-tests.am: Add a FIXME comment about automake bug#11791, stating that we should fix that someday. This is required because the changes introduced in mainline automake commit 'v1.12.1-64-g2a3e45d', which fixed automake bug#11791 there, couldn't be merged correctly in Automake-NG by the present commit, due to great divergences in the affected parts of the codebase. * Makefile.am (XFAIL_TESTS): Add 't/parallel-tests-recheck-pr11791.sh'. Signed-off-by: Stefano Lattarini --- aefbb49b2b6b872f53ba6a160f78b5d439d7aaa4 diff --cc Makefile.am index 412f168b9,3ee0777ae..d7e4b1c93 --- a/Makefile.am +++ b/Makefile.am @@@ -295,65 -324,7 +295,66 @@@ AM_TAP_LOG_DRIVER_FLAGS = --merg EXTRA_DIST += t/README t/ax/is t/ax/is_newest -TESTS = ## Will be updated later. +# 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) + +# 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/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)) + +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/parallel-tests-recheck-pr11791.sh \ + t/yacc-bison-skeleton-cxx.sh \ + t/yacc-bison-skeleton.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/parallel-tests-many.sh \ + t/pr8365-remake-timing.sh \ + t/remake-am-pr10111.sh \ + t/remake-m4-pr10111.sh \ + t/txinfo5.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. diff --cc lib/am/parallel-tests.am index c8913f615,000000000..910d8d60e mode 100644,000000..100644 --- a/lib/am/parallel-tests.am +++ b/lib/am/parallel-tests.am @@@ -1,420 -1,0 +1,422 @@@ +## automake - create Makefile.in from Makefile.am +## Copyright (C) 2001-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 . + +include color-tests.am + +## New parallel test driver. +## +## The first version of the code here was adapted from check.mk, which was +## originally written at EPITA/LRDE, further developed at Gostai, then made +## its way from GNU coreutils to end up, largely rewritten, in Automake. +## The current version is an heavy rewrite of that, to allow for support +## of more test metadata, and the use of custom test drivers and protocols +## (among them, TAP). + +## Used by (at least) 'check-typos.am'. +am__using_parallel_tests := yes + +am__is_xfail_test = \ + $(if $(filter-out $(am__xfail_test_bases), \ + $(patsubst $(srcdir)/%,%,$(1))),no,yes) +am__runtest = \ + $(am__sh_e_setup); \ + $(am__tty_colors); \ + srcdir=$(srcdir); export srcdir; \ +## Creates the directory for the log file if needed. Avoid extra forks. + test x$(@D) = x. || test -d $(@D) || $(MKDIR_P) $(@D) || exit $$?; \ +## We need to invoke the test in way that won't cause a PATH search. +## Quotes around '$<' are required to avoid extra errors when a circular +## dependency is detected (e.g., because $(TEST_SUITE_LOG) is in +## $(am__test_logs)), because in that case '$<' expands to empty and an +## unquote usage of it could cause syntax errors in the shell. + case '$<' in */*) tst='$<';; *) tst=./'$<';; esac; \ +## Executes the developer-defined and user-defined test +## setups (if any), in that order. + $(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) \ + $($(1)LOG_DRIVER) \ + --test-name '$(patsubst $(srcdir)/%,%,$<)' \ + --log-file $*.log \ + --trs-file $*.trs \ + --color-tests "$$am__color_tests" \ + --enable-hard-errors $(if $(DISABLE_HARD_ERRORS),no,yes) \ + --expect-failure $(call am__is_xfail_test,$*) \ + $(AM_$(1)LOG_DRIVER_FLAGS) \ + $($(1)LOG_DRIVER_FLAGS) \ + -- \ + $($(1)LOG_COMPILER) \ + $(AM_$(1)LOG_FLAGS) \ + $($(1)LOG_FLAGS) \ + "$$tst" \ + $(AM_TESTS_FD_REDIRECT) + +## Turn e.g., ".test" in "_TEST", and return the empty string unchanged. +am__tpfx = \ + $(if $1,$(call am__toupper,$(patsubst .%,%_,$1))) + +!define am__handle_per_suffix_test +! +## FIXME: This will pick up the default from the environment; are we sure +## FIXME: we want that? +!$$(call am__tpfx,$1)LOG_DRIVER ?= $(SHELL) $(am__config_aux_dir)/test-driver +! +!%.log %.trs: %$1 $$($$(call am__tpfx,$1)LOG_DEPENDENCIES) +! @$$(call am__runtest,$$(call am__tpfx,$1)) +! +!ifeq ($(am__handle_exeext),yes) +!ifdef EXEEXT +!%.log %.trs: %$1$(EXEEXT) $$($$(call am__tpfx,$1)LOG_DEPENDENCIES) +! @$$(call am__runtest,$$(call am__tpfx,$1)) +!endif # defined EXEEXT +!endif # am__handle_exeext = yes +! +!endef # am__handle_per_suffix_test +! +## FIXME: this will pick up the default from the environment; are we sure +## FIXME: we want that? +!TEST_EXTENSIONS ?= .test +!$(foreach am__e,$(filter-out .%,$(TEST_EXTENSIONS)),\ +! $(call am__error,invalid test extension: '$(am__e)')) +!$(foreach am__e,$(TEST_EXTENSIONS), \ +! $(eval $(call am__handle_per_suffix_test,$(am__e)))) +## It is *imperative* that the "empty" suffix goes last. Otherwise, a +## declaration like "TESTS = all.test" would cause GNU make to mistakenly +## try to build the 'all.log' and 'all.trs' files from a non-existent +## 'all' program (because the Makefile contains an explicit 'all' target, +## albeit .PHONY), rather than from the 'all.test' script, thus causing +## all sort of mishaps and confusion. +!$(eval $(call am__handle_per_suffix_test)) + +# The names of the given tests scripts with any possible registered +# test extension removed, as well as any leading '$(srcdir)' component +# (if any) stripped. +# The stripping of $(srcdir) is required to support explicit use of +# $(srcdir) in TESTS entries. That might actually be very useful in +# practice, for example in usages like this: +# TESTS = $(wildcard $(srcdir)/t[0-9][0-9]*.sh) +# where removing the $(srcdir) from the $(wildcard) invocation would +# cause the idiom to break in VPATH builds. +am__get_test_bases = $(patsubst $(srcdir)/%,%,$(strip \ +$(call am__strip_suffixes, $(TEST_EXTENSIONS), \ +?!HANDLE-EXEEXT? $(1)))) +?HANDLE-EXEEXT? $(patsubst %$(EXEEXT),%,$(1))))) + +am__recheck_rx = ^[ ]*:recheck:[ ]* +am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* +am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* + +# A command that, given a newline-separated list of test names on the +# standard input, print the name of the tests that are to be re-run +# upon "make recheck". +am__list_recheck_tests = $(AWK) '{ \ +## By default, we assume the test is to be re-run. + recheck = 1; \ + while ((rc = (getline line < ($$0 ".trs"))) != 0) \ + { \ + if (rc < 0) \ + { \ +## If we've encountered an I/O error here, there are three possibilities: +## +## [1] The '.log' file exists, but the '.trs' does not; in this case, +## we "gracefully" recover by assuming the corresponding test is +## to be re-run (which will re-create the missing '.trs' file). +## +## [2] Both the '.log' and '.trs' files are missing; this means that +## the corresponding test has not been run, and is thus *not* to +## be re-run. +## +## [3] We have encountered some corner-case problem (e.g., a '.log' or +## '.trs' files somehow made unreadable, or issues with a bad NFS +## connection, or whatever); we don't handle such corner cases. +## + if ((getline line2 < ($$0 ".log")) < 0) \ + recheck = 0; \ + break; \ + } \ + else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ +## A directive explicitly specifying the test is *not* to be re-run. + { \ + recheck = 0; \ + break; \ + } \ + else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ + { \ +## A directive explicitly specifying the test *is* to be re-run. + break; \ + } \ +## else continue with the next iteration. + }; \ + if (recheck) \ + print $$0; \ +## Don't leak open file descriptors, as this could cause serious +## problems when there are many tests (yes, even on Linux). + close ($$0 ".trs"); \ + close ($$0 ".log"); \ +}' + +# A command that, given a newline-separated list of test names on the +# standard input, create the global log from their .trs and .log files. +am__create_global_log = $(AWK) ' \ +## Don't leak open file descriptors, as this could cause serious +## problems when there are many tests (yes, even on Linux). +function close_current() \ +{ \ + close ($$0 ".trs"); \ + close ($$0 ".log"); \ +} \ +function error(msg) \ +{ \ + print msg | "cat >&2"; \ + exit_status = 1; \ +} \ +function input_error(file) \ +{ \ + error("awk" ": cannot read \"" file "\""); \ + close_current(); \ +} \ +function rst_section(header) \ +{ \ + print header; \ + len = length(header); \ + for (i = 1; i <= len; i = i + 1) \ + printf "="; \ + printf "\n\n"; \ +} \ +BEGIN { exit_status = 0; } \ +{ \ +## By default, we assume the test log is to be copied in the global log, +## and that its result is simply "RUN" (i.e., we still don't know what +## it outcome was, but we know that at least it has run). + copy_in_global_log = 1; \ + global_test_result = "RUN"; \ + while ((rc = (getline line < ($$0 ".trs"))) != 0) \ + { \ + if (rc < 0) \ + { \ + input_error($$0 ".trs"); \ + next; \ + } \ + if (line ~ /$(am__global_test_result_rx)/) \ + { \ + sub("$(am__global_test_result_rx)", "", line); \ + sub("[ ]*$$", "", line); \ + global_test_result = line; \ + } \ + else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ + copy_in_global_log = 0; \ + }; \ + if (copy_in_global_log) \ + { \ + rst_section(global_test_result ": " $$0); \ + while ((rc = (getline line < ($$0 ".log"))) != 0) \ + { \ + if (rc < 0) \ + { \ + input_error($$0 ".log"); \ + next; \ + } \ + print line; \ + }; \ + printf "\n"; \ + }; \ + close_current(); \ +} \ +END { \ + if (exit_status != 0) \ + error("fatal: making $@: I/O error reading test results"); \ + exit(exit_status); \ +}' + +# Restructured Text title. +am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } + +# This supports runtime overriding of $(TESTS) and $(XFAIL_TESTS). +am__test_bases = \ + $(call am__memoize,am__test_bases,$(call am__get_test_bases,$(TESTS))) +am__xfail_test_bases = \ + $(call am__memoize,am__xfail_test_bases,$(call am__get_test_bases,$(XFAIL_TESTS))) + +# The $(strip) is to work around the GNU make 3.80 bug where trailing +# whitespace in "TESTS = foo.test $(empty)" causes $(TESTS_LOGS) to +# erroneously expand to "foo.log .log". +am__test_results = \ + $(call am__memoize,am__test_results,$(addsuffix .trs,$(strip $(am__test_bases)))) +am__test_logs = \ + $(call am__memoize,am__test_logs,$(addsuffix .log,$(strip $(am__test_bases)))) + +am__mostlyclean_files += $(am__test_results) $(am__test_logs) + +# $(TEST_LOGS) is a published interface. +TEST_LOGS = $(am__test_logs) + +$(TEST_SUITE_LOG): $(am__test_logs) $(am__test_results) + @$(am__sh_e_setup); $(am__tty_colors); \ + fatal () { echo "fatal: making $@: $$*" >&2; exit 1; }; \ +## Detect a possible circular dependency, and error out. + case ' $(strip $(am__test_logs)) ' in *' $(TEST_SUITE_LOG) '*) \ + fatal "depends on itself (check TESTS content)";; \ + esac; \ + ws='[ ]'; \ + count_result () \ + { \ + r='$(strip $(am__test_results))'; \ + r=`grep "^$$ws*:test-result:$$ws*$${1-}" $$r &2; \ + exit 4; \ + fi; \ + shift; \ + desc=$$1 count=$$2; \ + if test $$maybe_colorize = yes && test $$count -gt 0; then \ + color_start=$$3 color_end=$$std; \ + else \ + color_start= color_end=; \ + fi; \ + echo "$${color_start}# $$desc $$count$${color_end}"; \ + }; \ +## A shell function that creates the testsuite summary. We need it +## because we have to create *two* summaries, one for test-suite.log, +## and a possibly-colorized one for console output. + create_testsuite_report () \ + { \ + opts=$$*; \ + display_result_count $$opts "TOTAL:" $$all "$$brg"; \ + display_result_count $$opts "PASS: " $$pass "$$grn"; \ + display_result_count $$opts "SKIP: " $$skip "$$blu"; \ + display_result_count $$opts "XFAIL:" $$xfail "$$lgn"; \ + display_result_count $$opts "FAIL: " $$fail "$$red"; \ + display_result_count $$opts "XPASS:" $$xpass "$$red"; \ + display_result_count $$opts "ERROR:" $$error "$$mgn"; \ + }; \ +## Write "global" testsuite log. + if { \ + st=0; \ + echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ + $(am__rst_title); \ + create_testsuite_report --no-color; \ + echo; \ + echo ".. contents:: :depth: 2"; \ + echo; \ + bases='$(am__test_bases)'; \ + for b in $$bases; do echo $$b; done \ + | $(am__create_global_log); \ + } >$(TEST_SUITE_LOG).tmp; then \ + mv -f $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ + else \ +## The awk program in $(am__create_global_log) should have already emitted +## a proper error message about I/O error, no need to repeat it. + rm -f $(TEST_SUITE_LOG).tmp; exit 1; \ + fi; \ +## Emit the test summary on the console. + if $$success; then \ + col="$$grn"; \ + else \ + col="$$red"; \ + test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ + fi; \ +## Multi line coloring is problematic with "less -R", so we really need +## to color each line individually. + echo "$${col}$$br$${std}"; \ + echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ + echo "$${col}$$br$${std}"; \ +## This is expected to go to the console, so it might have to be colorized. + create_testsuite_report --maybe-color; \ + echo "$$col$$br$$std"; \ + if $$success; then :; else \ + echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ + if test -n "$(PACKAGE_BUGREPORT)"; then \ + echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ + fi; \ + echo "$$col$$br$$std"; \ + fi; \ + $$success || exit 1 + +am__mostlyclean_files += $(TEST_SUITE_LOG) + +## ------------------------------------------ ## +## Running all tests, or rechecking failures. ## +## ------------------------------------------ ## + +am__remove_if_not_lazy_check = \ +## Expand the given list only once, to avoid exceeding line length limits. + $(if $(filter yes,$(AM_LAZY_CHECK)),, \ + list='$(strip $(1))'; test -z "$$list" || rm -f $$list) + +check-TESTS: + @$(call am__remove_if_not_lazy_check,$(am__test_results)) + @$(call am__remove_if_not_lazy_check,$(am__test_logs)) +## We always have to remove TEST_SUITE_LOG, to ensure its rule is run +## in any case even in lazy mode: otherwise, if no test needs rerunning, +## or a prior run plus reruns all happen within the same timestamp (can +## happen with a prior "make TESTS="), then we get no log output. +## OTOH, this means that, in the rule for '$(TEST_SUITE_LOG)', we +## cannot use '$?' to compute the set of lazily rerun tests, lest +## we rely on .PHONY to work portably. + @rm -f $(TEST_SUITE_LOG) + $(MAKE) $(TEST_SUITE_LOG) +.PHONY: check-TESTS + +## Recheck must depend on $(check_SCRIPTS), $(check_PROGRAMS), etc. +## It must also depend on the 'all' target. See automake bug#11252. ++## FIXME: this recipe should be fixed not to trip on automake ++## FIXME: bug#11791 anymore. +recheck: all %CHECK_DEPS% + @bases='$(am__test_bases)'; \ +## If running a "make recheck", we must only consider tests that had an +## unexpected outcome (FAIL or XPASS) in the earlier run. + bases=`for i in $$bases; do echo $$i; done \ + | $(am__list_recheck_tests)` || exit 1; \ +## Remove newlines and normalize whitespace. + bases=`echo $$bases`; \ + $(MAKE) check-TESTS am__test_bases="$$bases" +.PHONY: recheck + +AM_RECURSIVE_TARGETS += check recheck diff --cc syntax-checks.mk index 4ba176b64,052547ccc..3a525edec --- a/syntax-checks.mk +++ b/syntax-checks.mk @@@ -75,11 -62,15 +75,12 @@@ sc_tests_command_subst sc_tests_Exit_not_exit \ sc_tests_automake_fails \ sc_tests_required_after_defs \ -sc_tests_overriding_macros_on_cmdline \ sc_tests_plain_sleep \ sc_tests_ls_t \ + sc_tests_executable \ sc_m4_am_plain_egrep_fgrep \ -sc_tests_no_configure_in \ sc_tests_PATH_SEPARATOR \ sc_tests_logs_duplicate_prefixes \ -sc_tests_makefile_variable_order \ sc_perl_at_substs \ sc_unquoted_DESTDIR \ sc_tabs_in_texi \