automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [BIKESHEDDING PATCH] Generated tests are now just a thin layer aroun


From: Ralf Wildenhues
Subject: Re: [BIKESHEDDING PATCH] Generated tests are now just a thin layer around other tests.
Date: Sun, 6 Jun 2010 16:41:38 +0200
User-agent: Mutt/1.5.20 (2009-10-28)

Hi Stefano,

* Stefano Lattarini wrote on Thu, Jun 03, 2010 at 02:07:19PM CEST:
> What about the attached new try?  It just complicates the generated 
> tests a little bit, but this is a more than fair tradeoff IMO.

That looks like a better idea to me.  However, 'return' from a script
sourced with '.' is not portable to, e.g., Solaris or Tru64 5.1D sh.
A portable alternative is to wrap the script contents into a
conditional.  I'm amending the patch to do that instead.

> Note that I removed a couple of unrelated changes to defs.in that were 
> in my previous patch, since now I feel they better belong to a 
> different patch series aimed at defs.in refactoring (which I'll submit 
> at a later date).

OK.

Committed like this, and merged to master.  Let's not bother with the
messed-up indentation.

Cheers,
Ralf

2010-06-06  Stefano Lattarini  <address@hidden>
            Ralf Wildenhues  <address@hidden>

        Fix distcheck failure with distributed generated parallel tests.
        * tests/Makefile.am ($(parallel_tests)): Cope with $(srcdir)
        being different from the value at developer `make dist' time.
        * tests/defs.in: Protect against mutiple inclusion, by using ...
        ($am_defs_included): ... this new variable.
        ($srcdir): Do not compute, but simply define to address@hidden@'
        as substituted by configure.
        Report, suggestions and first fix by Ralf Wildenhues, final
        patch by Stefano Lattarini.

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 62ad6aa..e647b03 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -34,7 +34,10 @@ $(parallel_tests): Makefile.am
        { echo '#!/bin/sh'; \
          echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \
          echo 'parallel_tests=yes'; \
-         echo ". '$(srcdir)/$$input'"; \
+         echo '. ./defs || Exit 1'; \
+         echo '# So that the sourced test can re-exec ./defs safely.'; \
+         echo 'cd "$$curdir" || Exit 1'; \
+         echo ". \"\$$testsrcdir/$$input\""; \
        } > address@hidden
        $(AM_V_at)chmod a+rx address@hidden && mv -f address@hidden $@
 
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 295d259..c7ab9d7 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -1380,7 +1380,10 @@ $(parallel_tests): Makefile.am
        { echo '#!/bin/sh'; \
          echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \
          echo 'parallel_tests=yes'; \
-         echo ". '$(srcdir)/$$input'"; \
+         echo '. ./defs || Exit 1'; \
+         echo '# So that the sourced test can re-exec ./defs safely.'; \
+         echo 'cd "$$curdir" || Exit 1'; \
+         echo ". \"\$$testsrcdir/$$input\""; \
        } > address@hidden
        $(AM_V_at)chmod a+rx address@hidden && mv -f address@hidden $@
 
diff --git a/tests/defs.in b/tests/defs.in
index 497b57f..d4c2534 100644
--- a/tests/defs.in
+++ b/tests/defs.in
@@ -2,7 +2,7 @@
 # @configure_input@
 #
 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006, 2007, 2008, 2009  Free Software Foundation, Inc.
+# 2005, 2006, 2007, 2008, 2009, 2010 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
@@ -20,6 +20,13 @@
 # Defines for Automake testing environment.
 # Tom Tromey <address@hidden>
 
+# Protect this file against multiple inclusion, useful for generated tests.
+if test x"$am_defs_included" = x"yes"; then
+  : "$me: ./defs already included"
+  cd "$curdir/$testSubDir" || Exit 99
+
+else # not already included
+
 # Be more Bourne compatible.
 # (Snippet copied from configure's initialization in Autoconf 2.64)
 DUALCASE=1; export DUALCASE # for MKS sh
@@ -40,11 +47,7 @@ test -f ./defs || {
    exit 1
 }
 
-if test -z "$srcdir"; then
-   # compute $srcdir.
-   srcdir=`echo "$0" | sed -e 's,/[^\\/]*$,,'`
-   test "$srcdir" = $0 && srcdir=.
-else :; fi
+srcdir=${srcdir-'@abs_srcdir@'}
 
 # Ensure $srcdir is set correctly.
 test -f "$srcdir/defs.in" || {
@@ -428,7 +431,12 @@ AUTOMAKE_fails ()
   AUTOMAKE_run 1 ${1+"$@"}
 }
 
+# Register that this file has alredy been sourced.
+am_defs_included=yes
+
 # Turn on shell traces.
 set -x
 
 pwd
+
+fi # not already included



reply via email to

[Prev in Thread] Current Thread [Next in Thread]