automake-patches
[Top][All Lists]
Advanced

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

[FYI] {maint,master} test defs: allow overriding of `$me'


From: Stefano Lattarini
Subject: [FYI] {maint,master} test defs: allow overriding of `$me'
Date: Sun, 17 Apr 2011 18:27:44 +0200
User-agent: KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; )

Hello automakers.

The attached patch is a prerequisite for the pending patch of mine
"tests: avoid extra test generation (for `instspc' tests)" (reference:
http://lists.gnu.org/archive/html/automake-patches/2011-02/msg00044.html)
and for another patch I'm writing that will extend the coverage offered
by some `depcomp*.test' tests.

I've applied the patch to maint, merged into master, and pushed.

Regards,
  Stefano
From 3b64c7d208952e94c4b6a317cf34e5e650e77fe6 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <address@hidden>
Date: Sun, 17 Apr 2011 17:58:45 +0200
Subject: [PATCH] test defs: allow overriding of `$me'

* tests/defs.in ($me): Allow overriding by the including test
script.  Add some explicative comments.
---
 ChangeLog     |    6 ++++++
 tests/defs.in |    7 ++++++-
 2 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a126dc2..bdb49db 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2011-04-17  Stefano Lattarini  <address@hidden>
 
+       test defs: allow overriding of `$me'
+       * tests/defs.in ($me): Allow overriding by the including test
+       script.  Add some explicative comments.
+
+2011-04-17  Stefano Lattarini  <address@hidden>
+
        depcomp tests: don't reject slower dependency extractors
        * tests/depcomp8b.test: Add the `--enable-dependency-tracking'
        option to `configure' invocations, so that slower dependency
diff --git a/tests/defs.in b/tests/defs.in
index cf07a4e..38bb4e5 100644
--- a/tests/defs.in
+++ b/tests/defs.in
@@ -64,7 +64,12 @@ test -f "$srcdir/defs.in" || {
    exit 1
 }
 
-me=`echo "$0" | sed -e 's,.*[\\/],,;s/\.test$//'`
+# The name of the current test (without the `.test' suffix).
+# Test scripts can override it if they need to (but this should
+# be done carefully, and *before* including ./defs).
+if test -z "$me"; then
+  me=`echo "$0" | sed -e 's,.*[\\/],,;s/\.test$//'`
+fi
 
 # This might be used in testcases checking distribution-related features.
 # Test scripts are free to override this if they need to.
-- 
1.7.2.3

diff --git a/ChangeLog b/ChangeLog
index 21acbc1..7e97a4a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2011-04-17  Stefano Lattarini  <address@hidden>
 
+       test defs: allow overriding of `$me'
+       * tests/defs.in ($me): Allow overriding by the including test
+       script.  Add some explicative comments.
+
+2011-04-17  Stefano Lattarini  <address@hidden>
+
        coverage: more tests on the parallel-tests driver
        * tests/parallel-tests-interrupt.test: New test.
        * tests/parallel-tests-reset-term.test: Likewise.
diff --git a/tests/defs b/tests/defs
index f67491a..ae05b82 100644
--- a/tests/defs
+++ b/tests/defs
@@ -32,12 +32,15 @@ test -f ./defs-static || {
 # Source the shell sanitization and variables' definitions.
 . ./defs-static || exit 99
 
-# The name of the current test (without the `.test' suffix.)
-# Guard against failure to spawn sed (seen on MSYS), or empty $argv0.
-me=`echo "$argv0" | sed -e 's,.*[\\/],,;s/\.test$//'` \
-  && test -n "$me" \
-  || { echo "$argv0: failed to define \$me" >&2; exit 99; }
-
+# The name of the current test (without the `.test' suffix).
+# Test scripts can override it if they need to (but this should
+# be done carefully, and *before* including ./defs).
+if test -z "$me"; then
+  # Guard against failure to spawn sed (seen on MSYS), or empty $argv0.
+  me=`echo "$argv0" | sed -e 's,.*[\\/],,;s/\.test$//'` \
+    && test -n "$me" \
+    || { echo "$argv0: failed to define \$me" >&2; exit 99; }
+fi
 
 ## ---------------------------------------- ##
 ##  Sanity checks and environment cleanup.  ##

reply via email to

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