Fix error in generation of parallel tests.
authorStefano Lattarini <stefano.lattarini@gmail.com>
Tue, 8 Jun 2010 18:43:43 +0000 (20:43 +0200)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Tue, 8 Jun 2010 18:51:45 +0000 (20:51 +0200)
* 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 <Ralf.Wildenhues@gmx.de>
ChangeLog
tests/Makefile.am
tests/Makefile.in
tests/defs.in

index 8b63a59..dda2cf2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2010-06-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
+           Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       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  <stefano.lattarini@gmail.com>
            Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
index e647b03..7eea801 100644 (file)
@@ -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 $@
 
index c7ab9d7..203b62c 100644 (file)
@@ -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 $@
 
index 72e9d52..fb056ff 100644 (file)
 # Defines for Automake testing environment.
 # Tom Tromey <tromey@cygnus.com>
 
+# 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.