automake-commit
[Top][All Lists]
Advanced

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

[Automake-commit] [SCM] GNU Automake branch, testsuite-work, updated. v1


From: Stefano Lattarini
Subject: [Automake-commit] [SCM] GNU Automake branch, testsuite-work, updated. v1.11-1521-g4fdddd1
Date: Tue, 25 Oct 2011 13:28:10 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Automake".

http://git.sv.gnu.org/gitweb/?p=automake.git;a=commitdiff;h=4fdddd150b9bd93072b950ba597e5db73859014b

The branch, testsuite-work has been updated
       via  4fdddd150b9bd93072b950ba597e5db73859014b (commit)
      from  cc29c6174a7d68a70d33e5ff5af68e3e0ec0be54 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 4fdddd150b9bd93072b950ba597e5db73859014b
Author: Stefano Lattarini <address@hidden>
Date:   Tue Oct 25 15:20:42 2011 +0200

    test defs: new function 'am_keeping_testdirs', for better APIs
    
    This change is meant to make it easier for TAP-based test scripts
    to remove files left over by completed (sub)tests, while still
    honoring the user-provided `$keep_testdirs' setting.
    
    * tests/defs (am_keeping_testdirs): New function, telling whether
    we should keep the test directories around, even in case of
    success (by default, we don't).
    (exit trap): Use it.
    * tests/depmod.tap: Likewise.
    * tests/instspc.tap: Likewise.  Also, fix some pre-existing
    "copy & paste" bugs, and a typo in comments.

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog         |   16 ++++++++++++++++
 tests/defs        |   17 +++++++++++------
 tests/depmod.tap  |   10 ++++++----
 tests/instspc.tap |   11 ++++++-----
 4 files changed, 39 insertions(+), 15 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index adba25e..d493ba3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,21 @@
 2011-10-25  Stefano Lattarini  <address@hidden>
 
+       test defs: new function 'am_keeping_testdirs', for better APIs
+
+       This change is meant to make it easier for TAP-based test scripts
+       to remove files left over by completed (sub)tests, while still
+       honoring the user-provided `$keep_testdirs' setting.
+
+       * tests/defs (am_keeping_testdirs): New function, telling whether
+       we should keep the test directories around, even in case of
+       success (by default, we don't).
+       (exit trap): Use it.
+       * tests/depmod.tap: Likewise.
+       * tests/instspc.tap: Likewise.  Also, fix some pre-existing
+       "copy & paste" bugs, and a typo in comments.
+
+2011-10-25  Stefano Lattarini  <address@hidden>
+
        tests: remove redundant `set -e', and other minor improvements
        * tests/dejagnu-absolute-builddir.test: Do not set the `errexit'
        shell flag, as it is already set by `tests/defs'.
diff --git a/tests/defs b/tests/defs
index e5f66a5..7b9db87 100644
--- a/tests/defs
+++ b/tests/defs
@@ -184,6 +184,16 @@ set -e
 ##  Auxiliary shell functions.  ##
 ## ---------------------------- ##
 
+# Tell whether we should keep the test directories around, even in
+# case of success.  By default, we don't.
+am_keeping_testdirs ()
+{
+  case $keep_testdirs in
+     ""|n|no|NO) return 1;;
+              *) return 0;;
+  esac
+}
+
 # This is used in `Exit' and in the exit trap.  See comments in the latter
 # for more information,
 am__test_skipped=no
@@ -933,11 +943,6 @@ if test "$sh_errexit_works" = yes; then
   trap 'exit_status=$?
     set +e
     cd "$testbuilddir"
-    if test -n "$keep_testdirs"; then
-      keep_testdirs=yes
-    else
-      keep_testdirs=no
-    fi
     if test $am_using_tap = yes; then
       if test $have_tap_plan_ != yes && test $exit_status -eq 0; then
         plan_ "now"
@@ -960,7 +965,7 @@ if test "$sh_errexit_works" = yes; then
       esac
       test $exit_status -eq 0 || keep_testdirs=yes
     fi
-    test $keep_testdirs = no && rm_rf_ $testSubDir
+    am_keeping_testdirs || rm_rf_ $testSubDir
     set +x
     echo "$me: exit $exit_status"
     exit $exit_status
diff --git a/tests/depmod.tap b/tests/depmod.tap
index f2f59b4..e1fbef5 100755
--- a/tests/depmod.tap
+++ b/tests/depmod.tap
@@ -196,10 +196,12 @@ for vpath in simple long absolute; do
     # expected to be skipped (which ones exactly depends on the system),
     # thus causing the test directory not to be removed when the script
     # terminates.
-    case $keep_testdirs,$r0,$r1 in
-      ,ok,ok) rm_rf_ $depmode-$vpath.d;;
-      *) : For lesser shells with broken 'set -e';;
-    esac
+    if not am_keeping_testdirs && test "$r0,$r1" = ok,ok; then
+      rm_rf_ $depmode-$vpath.d \
+        || fatal_ "removing directory \`$depmode-$vpath.d'"
+    else
+      : For lesser shells with broken 'set -e'.
+    fi
 
   done
 done
diff --git a/tests/instspc.tap b/tests/instspc.tap
index 6f819ef..5486346 100755
--- a/tests/instspc.tap
+++ b/tests/instspc.tap
@@ -223,7 +223,7 @@ if test $# -gt 0; then
   unset n
 else
   test_names_list=$all_test_names_list
-  # Prefer static TAP plan if possible, minimizes the chance of errors.
+  # Prefer static TAP plan if possible, it minimizes the chance of errors.
   plan_ 94
 fi
 
@@ -295,10 +295,11 @@ for test_name in $test_names_list; do
     # with a too big test directory.  This is especially important since
     # some tests in this tests are expected to fail, and this will cause
     # the test directory not to be removed when the script terminates.
-    case $keep_testdirs,$r1 in
-      ,ok) rm_rf_ $depmode-$vpath.d;;
-        *) : For lesser shells with broken 'set -e';;
-    esac
+    if not am_keeping_testdirs && test "$r" = ok; then
+      rm_rf_ "$build" "$dest" || fatal_ "removing temporary subdirectory"
+    else
+      : For lesser shells with broken 'set -e'.
+    fi
 
   done # $instspc_action
 


hooks/post-receive
-- 
GNU Automake



reply via email to

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