From d376fb6033bddabf86b91bd5ce58627a91f59fc8 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Tue, 17 Jan 2012 11:07:01 +0100 Subject: [PATCH] tests: avoid spurious failures with parallel make Some tests are unprepared to be run with a make command that runs in parallel mode by default. This can happen e.g., if the user explicitly run the tests with something like: AM_TESTSUITE_MAKE="gmake -j3" in the in the environment, but also if the make used in the testsuite is Sun Distributed Make, and the 'DMAKE_MODE' environment variable is set to "parallel". Fix some instances of this issue. * tests/tap-doc.test (Makefile.am): Declare explicit dependencies among the test cases, to ensure they are run in the correct order. * tests/tap-doc2.test: Set the 'DMAKE_MODE' environment variable to "serial", to prevent Sun dmake from trying to run in parallel. Remove other now-superfluous workarounds for dmake. --- tests/tap-doc.test | 6 +++++- tests/tap-doc2.test | 14 ++++---------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/tests/tap-doc.test b/tests/tap-doc.test index de39b42..94ced61 100755 --- a/tests/tap-doc.test +++ b/tests/tap-doc.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2011 Free Software Foundation, Inc. +# Copyright (C) 2011, 2012 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 @@ -31,6 +31,10 @@ cat > Makefile.am << 'END' TESTS = foo.sh zardoz.tap bar.sh mu.tap TEST_EXTENSIONS = .sh .tap TAP_LOG_DRIVER = $(srcdir)/tap-driver +## Ensure the test scripts are run in the correct order. +mu.log: bar.log +bar.log: zardoz.log +zardoz.log: foo.log END cat > foo.sh <<'END' diff --git a/tests/tap-doc2.test b/tests/tap-doc2.test index c5fe2b6..c844f79 100755 --- a/tests/tap-doc2.test +++ b/tests/tap-doc2.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2011 Free Software Foundation, Inc. +# Copyright (C) 2011, 2012 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 @@ -71,13 +71,6 @@ chmod a+x *.test # Strip extra "informative" lines that could be printed by Solaris # Distributed Make. -strip_dmake_junk () -{ - cat $1 - LC_ALL=C $EGREP -v ' --> ([0-9][0-9]* job|[Jj]ob output)' "$@" >t - mv -f t $1 -} - mkdir build-aux cp "$am_scriptdir"/tap-driver.pl build-aux \ || framework_failure_ "fetching the perl TAP driver" @@ -89,6 +82,9 @@ cp "$am_scriptdir"/tap-driver.pl build-aux \ case $MAKE in *\ -j*) skip_ "can't work easily with concurrent make";; esac +# Prevent Sun Distributed Make from trying to run in parallel. +DMAKE_MODE=serial; export DMAKE_MODE + $MAKE check >stdout && { cat stdout; Exit 1; } cat stdout @@ -105,7 +101,6 @@ ERROR: baz.test - exited with status 7 END sed -n '/^PASS: foo\.test/,/^ERROR: baz\.test/p' stdout > got -strip_dmake_junk got cat exp cat got @@ -128,7 +123,6 @@ PASS: baz.test 1 END sed -n '/^PASS: foo\.test/,/^PASS: baz\.test/p' stdout > got -strip_dmake_junk got cat exp cat got -- 2.7.4