On 02/18/2012 11:12 PM, Stefano Lattarini wrote:
> On 02/18/2012 02:09 PM, Stefano Lattarini wrote:
>> [CC:ing bug-autoconf for Yet Another BSD make Bug, in case someone
>>  cares to documenting it ...]
>>
>> When BSD make is run in parallel mode, it apparently strips any leading
>> directory component from the automatic variable '$*' (of course, against
>> what POSIX mandates).  This is causing FreeBSD 9.0 make and NetBSD 5.1
>> make to spuriously fail with automake-generated test harnesses if subdir
>> tests are present *and* make is being run in parallel mode.  This issue
>> affects also the Automake own testsuite.
>>
>> The attached patch should work around the problem.
>>
>> I will test this patch more properly in the next few days, and apply it
>> if it causes no regression.
>>
The fix seems to work with every Automake-supported make implementation I
have access to (GNU make 3.80, 3.81 and 3.82, Solaris 10 /usr/ccs/bin/make,
Sun Distributed Make 7.8, and FreeBSD 9 make, NetBSD 5.1 make and OpenBSD
5.0 make.

I've thus pushed the patch, with the attached follow-up to fix a new
testsuite weakness.

Regards,
  Stefano
>From 72cae0a53cde58c5f5ac1020555a675498191b85 Mon Sep 17 00:00:00 2001
Message-Id: <72cae0a53cde58c5f5ac1020555a675498191b85.1329660058.git.stefano.lattar...@gmail.com>
From: Stefano Lattarini <stefano.lattar...@gmail.com>
Date: Sun, 19 Feb 2012 14:53:53 +0100
Subject: [PATCH] tests: be stricter in determining whether "make -jN" works

* tests/parallel-tests3.test: With at least Solaris 10 CCS make,
"make -jN" does not fail, but merely prints a warning about
"DistributedMake -j option" being ignored.  This was causing this
test case to fail spuriously.  So we now use a stricter check in
determining whether make works in parallel mode.  Since we are at
it, we try to cater also to Sun Distributed make, which understands
"-j N" but *not* "-jN".
---
 tests/parallel-tests3.test |   26 ++++++++++++++++++++++----
 1 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/tests/parallel-tests3.test b/tests/parallel-tests3.test
index f146d0f..b37cf0a 100755
--- a/tests/parallel-tests3.test
+++ b/tests/parallel-tests3.test
@@ -24,8 +24,26 @@ case $MAKE in
   *\ -j*) skip_ "\$MAKE contains \`-j'";;
 esac
 
-using_gmake || echo "all:" | $MAKE -f - -j4 all \
-  || skip_ "can't run make in parallel mode"
+if using_gmake; then
+  j=-j
+else
+  unindent > Makefile <<END
+    all: one two
+    one:
+	$sleep && test -f two
+    two:
+	echo ok > \$@
+END
+  for j in "-j" "-j " NONE; do
+    if test x"$j" = xNONE; then
+      skip_ "can't run make in parallel mode"
+    fi
+    $MAKE ${j}2 all >output 2>&1 || continue
+    $EGREP -i "(warning|error):|-j[\"\'\` ]" output && continue
+    break
+  done
+  rm -f one output Makefile
+fi
 
 cat >> configure.in << 'END'
 AC_OUTPUT
@@ -69,13 +87,13 @@ for build in serial parallel; do
 done
 
 cd serial
-$MAKE -j1 check &
+$MAKE ${j}1 check &
 cd ../parallel
 $sleep
 # Use append mode here to avoid dropping output.
 # Yes, this actually happens.
 : >stdout
-$MAKE -j4 check >> stdout
+$MAKE ${j}4 check >> stdout
 cd ..
 # Ensure the tests are really being run in parallel mode: if this is
 # the case, the serial run of the dummy testsuite started above should
-- 
1.7.9

Reply via email to