[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [FYI] {maint} tests setup: less hard-coding of the test subdirectory
From: |
Stefano Lattarini |
Subject: |
Re: [FYI] {maint} tests setup: less hard-coding of the test subdirectory |
Date: |
Sun, 01 Jul 2012 12:02:51 +0200 |
On 07/01/2012 10:54 AM, Stefano Lattarini wrote:
> * t/ax/tests-init.sh: Make the code creating the temporary
> test subdirectory smart enough to automatically create it
> in the same subdirectory of the test that is being run.
> * defs-static.in ($MKDIR_P, $am_rel_srcdir): New variables,
> AC_SUBST'd from @MKDIR_P@ and @srcdir@ respectively, and
> used in the new 'tests-init.sh' code.
>
> Signed-off-by: Stefano Lattarini <address@hidden>
> ---
> defs-static.in | 4 ++++
> t/ax/test-init.sh | 6 +++---
> 2 files changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/defs-static.in b/defs-static.in
> index 781571c..133bb96 100644
> --- a/defs-static.in
> +++ b/defs-static.in
> @@ -88,6 +88,7 @@ if test -z "$am_using_tap"; then
> case $argv0 in *.tap) am_using_tap=yes;; *) am_using_tap=no;; esac
> fi
>
> +am_rel_srcdir='@srcdir@'
> am_top_srcdir='@abs_srcdir@'
> am_top_builddir='@abs_builddir@'
> testprefix='@prefix@'
> @@ -131,6 +132,9 @@ PATH_SEPARATOR='@PATH_SEPARATOR@'
> host_alias=${host_alias-'@host_alias@'}; export host_alias
> build_alias=${build_alias-'@build_alias@'}; export build_alias
>
> +# A concurrency-safe "mkdir -p" implementation.
> +MKDIR_P=${AM_TESTSUITE_MKDIR_P-'@MKDIR_P@'}
> +
> # The shell we use to run our own test scripts, determined at configure
> # time. It is required in the self tests, and most importantly for the
> # automatic re-execution of test scripts.
> diff --git a/t/ax/test-init.sh b/t/ax/test-init.sh
> index bd511a9..b572109 100644
> --- a/t/ax/test-init.sh
> +++ b/t/ax/test-init.sh
> @@ -983,11 +983,11 @@ else
> # temporary/data files. This will be created shortly, and will be removed
> # by the cleanup trap below if the test passes. If the test doesn't pass,
> # this directory will be kept, to facilitate debugging.
> - testSubDir=t/$me.dir
> + testSubDir=${argv0#$am_rel_srcdir/}
> + testSubDir=${testSubDir%/*}/$me.dir
>
This isn't correct, in case the test case isn't in a subdirectory.
Consider the following squashed in:
diff --git a/t/ax/test-init.sh b/t/ax/test-init.sh
index b572109..d798d6c 100644
--- a/t/ax/test-init.sh
+++ b/t/ax/test-init.sh
@@ -984,7 +984,10 @@ else
# by the cleanup trap below if the test passes. If the test doesn't pass,
# this directory will be kept, to facilitate debugging.
testSubDir=${argv0#$am_rel_srcdir/}
- testSubDir=${testSubDir%/*}/$me.dir
+ case $testSubDir in
+ */*) testSubDir=${testSubDir%/*}/$me.dir;;
+ *) testSubDir=$me.dir;;
+ esac
test ! -e $testSubDir || rm_rf_ $testSubDir \
|| framework_failure_ "removing old test subdirectory"
$MKDIR_P $testSubDir \
Issue revealed by failures in 't/self-check-reexec.tap'.
Sorry for the noise,
Stefano