From: Stefano Lattarini Date: Sat, 5 May 2012 09:12:27 +0000 (+0200) Subject: Merge branch 'master' into ng/master X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3cc7e84ead1ecbf1409604219a54093547b2d0a1;p=thirdparty%2Fautomake.git Merge branch 'master' into ng/master * master: (27 commits) maintcheck: avoid a couple of spurious failures maintcheck: reduce code duplication, increase coverage maintcheck: avoid a couple of spurious failures tests: avoid spurious failure on missing Obj C/C++ compiler dist: don't bother putting README first in $(DIST_COMMON) news: document improvement in parallel-tests performance tests: fix spurious failure due to autom4te caching objc, objc++: test support for compilation flags objc, objc++: add stress test objc, objc++: test automatic dependency tracking objc: reorganize basic tests objc++, objc: add first semantic tests objc++: add first basic test news: fix typos aclocal: error out again on unrecognized arguments cosmetics: fix typo in aclocal m4 directory README silent rules: support for them is always active now parallel-tests: save few forks when possible cygnus: remove support for Cygnus-style trees cygnus: warn when it's used (flagged as 'obsolete' now) ... Extra non-trivial edits: * t/parallel-tests-unreadable.sh: Adjust to new error message for I/O errors. * t/silent6.sh: In Automake-NG, there is no 'portability-recursive' warning category anymore. Adjust accordingly. * lib/am/check.am (am__create_global_log): Don't exit at the first I/O error, but report as much as possible of them. If we don't do so, the test 't/parallel-tests-unreadable.sh' starts failing. Signed-off-by: Stefano Lattarini --- 3cc7e84ead1ecbf1409604219a54093547b2d0a1 diff --cc automake.in index 0a6b06902,9c632e2ef..7af3fecf6 --- a/automake.in +++ b/automake.in @@@ -4505,28 -4567,21 +4498,18 @@@ sub do_check_merge_target ( push @check_tests, 'check-local' if user_phony_rule 'check-local'; - # In --cygnus mode, check doesn't depend on all. - if (option 'cygnus') - { - # Just run the local check rules. - pretty_print_rule ('check-am:', "\t\t", @check); - } - else + # The check target must depend on the local equivalent of + # 'all', to ensure all the primary targets are built. Then it + # must build the local check rules. + $output_rules .= "check-am: all-am\n"; + if (@check) { - # The check target must depend on the local equivalent of - # 'all', to ensure all the primary targets are built. Then it - # must build the local check rules. - $output_rules .= "check-am: all-am\n"; - if (@check) - { - pretty_print_rule ("\t\$(MAKE)", "\t ", - @check); - } - pretty_print_rule ("\t\$(MAKE) \$(AM_MAKEFLAGS)", "\t ", @check); - depend ('.MAKE', 'check-am'); ++ pretty_print_rule ("\t\$(MAKE)", "\t ", @check); } + if (@check_tests) { - pretty_print_rule ("\t\$(MAKE)", "\t ", - pretty_print_rule ("\t\$(MAKE) \$(AM_MAKEFLAGS)", "\t ", -- @check_tests); - depend ('.MAKE', 'check-am'); ++ pretty_print_rule ("\t\$(MAKE)", "\t ", @check_tests); } depend '.PHONY', 'check', 'check-am'; diff --cc lib/am/check.am index 05264c6c0,522c9536c..f158e1611 --- a/lib/am/check.am +++ b/lib/am/check.am @@@ -57,18 -59,112 +57,137 @@@ if %?PARALLEL_TESTS ## of more test metadata, and the use of custom test derivers and protocols ## (among them, TAP). +# 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) +# Removing the '$(srcdir)' in there would cause the idiom to break in +# VPATH builds. +am__cooked_tests = $(patsubst $(srcdir)/%,%,$(strip $(TESTS))) +am__cooked_xfail_tests = $(patsubst $(srcdir)/%,%,$(strip $(XFAIL_TESTS))) + - # Restructured Text title and section. + 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) ' \ -function fatal(msg) \ ++## Don't leak open file descriptors, as this could cause serious ++## problems when there are many tests (yes, even on Linux). ++function close_current() \ + { \ - print "fatal: making $@: " msg | "cat >&2"; \ - exit 1; \ ++ 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(); \ ++ next; \ + } \ + 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) \ - fatal("failed to read from " $$0 ".trs"); \ ++ input_error($$0 ".trs"); \ + 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) \ - fatal("failed to read from " $$0 ".log"); \ ++ input_error($$0 ".log"); \ + print line; \ + }; \ + }; \ -## 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"); \ ++ 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; } - am__rst_section = { sed 'p;s/./=/g;' && echo; } # Solaris 10 'make', and several other traditional 'make' implementations, # pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it @@@ -206,32 -355,10 +325,16 @@@ $(TEST_SUITE_LOG): $(TEST_LOGS) $(am__T echo; \ echo ".. contents:: :depth: 2"; \ echo; \ - bases='$(am__TEST_BASES)'; for i in $$bases; do \ - ## FIXME: one fork per test -- this is horrendously inefficient! - if grep "^$$ws*:copy-in-global-log:$$ws*no$$ws*$$" $$i.trs \ - >/dev/null; then continue; \ - fi; \ - ## Get the declared "global result" of the test. - ## FIXME: yet another one fork per test here! - glob_res=`sed -n -e "s/$$ws*$$//" \ - -e "s/^$$ws*:global-test-result:$$ws*//p" \ - $$i.trs`; \ - ## If no global result is explicitly declared, we'll merely mark the - ## test as "RUN" in the global test log. - test -n "$$glob_res" || glob_res=RUN; \ - ## Write the name and result of the test as an RST section title. - echo "$$glob_res: $$i" | $(am__rst_section); \ - ## Register any failure in reading test logs, to report an error later. - cat $$i.log || st=1; \ - echo; \ - done; \ - test $$st -eq 0; \ - } >$(TEST_SUITE_LOG).tmp; then \ - mv -f $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ - else \ - rm -f $(TEST_SUITE_LOG).tmp; \ - fatal "I/O error reading test logs"; \ - fi; \ ++ bases='$(am__TEST_BASES)'; \ + for b in $$bases; do echo $$b; done \ + | $(am__create_global_log); \ - } >$(TEST_SUITE_LOG).tmp || exit 1; \ - mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_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"; \ @@@ -284,22 -417,22 +387,17 @@@ check-TESTS recheck ## cannot use '$?' to compute the set of lazily rerun tests, lest ## we rely on .PHONY to work portably. @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) - @ws='[ ]'; \ - log_list='' trs_list=''; bases='$(am__TEST_BASES)'; \ - for i in $$bases; do \ - @$(am__set_TESTS_bases); \ ++ @bases='$(am__TEST_BASES)'; \ + if test $@ = recheck; then \ ## If running a "make recheck", we must only consider tests that had an - ## unexpected outcome (FAIL or XPASS) in the earlier run. In particular, - ## skip tests that haven't been run. But recover gracefully from deleted - ## '.trs' files. - if test $@ = recheck; then \ - test -f $$i.trs || test -f $$i.log || continue; \ - ## FIXME: one fork per test -- this is horrendously inefficient! - grep "^$$ws*:recheck:$$ws*no$$ws*$$" $$i.trs \ - >/dev/null 2>&1 && continue; \ - else :; fi; \ - log_list="$$log_list $$i.log"; \ - trs_list="$$trs_list $$i.trs"; \ - done; \ + ## unexpected outcome (FAIL or XPASS) in the earlier run. + bases=`for i in $$bases; do echo $$i; done \ + | $(am__list_recheck_tests)` || exit 1; \ + fi; \ + log_list=`for i in $$bases; do echo $$i.log; done`; \ + trs_list=`for i in $$bases; do echo $$i.trs; done`; \ -## Remove newlines and normalize whitespace, being careful to avoid extra -## whitespace in the definition of $log_list, since its value will be -## passed to the recursive make invocation below through the TEST_LOGS -## macro, and leading/trailing white space in a make macro definition can -## be problematic. In this particular case, trailing white space is known -## to have caused segmentation faults on Solaris 10 XPG4 make: ++## Remove newlines and normalize whitespace. + log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ ## Under "make recheck", remove the .log and .trs files associated ## with the files to recheck, so that those will be rerun by the ## "make test-suite.log" recursive invocation below. But use a proper diff --cc syntax-checks.mk index 86bd352e2,bac6c7bba..10e1fcf9a --- a/syntax-checks.mk +++ b/syntax-checks.mk @@@ -38,9 -38,10 +38,10 @@@ ams := $(shell find $(srcdir) -name '*. # Some simple checks, and then ordinary check. These are only really # guaranteed to work on my machine. syntax_check_rules = \ + $(sc_tests_plain_check_rules) \ sc_test_names \ sc_diff_automake_in_automake \ -sc_diff_aclocal_in_automake \ +sc_diff_aclocal_in_aclocal \ sc_perl_syntax \ sc_no_brace_variable_expansions \ sc_rm_minus_f \ @@@ -54,32 -55,15 +55,23 @@@ sc_cd_relative_dir sc_perl_at_uscore_in_scalar_context \ sc_perl_local \ sc_AMDEP_TRUE_in_automake_in \ -sc_tests_make_without_am_makeflags \ +sc_tests_no_gmake_requirement \ +sc_tests_no_gmake_checking \ +sc_tests_make_can_chain_suffix_rules \ +sc_tests_make_dont_do_useless_vpath_rebuilds \ +sc_no_dotmake_target \ +sc_no_am_makeflags \ +sc_tests_no_make_e \ +sc_docs_no_make_e \ +sc_make_simple_include \ +sc_tests_make_simple_include \ sc_tests_obsolete_variables \ - sc_tests_plain_make \ - sc_tests_plain_autoconf \ - sc_tests_plain_autoupdate \ - sc_tests_plain_automake \ - sc_tests_plain_autom4te \ - sc_tests_plain_autoheader \ - sc_tests_plain_autoreconf \ sc_tests_here_document_format \ sc_tests_Exit_not_exit \ sc_tests_automake_fails \ - sc_tests_plain_aclocal \ - sc_tests_plain_perl \ sc_tests_required_after_defs \ -sc_tests_overriding_macros_on_cmdline \ sc_tests_plain_sleep \ - sc_tests_plain_egrep_fgrep \ + sc_m4_am_plain_egrep_fgrep \ sc_tests_no_configure_in \ sc_tests_PATH_SEPARATOR \ sc_tests_logs_duplicate_prefixes \ @@@ -631,3 -524,11 +585,7 @@@ sc_at_in_texi echo 'Unescaped @.' 1>&2; \ exit 1; \ fi + + $(syntax_check_rules): automake aclocal + maintainer-check: $(syntax_check_rules) + .PHONY: maintainer-check $(syntax_check_rules) - -## Check that the list of tests given in the Makefile is equal to the -## list of all test scripts in the Automake testsuite. -maintainer-check: maintainer-check-list-of-tests diff --cc t/parallel-tests-unreadable.sh index 02b711d9b,7ddb9db5b..6bc9fba9f --- a/t/parallel-tests-unreadable.sh +++ b/t/parallel-tests-unreadable.sh @@@ -50,54 -52,25 +50,57 @@@ $AUTOMAKE - ./configure -for files in \ - 'foo.log bar.log' \ - 'foo.trs bar.trs' \ - 'foo.trs bar.log' \ - 'foo.log bar.trs' \ -; do +doit () +{ + rm -f $* $MAKE check rm -f test-suite.log - chmod a-r $files - $MAKE test-suite.log || { ls -l; Exit 1; } - ls -l - grep '^foofoofoo$' foo.log - grep '^:test-result: PASS' foo.trs - grep '^barbarbar$' bar.log - grep '^:test-result: SKIP' bar.trs - grep '^SKIP: bar' test-suite.log - grep '^barbarbar$' test-suite.log - $EGREP ':.*foo|foofoofoo' test-suite.log && Exit 1 - : For shells with busted 'set -e'. + chmod a-r $* + $MAKE test-suite.log 2>stderr && { cat stderr >&2; Exit 1; } + cat stderr >&2 +} + +could_not_read () +{ + # We have to settle for weak checks to avoid spurious failures due to + # the differences in error massages on different systems; for example: + # + # $ cat unreadable-file # GNU/Linux or NetBSD + # cat: unreadable-file: Permission denied + # $ cat unreadable-file # Solaris 10 + # cat: cannot open unreadable + # + # $ grep foo unreadable-file # GNU/Linux and NetBSD + # grep: unreadable: Permission denied + # $ grep foo unreadable-file # Solaris 10 + # grep: can't open "unreadable" + # ++ # Plus, we must cater to error messages displayed by our own awk ++ # script: "cannot read "unreadable"". ++ # + # FIXME: this might still needs adjustments on other systems ... + # + grep "$1:.*[pP]ermission denied" stderr \ - || $EGREP "can(no|')t open [\"'\`]?$1" stderr ++ || $EGREP "can(no|')t (open|read) [\"'\`]?$1" stderr +} + +for lst in bar.log 'foo.log bar.log'; do + doit $lst + could_not_read bar.log - grep 'test-suite\.log:.* I/O error reading test logs' stderr ++ grep 'test-suite\.log:.* I/O error reading test results' stderr done +doit foo.trs +could_not_read foo.trs +grep 'test-suite\.log:.* I/O error reading test results' stderr + +doit foo.trs bar.trs +could_not_read foo.trs +could_not_read bar.trs +grep 'test-suite\.log:.* I/O error reading test results' stderr + +doit foo.trs bar.log +could_not_read foo.trs +grep 'test-suite\.log:.* I/O error reading test results' stderr + :