automake-patches
[Top][All Lists]
Advanced

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

[FYI] {maint} tests setup: less hard-coding of the test subdirectory


From: Stefano Lattarini
Subject: [FYI] {maint} tests setup: less hard-coding of the test subdirectory
Date: Sun, 1 Jul 2012 10:54:06 +0200

* 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
   test ! -e $testSubDir || rm_rf_ $testSubDir \
     || framework_failure_ "removing old test subdirectory"
-  test -d t || mkdir t
-  mkdir $testSubDir \
+  $MKDIR_P $testSubDir \
     || framework_failure_ "creating test subdirectory"
   # The leading './' is to avoid CDPATH issues.
   cd ./$testSubDir \
-- 
1.7.9.5




reply via email to

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