From: Stefano Lattarini Date: Mon, 21 May 2012 23:37:28 +0000 (+0200) Subject: [ng] check: warn about invalid TEST_EXTENSIONS at make runtime X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9c259ea642d885b8a6b5f3414e7e0016752b9c91;p=thirdparty%2Fautomake.git [ng] check: warn about invalid TEST_EXTENSIONS at make runtime * automake.in (handle_tests): Instead of warning about invalid test extensions at Automake runtime, pass their list through the transform '%INVALID_TEST_EXTENSIONS%' to ... * lib/am/parallel-tests.am: ... this file, that will warn at make runtime if that list is not empty. Signed-off-by: Stefano Lattarini --- diff --git a/automake.in b/automake.in index 032d70b55..db0fe586b 100644 --- a/automake.in +++ b/automake.in @@ -4654,17 +4654,14 @@ sub handle_tests "'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"; - } + my @invalid_test_suffixes = grep { !is_valid_test_extension $_ } + @test_suffixes; @test_suffixes = grep { is_valid_test_extension $_ } @test_suffixes; $output_rules .= file_contents ('parallel-tests', new Automake::Location, COLOR => !! option 'color-tests', - CHECK_DEPS => "@check"); + CHECK_DEPS => "@check", + INVALID_TEST_EXTENSIONS => "@invalid_test_suffixes"); # 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 diff --git a/lib/am/parallel-tests.am b/lib/am/parallel-tests.am index fc33bff05..d0fcebbf8 100644 --- a/lib/am/parallel-tests.am +++ b/lib/am/parallel-tests.am @@ -25,6 +25,12 @@ include color-tests.am ## of more test metadata, and the use of custom test derivers and protocols ## (among them, TAP). +am__invalid_test_extensions = %INVALID_TEST_EXTENSIONS% +$(if $(am__invalid_test_extensions), \ + $(foreach am__e, $(am__invalid_test_extensions), \ + $(warning invalid test extension: '$(am__e)')) \ + $(error invalid test extensions have been encountered)) + # The names of the given tests scripts with any possible registered # test extension removed, as well as any leading '$(srcdir)' component # (if any) stripped. diff --git a/lib/am/serial-tests.am b/lib/am/serial-tests.am index b6a718460..af5e7b551 100644 --- a/lib/am/serial-tests.am +++ b/lib/am/serial-tests.am @@ -34,6 +34,7 @@ endif !%?HANDLE-EXEEXT% am__cooked_tests = $(call am__check_cook_with_exeext, $(TESTS)) am__cooked_xfail_tests = $(call am__check_cook_with_exeext, $(XFAIL_TESTS)) +.PHONY: check-TESTS check-TESTS: $(am__cooked_tests) @failed=0; all=0; xfail=0; xpass=0; skip=0; \ srcdir=$(srcdir); export srcdir; \ diff --git a/t/test-extensions.sh b/t/test-extensions.sh index 481d1e35c..b2e037f7f 100755 --- a/t/test-extensions.sh +++ b/t/test-extensions.sh @@ -47,24 +47,25 @@ done # The produced Makefile is not broken. ./configure $MAKE all check +$MAKE distclean cat > Makefile.am << 'END' TESTS = foo.test bar.sh -TEST_EXTENSIONS = .test mu .x-y a-b .t.1 .sh .6c .0 .11 .= @suf@ .@ext@ +TEST_EXTENSIONS = .test mu .x-y a-b .t.1 .sh .6c .0 .11 TEST_EXTENSIONS += .= .t33 .a@b _&_ END -AUTOMAKE_fails -for suf in mu .x-y a-b .t.1 .6c .0 .11 @suf@ .@ext@ '.=' '_&_'; do - suf2=`printf '%s\n' "$suf" | sed -e 's/\./\\./'` - $EGREP "^Makefile\.am:2:.*invalid test extension.* $suf2( |$)" stderr +$AUTOMAKE +./configure + +$MAKE 2>stderr && { cat stderr >&2; Exit 1; } +cat stderr >&2 +for suf in mu .x-y a-b .t.1 .6c .0 .11 '.=' '_&_'; do + $FGREP "invalid test extension: '$suf'" stderr done # Verify that we accept valid suffixes, even if intermixed with # invalid ones. -$EGREP '\.(sh|test|t33)' stderr && Exit 1 - -# Verify that we don't try to handle invalid suffixes. -$EGREP '(LOG_COMPILER|non-POSIX var|bad character)' stderr && Exit 1 +$EGREP 'invalid.*\.(sh|test|t33)' stderr && Exit 1 :