From: Ralf Wildenhues Date: Sat, 4 Apr 2009 10:14:14 +0000 (+0200) Subject: parallel-tests: LOG_COMPILER for tests without known extension. X-Git-Tag: v1.11~32^2~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8085398209424be5a3c9e760d62d9c9f90aa06c1;p=thirdparty%2Fautomake.git parallel-tests: LOG_COMPILER for tests without known extension. * automake.in (handle_tests): If we don't match a known extension, define `LOG_COMPILER' as `$(LOG_COMPILE) $(AM_LOG_FLAGS) $(LOG_FLAGS)' and use it as %COMPILE% in check2. * doc/automake.texi (Simple Tests using parallel-tests): Document it. In the examples, suggest using the AM_*LOG_FLAGS flags in Makefile.am rather than the variables without `AM_' prefix. * lib/Automake/tests/Makefile.am (AM_PL_LOG_FLAGS): Renamed from (PL_LOG_FLAGS): ... this variable, intended for the user. * tests/parallel-tests7.test: Extend test. * NEWS: Update. Suggestion by Akim Demaille. Signed-off-by: Ralf Wildenhues --- diff --git a/ChangeLog b/ChangeLog index 56264242f..7eb5db7fd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,19 @@ 2009-04-04 Ralf Wildenhues + parallel-tests: LOG_COMPILER for tests without known extension. + * automake.in (handle_tests): If we don't match a known + extension, define `LOG_COMPILER' as `$(LOG_COMPILE) + $(AM_LOG_FLAGS) $(LOG_FLAGS)' and use it as %COMPILE% in check2. + * doc/automake.texi (Simple Tests using parallel-tests): + Document it. In the examples, suggest using the AM_*LOG_FLAGS + flags in Makefile.am rather than the variables without `AM_' + prefix. + * lib/Automake/tests/Makefile.am (AM_PL_LOG_FLAGS): Renamed from + (PL_LOG_FLAGS): ... this variable, intended for the user. + * tests/parallel-tests7.test: Extend test. + * NEWS: Update. + Suggestion by Akim Demaille. + More node renaming in the manual. * doc/automake.texi (Top): Adjust menu to ... (API Versioning): ... this node being renamed from ... diff --git a/NEWS b/NEWS index 3c047a37e..1f88963b8 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,19 @@ New in 1.10c: + +* Miscellaneous Changes: + + - In 1.10b, the `parallel-tests' driver introduced per-extension test + driver variables `_LOG_COMPILER', defined as + + $(_LOG_COMPILE) $(AM__LOG_FLAGS) $(_LOG_FLAGS) + + for extensions `.ext' registered in `TEST_EXTENSIONS'. Now, for tests + without a known extension, add `LOG_COMPILER', defined as + + $(LOG_COMPILE) $(AM_LOG_FLAGS) $(LOG_FLAGS) + + to the rules. + New in 1.10b: diff --git a/automake.in b/automake.in index 472862bcd..0460a44d2 100755 --- a/automake.in +++ b/automake.in @@ -4933,11 +4933,14 @@ sub handle_tests if substr ($obj, - length ($test_suffix)) eq $test_suffix; } $obj .= '.log'; + my $compile = 'LOG_COMPILE'; + define_variable ($compile, + '$(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS)', INTERNAL); $output_rules .= file_contents ('check2', new Automake::Location, GENERIC => 0, OBJ => $obj, SOURCE => $val, - COMPILE => '', + COMPILE =>'$(' . $compile . ')', EXT => ''); return $obj; }); @@ -4974,7 +4977,7 @@ sub handle_tests GENERIC => 1, OBJ => '', SOURCE => '$<', - COMPILE => '$(' . $compile . ')' , + COMPILE => '$(' . $compile . ')', EXT => $test_suffix); } } diff --git a/doc/automake.texi b/doc/automake.texi index 0f61f0563..77beee3eb 100644 --- a/doc/automake.texi +++ b/doc/automake.texi @@ -8511,31 +8511,41 @@ extension if any (@pxref{EXEEXT}), as well as any suffix listed in @code{TEST_EXTENSIONS} defaults to @file{.test}. Results are undefined if a test file name ends in several concatenated suffixes. +@vindex _LOG_COMPILE @vindex _LOG_COMPILER @vindex _LOG_FLAGS +@vindex LOG_COMPILE +@vindex LOG_COMPILER +@vindex LOG_FLAGS @vindex @var{EXT}_LOG_COMPILE @vindex @var{EXT}_LOG_COMPILER @vindex @var{EXT}_LOG_FLAGS @vindex AM_@var{EXT}_LOG_FLAGS +@vindex AM_LOG_FLAGS For tests that match an extension @code{.@var{ext}} listed in @code{TEST_EXTENSIONS}, you can provide a test driver using the variable @code{@var{ext}_LOG_COMPILER} (note the upper-case extension) and pass options in @code{AM_@var{ext}_LOG_FLAGS} and allow the user to pass options in @code{@var{ext}_LOG_FLAGS}. It will cause all tests with -this extension to be called with this driver. For example, +this extension to be called with this driver. For all tests without a +registered extension, the variables @code{LOG_COMPILER}, +@code{AM_LOG_FLAGS}, and @code{LOG_FLAGS} may be used. For example, @example -TESTS = foo.pl bar.py +TESTS = foo.pl bar.py baz TEST_EXTENSIONS = .pl .py PL_LOG_COMPILER = $(PERL) -PL_LOG_FLAGS = -w +AM_PL_LOG_FLAGS = -w PY_LOG_COMPILER = $(PYTHON) -PY_LOG_FLAGS = -v +AM_PY_LOG_FLAGS = -v +LOG_COMPILER = ./wrapper-script +AM_LOG_FLAGS = -d @end example @noindent -will invoke @samp{$(PERL) -w foo.pl} and @samp{$(PYTHON) -v bar.py} to -produce @file{foo.log} and @file{bar.log}, respectively. The +will invoke @samp{$(PERL) -w foo.pl}, @samp{$(PYTHON) -v bar.py}, +and @samp{./wrapper-script -d baz} to produce @file{foo.log}, +@file{bar.log}, and @file{baz.log}, respectively. The @samp{TESTS_ENVIRONMENT} variable is still expanded before the driver, but should be reserved for the user. diff --git a/lib/Automake/tests/Makefile.am b/lib/Automake/tests/Makefile.am index ad5d45e06..b56f3dcf7 100644 --- a/lib/Automake/tests/Makefile.am +++ b/lib/Automake/tests/Makefile.am @@ -16,7 +16,7 @@ ## along with this program. If not, see . PL_LOG_COMPILER = $(PERL) -PL_LOG_FLAGS = -Mstrict -I ../.. -I $(top_srcdir)/lib -w +AM_PL_LOG_FLAGS = -Mstrict -I ../.. -I $(top_srcdir)/lib -w TEST_EXTENSIONS = .pl TESTS = \ diff --git a/lib/Automake/tests/Makefile.in b/lib/Automake/tests/Makefile.in index a2d3d0d76..0596752d2 100644 --- a/lib/Automake/tests/Makefile.in +++ b/lib/Automake/tests/Makefile.in @@ -221,7 +221,7 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ PL_LOG_COMPILER = $(PERL) -PL_LOG_FLAGS = -Mstrict -I ../.. -I $(top_srcdir)/lib -w +AM_PL_LOG_FLAGS = -Mstrict -I ../.. -I $(top_srcdir)/lib -w TEST_EXTENSIONS = .pl TESTS = \ Condition.pl \ diff --git a/tests/parallel-tests7.test b/tests/parallel-tests7.test index 6bdaaffaa..ea9c2d4c9 100755 --- a/tests/parallel-tests7.test +++ b/tests/parallel-tests7.test @@ -33,10 +33,13 @@ check_PROGRAMS = baz bla.test bli.suff TEST_EXTENSIONS = .chk .test CHK_LOG_COMPILER = ./chk-driver TEST_LOG_COMPILER = ./test-driver +LOG_COMPILER = ./noext-driver AM_CHK_LOG_FLAGS = 1 CHK_LOG_FLAGS = 2 AM_TEST_LOG_FLAGS = 3 TEST_LOG_FLAGS = 4 +AM_LOG_FLAGS = 5 +LOG_FLAGS = 6 END mkdir sub @@ -51,6 +54,7 @@ exit 127 END chmod a+x chk-driver cp chk-driver test-driver +cp chk-driver noext-driver cat >foo.chk << 'END' #! /bin/sh @@ -80,11 +84,8 @@ $MAKE $MAKE check grep 'chk-driver *1 *2' foo.log grep 'test-driver *3 *4' bar.log -test -f baz.log -grep driver baz.log && Exit 1 +grep 'noext-driver *5 *6' baz.log grep 'test-driver *3 *4' bla.log -test -f bli.suff.log -grep driver bli.suff.log && Exit 1 -test -f sub/test.log -grep driver sub/test.log && Exit 1 +grep 'noext-driver *5 *6' bli.suff.log +grep 'noext-driver *5 *6' sub/test.log :