I was surprised to see only one major flaw in the new test driver code in the EXEEXT treatment, testing it for the first time now: inference rules .chk.log: ...
will not cause `make' to consider foo.chk.exe as a valid prerequisite to foo.log (there is no problem with explicit rules like `bar.log: bar$(EXEEXT)' where we add the EXEEXT correctly). For GNU and BSD make, this can be fixed by adding a .chk$(EXEEXT).log: ... rule. If both scripts and programs may end in .chk, then, on systems where $(EXEEXT) is empty, this rule would conflict in name with the .chk.log: ... inference rule. This patch thus outputs the latter rule any time `.chk' is registered in TEST_EXTENSIONS, but outputs the rule including $(EXEEXT) only when programs are created at all, and then only under a new conditional am__EXEEXT which is true iff $EXEEXT is nonempty. (BTW, I chose the am__EXEEXT name as AM_EXEEXT used to be a published macro name, and I would like to avoid confusion.) In order for the `.chk$(EXEEXT).log' rule to work, `.chk$(EXEEXT)' needs to be registered in .SUFFIXES (automake does this by itself). Inference rules with more than two dots are not POSIX-conforming, but I checked that this works (and is detected correctly) for GNU make under MinGW, as well as GNU and NetBSD make in a cross-compile situation under GNU/Linux (export CC=i586-mingw-msvc-gcc; make check). I think that should be sufficient for most practical needs. Remaining ugly spot in this patch: it adds code to every configure script of every package using Automake (and pulls in m4/cond.m4 into every aclocal.m4 file): we can't use _AM_IF_OPTION easily because the `parallel-tests' option may have been set in one subdir Makefile.am only, and I don't easily see yet how to describe `if any of the AC_PROG_{CC,CXX,FC,F77,..} have run, expand this'. Suggestions? I intend to push this patch to the `next' branch in the next couple of days. Thanks, Ralf parallel-tests: Fix driver for nonempty executable extension. * automake.in (handle_tests): New substitution `%am__EXEEXT%', defined as 'FALSE' for non-generic rules, or if no programs are built at all. Otherwise, define it as configure conditional. * lib/am/check2.am [%am__EXEEXT%] (%EXT%$(EXEEXT).log): New conditional generic rule. * m4/init.m4 (AM_INIT_AUTOMAKE): New conditional `am__EXEEXT'. Evaluate late in configure, defined to true iff `$EXEEXT' is nonempty. * tests/check5.test: Only match `_EXEEXT_[1-9]' here, to avoid false positives stemming from `...@am__exeext_true@'. * tests/check8.test: Allow executable extensions in test suite output. * tests/check9.test: Add `$(EXEEXT)' manually to @substituted@ XFAIL_TESTS entries. * NEWS: Update. diff --git a/NEWS b/NEWS index 1f88963..e2fcbf9 100644 --- a/NEWS +++ b/NEWS @@ -14,6 +14,15 @@ New in 1.10c: to the rules. +Bugs fixed in 1.10c: + +* Long standing bugs: + +* Bugs introduced by 1.10: + + - The `parallel-tests' driver also works on systems with a nonempty + executable extension, such as Windows. + New in 1.10b: diff --git a/automake.in b/automake.in index 0460a44..053f0f1 100755 --- a/automake.in +++ b/automake.in @@ -4895,7 +4895,8 @@ sub handle_tests define_variable ('TEST_SUITE_HTML', '$(TEST_SUITE_LOG:.log=.html)', INTERNAL); my $suff = '.test'; my $at_exeext = ''; - if (exists $configure_vars{'EXEEXT'}) + my $handle_exeext = exists $configure_vars{'EXEEXT'}; + if ($handle_exeext) { $at_exeext = subst ('EXEEXT'); $suff = $at_exeext . ' ' . $suff; @@ -4903,7 +4904,7 @@ sub handle_tests define_variable ('TEST_EXTENSIONS', $suff, INTERNAL); # FIXME: this mishandles conditions. my @test_suffixes = (var 'TEST_EXTENSIONS')->value_as_list_recursive; - if (exists $configure_vars{'EXEEXT'}) + if ($handle_exeext) { unshift (@test_suffixes, $at_exeext) unless $test_suffixes[0] eq $at_exeext; @@ -4941,7 +4942,8 @@ sub handle_tests OBJ => $obj, SOURCE => $val, COMPILE =>'$(' . $compile . ')', - EXT => ''); + EXT => '', + am__EXEEXT => 'FALSE'); return $obj; }); @@ -4973,12 +4975,14 @@ sub handle_tests define_variable ($compile, '$(' . $ext . '_LOG_COMPILER) $(AM_' . $ext . '_LOG_FLAGS)' . ' $(' . $ext . '_LOG_FLAGS)', INTERNAL); + my $am_exeext = $handle_exeext ? 'am__EXEEXT' : 'FALSE'; $output_rules .= file_contents ('check2', new Automake::Location, GENERIC => 1, OBJ => '', SOURCE => '$<', COMPILE => '$(' . $compile . ')', - EXT => $test_suffix); + EXT => $test_suffix, + am__EXEEXT => $am_exeext); } } diff --git a/lib/am/check2.am b/lib/am/check2.am index 237e20a..3e9eed2 100644 --- a/lib/am/check2.am +++ b/lib/am/check2.am @@ -18,3 +18,12 @@ ?GENERIC?%EXT%.log: ?!GENERIC?%OBJ%: %SOURCE% @p='%SOURCE%'; $(am__check_pre) %COMPILE% "$$tst" $(am__check_post) + +## If no programs are built in this package, then this rule is removed +## at automake time. Otherwise, %am__EXEEXT% expands to a configure time +## conditional, true if $(EXEEXT) is nonempty, thus this rule does not +## conflict with the previous one. +if %am__EXEEXT% +?GENERIC?%EXT%$(EXEEXT).log: + @p='%SOURCE%'; $(am__check_pre) %COMPILE% "$$tst" $(am__check_post) +endif %am__EXEEXT% diff --git a/m4/init.m4 b/m4/init.m4 index a4d5c90..559f395 100644 --- a/m4/init.m4 +++ b/m4/init.m4 @@ -7,7 +7,7 @@ # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 15 +# serial 16 # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. @@ -103,6 +103,7 @@ AC_PROVIDE_IFELSE([AC_PROG_OBJC], AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl +AC_CONFIG_COMMANDS_PRE([AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])dnl ]) diff --git a/tests/check5.test b/tests/check5.test index 58c8607..e2e0210 100755 --- a/tests/check5.test +++ b/tests/check5.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc. +# Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -52,6 +52,6 @@ test -f ok EXEEXT=.bin $MAKE -e print-tests >output cat output # No am__EXEEXT_* variable is needed. -grep '_EXEEXT' Makefile.in && Exit 1 +grep '_EXEEXT_[1-9]' Makefile.in && Exit 1 grep 'BEG: one.bin two.bin :END' output $FGREP 'TESTS = $(check_PROGRAMS)' Makefile.in diff --git a/tests/check8.test b/tests/check8.test index 3e38ccf..1fe2a53 100755 --- a/tests/check8.test +++ b/tests/check8.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2008 Free Software Foundation, Inc. +# Copyright (C) 2008, 2009 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -73,10 +73,10 @@ cat stdout cat stderr >&2 grep 'XPASS.* foo$' stdout grep '^[^X]*PASS.* sub/foo$' stdout -grep '^[^X]*PASS.* bar$' stdout -grep '^[^X]*PASS.* sub/bar$' stdout -grep '^[^X]*FAIL.* baz$' stdout -grep 'XFAIL.* sub/baz$' stdout +grep '^[^X]*PASS.* bar' stdout +grep '^[^X]*PASS.* sub/bar' stdout +grep '^[^X]*FAIL.* baz' stdout +grep 'XFAIL.* sub/baz' stdout # parallel-tests should not add circular dependencies. # Look for known warnings from a couple of `make' implementations. grep -i 'circular.*dependency' stderr && Exit 1 @@ -93,8 +93,8 @@ cat stdout # rewriting (if we fix that, we can still write a separate test for it). grep 'XPASS.*foo$' stdout grep '^[^X]*PASS.*sub/foo$' stdout -grep '^[^X]*PASS.*bar$' stdout -grep '^[^X]*PASS.*sub/bar$' stdout -grep '^[^X]*FAIL.*baz$' stdout -grep 'XFAIL.*sub/baz$' stdout +grep '^[^X]*PASS.*bar' stdout +grep '^[^X]*PASS.*sub/bar' stdout +grep '^[^X]*FAIL.*baz' stdout +grep 'XFAIL.*sub/baz' stdout : diff --git a/tests/check9.test b/tests/check9.test index 91c37c5..658e636 100755 --- a/tests/check9.test +++ b/tests/check9.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2008 Free Software Foundation, Inc. +# Copyright (C) 2008, 2009 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -26,7 +26,7 @@ cat >> configure.in << 'END' AC_PROG_CC AC_SUBST([script_tests], ['subst-pass-script.test subst-xfail-script.test']) AC_SUBST([prog_tests], ['subst-pass-prog.test$(EXEEXT) subst-xfail-prog.test$(EXEEXT)']) -AC_SUBST([xfail_tests], ['xfail-script.test subst-xfail-script.test xfail-prog subst-xfail-prog.test$(EXEEXT)']) +AC_SUBST([xfail_tests], ['xfail-script.test subst-xfail-script.test xfail-prog$(EXEEXT) subst-xfail-prog.test$(EXEEXT)']) AC_OUTPUT END