From 6fee87c34e45ad9c91444b684d4ccd6c932debd3 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Tue, 8 Jun 2010 20:43:43 +0200 Subject: [PATCH] Fix error in generation of parallel tests. * tests/defs.in ($am_skip_defs): New variable, to be used when ./defs must be sourced multiple times. If set, unset it and only define $srcdir; otherwise, also go through the rest of the script. ($am_defs_included): Remove, no more needed. * tests/Makefile.am ($(parallel_tests)): Update accordingly, using only $srcdir from defs. Fixes potential test failures of tests that use $required. Signed-off-by: Ralf Wildenhues --- ChangeLog | 13 +++++++++++++ tests/Makefile.am | 18 +++++++++++++----- tests/Makefile.in | 18 +++++++++++++----- tests/defs.in | 14 +++++++------- 4 files changed, 46 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8b63a598c..dda2cf225 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2010-06-08 Stefano Lattarini + Ralf Wildenhues + + Fix error in generation of parallel tests. + * tests/defs.in ($am_skip_defs): New variable, to be used when + ./defs must be sourced multiple times. If set, unset it and + only define $srcdir; otherwise, also go through the rest of + the script. + ($am_defs_included): Remove, no more needed. + * tests/Makefile.am ($(parallel_tests)): Update accordingly, + using only $srcdir from defs. + Fixes potential test failures of tests that use $required. + 2010-06-06 Stefano Lattarini Ralf Wildenhues diff --git a/tests/Makefile.am b/tests/Makefile.am index e647b03e9..7eea8016b 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -32,12 +32,20 @@ $(parallel_tests): Makefile.am $(AM_V_at)rm -f $@ $@-t $(AM_V_GEN)input=`echo $@ | sed 's,.*/,,; s,-p.test$$,.test,'`; \ { echo '#!/bin/sh'; \ - echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \ + echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \ + echo; \ + echo '# Ensure proper definition of $$srcdir.'; \ + echo 'am_skip_defs=yes'; \ + echo '. ./defs || exit 99'; \ + echo 'test -n "$$srcdir" || exit 99 # sanity check'; \ + echo; \ + echo "# Run the test with Automake's parallel-tests driver enabled."; \ echo 'parallel_tests=yes'; \ - echo '. ./defs || Exit 1'; \ - echo '# So that the sourced test can re-exec ./defs safely.'; \ - echo 'cd "$$curdir" || Exit 1'; \ - echo ". \"\$$testsrcdir/$$input\""; \ + echo "if test -f \"./$$input\"; then"; \ + echo " . \"./$$input\""; \ + echo 'else'; \ + echo " . \"\$$srcdir/$$input\""; \ + echo 'fi'; \ } > $@-t $(AM_V_at)chmod a+rx $@-t && mv -f $@-t $@ diff --git a/tests/Makefile.in b/tests/Makefile.in index c7ab9d784..203b62c02 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -1378,12 +1378,20 @@ $(parallel_tests): Makefile.am $(AM_V_at)rm -f $@ $@-t $(AM_V_GEN)input=`echo $@ | sed 's,.*/,,; s,-p.test$$,.test,'`; \ { echo '#!/bin/sh'; \ - echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \ + echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \ + echo; \ + echo '# Ensure proper definition of $$srcdir.'; \ + echo 'am_skip_defs=yes'; \ + echo '. ./defs || exit 99'; \ + echo 'test -n "$$srcdir" || exit 99 # sanity check'; \ + echo; \ + echo "# Run the test with Automake's parallel-tests driver enabled."; \ echo 'parallel_tests=yes'; \ - echo '. ./defs || Exit 1'; \ - echo '# So that the sourced test can re-exec ./defs safely.'; \ - echo 'cd "$$curdir" || Exit 1'; \ - echo ". \"\$$testsrcdir/$$input\""; \ + echo "if test -f \"./$$input\"; then"; \ + echo " . \"./$$input\""; \ + echo 'else'; \ + echo " . \"\$$srcdir/$$input\""; \ + echo 'fi'; \ } > $@-t $(AM_V_at)chmod a+rx $@-t && mv -f $@-t $@ diff --git a/tests/defs.in b/tests/defs.in index 72e9d5274..fb056ff52 100644 --- a/tests/defs.in +++ b/tests/defs.in @@ -20,12 +20,14 @@ # Defines for Automake testing environment. # Tom Tromey +# Absolutely necessary variable(s). +srcdir=${srcdir-'@abs_srcdir@'} + # Protect this file against multiple inclusion, useful for generated tests. -if test x"$am_defs_included" = xyes; then - : "$me: ./defs already included" - cd "$curdir/$testSubDir" || Exit 99 +if test x"$am_skip_defs" = xyes; then + unset am_skip_defs -else # not already included +else # Do proper testcase setup. # Be more Bourne compatible. # (Snippet copied from configure's initialization in Autoconf 2.64) @@ -47,8 +49,6 @@ test -f ./defs || { exit 1 } -srcdir=${srcdir-'@abs_srcdir@'} - # Ensure $srcdir is set correctly. test -f "$srcdir/defs.in" || { echo "$srcdir/defs.in not found, check \$srcdir" 1>&2 @@ -439,4 +439,4 @@ set -x pwd -fi # not already included +fi # Proper testcase setup. -- 2.47.2