automake-patches
[Top][All Lists]
Advanced

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

Re: [PATCH 1/2] tests: make test runner a script, not a shell function


From: Stefano Lattarini
Subject: Re: [PATCH 1/2] tests: make test runner a script, not a shell function
Date: Tue, 21 Jun 2011 13:55:12 +0200
User-agent: KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; )

On Monday 20 June 2011, Stefano Lattarini wrote:
>
> [SNIP]
>
> To quote from the added NEWS entry:
> 
>   - The parallel-tests driver is now implemented (partly at least) with
>     the help of automake-provided auxiliary scripts (e.g., `test-driver'),
>     instead of relying entirely on code in the generated Makefile.in.
>     This has two noteworthy implications.  The first one is that projects
>     using the `parallel-tests' option should now either run automake with
>     the `--add-missing' option, or manually copy the `test-driver' script
>     into their tree.  The second, and more important, implication is that
>     now shell functions and non-environmental shell variables defined in
>     TESTS_ENVIRONMENT are not anymore available in LOG_COMPILER and
>     <ext>_LOG_COMPILER.
>
Well, no, this is not correct.  The real important "second implication"
here is that one cannot put test runners in TESTS_ENVIRONMENT anymore (and
this is what had broken coreutils' testsuite), nor use shell functions or
generic shell code as LOG_COMPILER.  But stuff set in TESTS_ENVIRONMENT,
even if not exported, can still be used in LOG_COMPILER and LOG_FLAGS.
This is a nice feature to have indeed, and one we shouldn't break; I'll
thus fix the NEWS entry accordingly, and add the attached test to master,
to ensure that we don't break that feature.

Here is what I plan to squash in to NEWS:

-*-*-*-

diff --git a/NEWS b/NEWS
index 394f6b2..939f79c 100644
--- a/NEWS
+++ b/NEWS
@@ -20,12 +20,37 @@ New in 1.11a:
     using the `parallel-tests' option should now either run automake with
     the `--add-missing' option, or manually copy the `test-driver' script
     into their tree.  The second, and more important, implication is that
-    now shell functions and non-environmental shell variables defined in
-    TESTS_ENVIRONMENT are not anymore available in LOG_COMPILER and
-    <ext>_LOG_COMPILER.  For example, it is now no more possible to define
-    a shell function, say `custom_test_runner', in TESTS_ENVIRONMENT, and
-    then setting "LOG_COMPILER = custom_test_runner" in the Makefile.am in
-    oder to use that function to run the tests.
+    now, when the `parallel-tests' option is in use, TESTS_ENVIRONMENT can
+    not be used anymore to define a test runner, and the command specified
+    in LOG_COMPILER (and <ext>_LOG_COMPILER) must be a *real* executable
+    program or script.  For example, this is still a valid usage (albeit
+    a little contorted):
+
+      TESTS_ENVIRONMENT = \
+        if test -n '$(STRICT_TESTS)'; then \
+          maybe_errexit='-e'; \
+        else \
+          maybe_errexit=''; \
+        fi;
+      LOG_COMPILER = $(SHELL) $$maybe_errexit
+
+    while this is not anymore:
+
+      TESTS_ENVIRONMENT = \
+        $(SHELL) `test -n '$(STRICT_TESTS_CHECKING)' && echo ' -e'`
+
+    neither is this:
+
+      TESTS_ENVIRONMENT = \
+        run_with_perl_or_shell () \
+        { \
+          if grep -q '^#!.*perl' $$1; then 
+            $(PERL) $$1; \
+          else \
+            $(SHELL) $$1; \
+          fi; \
+        }
+      LOG_COMPILER = run_with_per_or_shell
 
 * WARNING: Future backward-incompatibilities!
 
-*-*-*-

A similar improvement to the manual will have to follow, of course.

Thanks, and sorry for the noise,
  Stefano

Attachment: tests-environment-and-log-compiler.test
Description: application/shellscript


reply via email to

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