* Akim Demaille wrote on Mon, Mar 30, 2009 at 10:02:51PM CEST: > Le 30 mars 09 à 21:37, Ralf Wildenhues a écrit : >> I mean with >> TESTS = foo bar.test baz.chk >> TEST_EXTENSIONS = .chk >> >> then foo.log and bar.test.log (sic!) will be generated using explicit >> rules, while baz.log will be generated using a .chk.log suffix rule. >> Only the latter one will have a $(CHK_LOG_COMPILE), while there will >> be >> no $(TEST_LOG_COMPILE) (because .test was not listed as extension), >> nor >> $(LOG_COMPILE) (because foo has no extension). The above proposal was >> meant as: adding $(LOG_COMPILE) (as defined above) to those test runs >> which are generated by means of explicit rules. >> >> Makes sense now? > > Yes, perfect sense now :) Sure, it would make it more complete!
Yep. Implemented as follows. Cheers, Ralf 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. diff --git a/NEWS b/NEWS index 3c047a3..1f88963 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 `<EXT>_LOG_COMPILER', defined as + + $(<EXT>_LOG_COMPILE) $(AM_<EXT>_LOG_FLAGS) $(<EXT>_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 472862b..0460a44 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 0f61f05..77beee3 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 a...@var{ext}_log_flags +...@vindex AM_LOG_FLAGS For tests that match an extension @cod...@var{ext}} listed in @code{TEST_EXTENSIONS}, you can provide a test driver using the variable @co...@var{ext}_log_compiler} (note the upper-case extension) and pass options in @code{...@var{ext}_log_flags} and allow the user to pass options in @co...@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 ad5d45e..b56f3dc 100644 --- a/lib/Automake/tests/Makefile.am +++ b/lib/Automake/tests/Makefile.am @@ -16,7 +16,7 @@ ## along with this program. If not, see <http://www.gnu.org/licenses/>. 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/tests/parallel-tests7.test b/tests/parallel-tests7.test index 6bdaaff..ea9c2d4 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 :