At Thursday 03 June 2010, Ralf Wildenhues <ralf.wildenh...@gmx.de> wrote: > Hi Stefano, > > * Stefano Lattarini wrote on Sun, May 23, 2010 at 05:51:15PM CEST: > > Here it is my attempt to a patch. > > Thanks. This seems to work ok, but this: > > +# Protect against attempted multiple inclusions of this file. > > +# This might be especially useful in generated test scripts. > > +echo 'echo "$me: ./defs already included"' > defs > > + > > is such an ugly thing, because we now litter the test directories. > I'd prefer to avoid that, unless it means very ugly constructs. > What about the attached new try? It just complicates the generated tests a little bit, but this is a more than fair tradeoff IMO.
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). Regards, Stefano
From e1a3e31df7baf0338d4c8e0b213e5c6c1381a7ea Mon Sep 17 00:00:00 2001 From: Stefano Lattarini <stefano.lattar...@gmail.com> Date: Thu, 3 Jun 2010 14:04:06 +0200 Subject: [PATCH] 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 `...@abs_srcdir@' as substituted by configure. Report, suggestions and first fix by Ralf Wildenhues, final patch by Stefano Lattarini. --- ChangeLog | 13 +++++++++++++ tests/Makefile.am | 5 ++++- tests/Makefile.in | 5 ++++- tests/defs.in | 19 +++++++++++++------ 4 files changed, 34 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 71b0d9b..ca12683 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2010-06-03 Stefano Lattarini <stefano.lattar...@gmail.com> + Ralf Wildenhues <ralf.wildenh...@gmx.de> + + 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 `...@abs_srcdir@' + as substituted by configure. + Report, suggestions and first fix by Ralf Wildenhues, final + patch by Stefano Lattarini. + 2010-04-25 Ralf Wildenhues <ralf.wildenh...@gmx.de> Warning and error message formatting cleanups. diff --git a/tests/Makefile.am b/tests/Makefile.am index cff34c5..9a10456 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\""; \ } > $...@-t $(AM_V_at)chmod a+rx $...@-t && mv -f $...@-t $@ diff --git a/tests/Makefile.in b/tests/Makefile.in index 3ff9012..f8b1c70 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -1386,7 +1386,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\""; \ } > $...@-t $(AM_V_at)chmod a+rx $...@-t && mv -f $...@-t $@ diff --git a/tests/defs.in b/tests/defs.in index 497b57f..2041709 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,14 @@ # Defines for Automake testing environment. # Tom Tromey <tro...@cygnus.com> +# Protect against attempted multiple inclusions of this file. +# This might be especially useful in generated test scripts. +if test x"$am_defs_included" = x"yes"; then + : "$me: ./defs already included, just chdir back to testsubdir" + cd "$curdir/$testSubDir" || Exit 99 + return # POSIX says it's ok to return from a dot script +fi + # Be more Bourne compatible. # (Snippet copied from configure's initialization in Autoconf 2.64) DUALCASE=1; export DUALCASE # for MKS sh @@ -40,11 +48,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,6 +432,9 @@ AUTOMAKE_fails () AUTOMAKE_run 1 ${1+"$@"} } +# Register that this file has alredy been sourced. +am_defs_included=yes + # Turn on shell traces. set -x -- 1.6.5