automake-ng
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Automake-NG] [PATCH 08/17] [ng] check: warn about invalid TEST_EXTENSIO


From: Stefano Lattarini
Subject: [Automake-NG] [PATCH 08/17] [ng] check: warn about invalid TEST_EXTENSIONS at make runtime
Date: Tue, 22 May 2012 22:48:46 +0200

* 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 <address@hidden>
---
 automake.in              |   11 ++++-------
 lib/am/parallel-tests.am |    6 ++++++
 lib/am/serial-tests.am   |    1 +
 t/test-extensions.sh     |   19 ++++++++++---------
 4 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/automake.in b/automake.in
index 032d70b..db0fe58 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 fc33bff..d0fcebb 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 b6a7184..af5e7b5 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 481d1e3..b2e037f 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@ 
address@hidden@
+TEST_EXTENSIONS  = .test mu .x-y a-b .t.1 .sh .6c .0 .11
 TEST_EXTENSIONS += .= .t33 address@hidden _&_
 END
 
-AUTOMAKE_fails
-for suf in mu .x-y a-b .t.1 .6c .0 .11  @suf@ address@hidden@ '.=' '_&_'; 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
 
 :
-- 
1.7.9.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]