From: Stefano Lattarini Date: Tue, 24 Jul 2012 22:14:09 +0000 (+0200) Subject: Merge branch 'master' into ng/master X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e3d6f0427bec781d524aa43ad058748d0fe8ea3b;p=thirdparty%2Fautomake.git Merge branch 'master' into ng/master * master: tests: avoid non-textual output in a '.log' file tags: refactor to reduce code duplication (2) tags: refactor to reduce code duplication (1) tests: better name for a couple of tests check: support colorized testsuite output by default tags: unify recursion for tags targets with that of "usual" targets + Extra non-trivial edits: * automake.in (handle_tests): Drop the '%COLOR%' transform in the processing of both 'serial-tests.am' and 'parallel-tests.am', which have superseded the 'check.am' from mainline Automake. * lib/am/color-tests.am: Remove use of the '%?COLOR%' transform; just act as if it were unconditionally TRUE. (am__tty_colors_dummy): Merge into ... (am__tty_colors): ... this. Signed-off-by: Stefano Lattarini --- e3d6f0427bec781d524aa43ad058748d0fe8ea3b diff --cc automake.in index 2d268eb59,48ece7fe2..17ec3ab7c --- a/automake.in +++ b/automake.in @@@ -3193,70 -3611,30 +3195,30 @@@ sub handle_tag } } - define_variable ('am__tagged_files', - '$(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)' - . "@config", INTERNAL); + define_variable ('am__tagged_files', INTERNAL, + qw/$(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)/, + @config); - my @tag_deps = (); - my @ctag_deps = (); - my @cscope_deps = (); - if (var ('SUBDIRS')) - { - $output_rules .= ("tags-recursive:\n" - . "\tlist='\$(SUBDIRS)'; for subdir in \$\$list; do \\\n" - # Never fail here if a subdir fails; it - # isn't important. - . "\t test \"\$\$subdir\" = . || (cd \$\$subdir" - . " && \$(MAKE) tags); \\\n" - . "\tdone\n"); - push (@tag_deps, 'tags-recursive'); - &depend ('.PHONY', 'tags-recursive'); - - $output_rules .= ("ctags-recursive:\n" - . "\tlist='\$(SUBDIRS)'; for subdir in \$\$list; do \\\n" - # Never fail here if a subdir fails; it - # isn't important. - . "\t test \"\$\$subdir\" = . || (cd \$\$subdir" - . " && \$(MAKE) ctags); \\\n" - . "\tdone\n"); - push (@ctag_deps, 'ctags-recursive'); - &depend ('.PHONY', 'ctags-recursive'); - - $output_rules .= ("cscopelist-recursive:\n" - . "\tlist='\$(SUBDIRS)'; for subdir in \$\$list; do \\\n" - # Never fail here if a subdir fails; it - # isn't important. - . "\t test \"\$\$subdir\" = . || (cd \$\$subdir" - . " && \$(MAKE) cscopelist); \\\n" - . "\tdone\n"); - push (@cscope_deps, 'cscopelist-recursive'); - &depend ('.PHONY', 'cscopelist-recursive'); - } - if (rvar('am__tagged_files')->value_as_list_recursive - || var ('ETAGS_ARGS') || @tag_deps) - { - $output_rules .= &file_contents ('tags', - new Automake::Location, - TAGSDIRS => "@tag_deps", - CTAGSDIRS => "@ctag_deps", - CSCOPEDIRS => "@cscope_deps"); - } - elsif (reject_var ('TAGS_DEPENDENCIES', - "it doesn't make sense to define 'TAGS_DEPENDENCIES'" - . " without\nsources or 'ETAGS_ARGS'")) - { - } + || var ('ETAGS_ARGS') || var ('SUBDIRS')) + { + $output_rules .= &file_contents ('tags', new Automake::Location); + set_seen 'TAGS_DEPENDENCIES'; + } else - { + { + reject_var ('TAGS_DEPENDENCIES', + "it doesn't make sense to define 'TAGS_DEPENDENCIES'" + . " without\nsources or 'ETAGS_ARGS'"); # Every Makefile must define some sort of TAGS rule. # Otherwise, it would be possible for a top-level "make TAGS" - # to fail because some subdirectory failed. - $output_rules .= "tags: TAGS\nTAGS:\n\n"; - # Ditto ctags and cscope. - $output_rules .= "ctags: CTAGS\nCTAGS:\n\n"; - $output_rules .= "cscope cscopelist:\n\n"; - } + # to fail because some subdirectory failed. Ditto ctags and + # cscope. + $output_rules .= + "tags TAGS:\n\n" . + "ctags CTAGS:\n\n" . + "cscope cscopelist:\n\n"; + } } @@@ -4140,22 -4821,117 +4102,20 @@@ sub handle_test if (var ('TESTS')) { push (@check_tests, 'check-TESTS'); - my $check_deps = "@check"; - $output_rules .= &file_contents ('check', new Automake::Location, - SERIAL_TESTS => !! option 'serial-tests', - CHECK_DEPS => $check_deps); - - # Tests that are known programs should have $(EXEEXT) appended. - # For matching purposes, we need to adjust XFAIL_TESTS as well. - append_exeext { exists $known_programs{$_[0]} } 'TESTS'; - append_exeext { exists $known_programs{$_[0]} } 'XFAIL_TESTS' - if (var ('XFAIL_TESTS')); - - if (! option 'serial-tests') - { - define_variable ('TEST_SUITE_LOG', 'test-suite.log', INTERNAL); - my $suff = '.test'; - my $at_exeext = ''; - my $handle_exeext = exists $configure_vars{'EXEEXT'}; - if ($handle_exeext) - { - $at_exeext = subst ('EXEEXT'); - $suff = $at_exeext . ' ' . $suff; - } - if (! var 'TEST_EXTENSIONS') - { - define_variable ('TEST_EXTENSIONS', $suff, INTERNAL); - } - my $var = var 'TEST_EXTENSIONS'; - # Currently, we are not able to deal with conditional contents - # in TEST_EXTENSIONS. - if ($var->has_conditional_contents) - { - msg_var 'unsupported', $var, - "'TEST_EXTENSIONS' cannot have conditional contents"; - } - my @test_suffixes = $var->value_as_list_recursive; - if ((my @invalid_test_suffixes = - grep { !is_valid_test_extension $_ } @test_suffixes) > 0) - { - error $var->rdef (TRUE)->location, - "invalid test extensions: @invalid_test_suffixes"; - } - @test_suffixes = grep { is_valid_test_extension $_ } @test_suffixes; - if ($handle_exeext) - { - unshift (@test_suffixes, $at_exeext) - unless $test_suffixes[0] eq $at_exeext; - } - unshift (@test_suffixes, ''); - - transform_variable_recursively - ('TESTS', 'TEST_LOGS', 'am__testlogs', 1, INTERNAL, - sub { - my ($subvar, $val, $cond, $full_cond) = @_; - my $obj = $val; - return $obj - if $val =~ /^\@.*\@$/; - $obj =~ s/\$\(EXEEXT\)$//o; - - if ($val =~ /(\$\((top_)?srcdir\))\//o) - { - msg ('error', $subvar->rdef ($cond)->location, - "using '$1' in TESTS is currently broken: '$val'"); - } - foreach my $test_suffix (@test_suffixes) - { - next - if $test_suffix eq $at_exeext || $test_suffix eq ''; - return substr ($obj, 0, length ($obj) - length ($test_suffix)) . '.log' - if substr ($obj, - length ($test_suffix)) eq $test_suffix; - } - my $base = $obj; - $obj .= '.log'; - handle_per_suffix_test ('', - OBJ => $obj, - BASE => $base, - SOURCE => $val); - return $obj; - }); - - my $nhelper=1; - my $prev = 'TESTS'; - my $post = ''; - my $last_suffix = $test_suffixes[$#test_suffixes]; - my $cur = ''; - foreach my $test_suffix (@test_suffixes) - { - if ($test_suffix eq $last_suffix) - { - $cur = 'TEST_LOGS'; - } - else - { - $cur = 'am__test_logs' . $nhelper; - } - define_variable ($cur, - '$(' . $prev . ':' . $test_suffix . $post . '=.log)', INTERNAL); - $post = '.log'; - $prev = $cur; - $nhelper++; - if ($test_suffix ne $at_exeext && $test_suffix ne '') - { - handle_per_suffix_test ($test_suffix, - OBJ => '', - BASE => '$*', - SOURCE => '$<'); - } - } - $clean_files{'$(TEST_LOGS)'} = MOSTLY_CLEAN; - $clean_files{'$(TEST_LOGS:.log=.trs)'} = MOSTLY_CLEAN; - $clean_files{'$(TEST_SUITE_LOG)'} = MOSTLY_CLEAN; + if (option 'serial-tests') + { + $output_rules .= + file_contents ('serial-tests', new Automake::Location, - COLOR => !! option 'color-tests', + CHECK_DEPS => "@check"); + } + else + { + define_variable ('TEST_SUITE_LOG', INTERNAL, 'test-suite.log'); + require_conf_file ("parallel-tests", FOREIGN, 'test-driver'); + $output_rules .= + file_contents ('parallel-tests', new Automake::Location, - COLOR => !! option 'color-tests', + CHECK_DEPS => "@check"); } } } diff --cc lib/am/color-tests.am index db91049ac,000000000..d2e2a7dfd mode 100644,000000..100644 --- a/lib/am/color-tests.am +++ b/lib/am/color-tests.am @@@ -1,45 -1,0 +1,41 @@@ +## 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 . + - am__tty_colors_dummy = \ - mgn= red= grn= lgn= blu= brg= std=; \ - am__color_tests=no - if %?COLOR% +am__tty_colors = { \ - $(am__tty_colors_dummy); \ + if test "X$(AM_COLOR_TESTS)" = Xno; then \ + am__color_tests=no; \ + elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ + am__color_tests=yes; \ +## If stdout is a non-dumb tty, use colors. If test -t is not supported, +## then this check fails; a conservative approach. Of course do not +## redirect stdout here, just stderr. + elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ + am__color_tests=yes; \ ++ else \ ++ am__color_tests=no; \ + fi; \ + if test $$am__color_tests = yes; then \ + red=''; \ + grn=''; \ + lgn=''; \ + blu=''; \ + mgn=''; \ + brg=''; \ + std=''; \ ++ else \ ++ mgn= red= grn= lgn= blu= brg= std=; \ + fi; \ +} - else !%?COLOR% - am__tty_colors = $(am__tty_colors_dummy) - endif !%?COLOR% diff --cc lib/am/tags.am index 2abd56303,730ccc511..1db4139a0 --- a/lib/am/tags.am +++ b/lib/am/tags.am @@@ -141,17 -142,19 +142,19 @@@ AM_RECURSIVE_TARGETS += cscop cscope: cscope.files test ! -s cscope.files \ || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) - clean-cscope: - -rm -f cscope.files + rm -f cscope.files - - cscope.files: clean-cscope %CSCOPEDIRS% cscopelist - + cscope.files: clean-cscope cscopelist endif %?TOPDIR_P% - .PHONY: cscopelist - cscopelist: %CSCOPEDIRS% $(am__tagged_files) + if %?SUBDIRS% + RECURSIVE_TARGETS += cscopelist-recursive + cscopelist: cscopelist-recursive + else !%?SUBDIRS% + cscopelist: cscopelist-am + endif !%?SUBDIRS% + + cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ diff --cc t/color-tests2.sh index 18734c96d,65ca6c72f..f8bd85b3a --- a/t/color-tests2.sh +++ b/t/color-tests2.sh @@@ -33,9 -33,35 +33,12 @@@ std="$esc\[m (set +e; expect -c 'exit 77'; test $? -eq 77) \ || skip_ "requires a working expect program" -# Also, if the $MAKE program fails to consider the standard output as a -# tty (this happens with e.g., BSD make and Solaris dmake when they're -# run in parallel mode; see the autoconf manual), there is little point -# in proceeding. -cat > Makefile <<'END' -all: -## Creative quoting in the 'echo' below to avoid risk of spurious output -## matches by 'expect', below. - @test -t 1 && echo "stdout" "is" "a" "tty" -END - -cat > expect-check <<'END' -eval spawn $env(MAKE) -expect { - "stdout is a tty" { exit 0 } - default { exit 1 } -} -exit 1 -END -MAKE=$MAKE expect -f expect-check \ - || skip_ "make spawned by expect should have a tty stdout" -rm -f expect-check Makefile - # Do the tests. - cat >>configure.ac <>configure.ac << 'END' + if $testsuite_colorized; then :; else + AC_SUBST([AM_COLOR_TESTS], [no]) + fi AC_OUTPUT END diff --cc t/maken3.sh index b1875cbe1,5f5d87a1b..5dbe7d23a --- a/t/maken3.sh +++ b/t/maken3.sh @@@ -17,10 -17,12 +17,10 @@@ # Test 'make -n' for various targets, to ensure that: # # 1. no files or directories are created or removed, and -# -# 2. if using GNU make or a make implementation supporting the .MAKE -# special target, the output from make is sufficiently complete. +# 2. the output from make is sufficiently complete. # # This test exercises the GCS-mandated targets (except for dist) - # as well as tags, TAGS. + # as well as tags. # For gen-testsuite-part: ==> try-with-serial-tests <== . ./defs || exit 1 @@@ -130,9 -145,11 +128,9 @@@ check_targets ( $MAKE -n $target >stdout || { cat stdout; exit 1; } cat stdout case $target in - install-* | installdirs | tags | TAGS ) ;; + install-* | installdirs | tags ) ;; *) - if $have_dotmake; then - grep "stamp-$target$" stdout || exit 1 - fi + grep "stamp-$target$" stdout || exit 1 test ! -e "stamp-$target" || exit 1 ;; esac diff --cc t/tap-realtime.sh index e3cac34c1,97b035c37..662105386 --- a/t/tap-realtime.sh +++ b/t/tap-realtime.sh @@@ -34,9 -34,28 +34,11 @@@ expect -f expect-check || } rm -f expect-check -# Unfortunately, some make implementations (among them, FreeBSD make, -# NetBSD make, and Solaris Distributed make), when run in parallel mode, -# serialize the output from their targets' recipes unconditionally. In -# such a situation, there's no way the partial results of a TAP test can -# be displayed until the test has terminated. And this is not something -# our TAP driver script can work around; in fact, the driver *is* sending -# out its output progressively and "in sync" with test execution -- it is -# make that is stowing such output away instead of presenting it to the -# user as soon as it gets it. -if ! using_gmake; then - case $MAKE in - *\ -j*) skip_ "doesn't with non-GNU concurrent make";; - esac - # Prevent Sun Distributed Make from trying to run in parallel. - DMAKE_MODE=serial; export DMAKE_MODE -fi - cat > Makefile.am << 'END' TESTS = all.test + AM_COLOR_TESTS= no END + . "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh" cat > all.test <<'END'