automake-patches
[Top][All Lists]
Advanced

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

Disable test cleanup trap with OSF1/Tru64 sh.


From: Ralf Wildenhues
Subject: Disable test cleanup trap with OSF1/Tru64 sh.
Date: Sun, 3 May 2009 09:45:52 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

The git master Automake testsuite still didn't work with Tru64 /bin/sh,
due to the shell messing up exit status values when both 'set -e' and an
EXIT trap were used.  One way out would be to use the shell that
configure chooses: CONFIG_SHELL gets set to /bin/ksh, which doesn't have
this bug.  However, since I'm so used to also run tests by just ./TEST
and that will choose /bin/sh anyway, I'm going to punt and just not
install a cleanup trap in this case.  The warning should tell the user
to "make clean" so those 300some MB worth of testsuite leftovers get
cleaned here, too.

Applied to master.  This makes the testsuite on a Tru64 5.1 go from two
XPASSes (i.e., all test results nonsensible), to a successful run, yay!

Cheers,
Ralf

    Disable test cleanup trap with OSF1/Tru64 sh.
    
    * configure.ac: Test whether /bin/sh has working 'set -e'
    in conjunction with an exit trap.  Set $am_cv_sh_errexit_works
    accordingly, substitute sh_errexit_works, and warn about
    leftover test directories with broken shells like Tru64 /bin/sh.
    * tests/defs.in: Do not install any traps with broken shells.

diff --git a/configure.ac b/configure.ac
index 4229d68..e3c8535 100644
--- a/configure.ac
+++ b/configure.ac
@@ -171,6 +171,23 @@ AC_SUBST([MODIFICATION_DELAY])
 AC_PROG_EGREP
 AC_PROG_FGREP
 
+AC_CACHE_CHECK([whether /bin/sh has working 'set -e' with exit trap],
+[am_cv_sh_errexit_works],
+[if /bin/sh -ec "trap 'exit \$?' 0; (exit 77); exit 77"; test $? = 77
+then
+  am_cv_sh_errexit_works=yes
+else
+  am_cv_sh_errexit_works=no
+fi
+])
+if test $am_cv_sh_errexit_works = no; then
+  AC_MSG_WARN([`${MAKE-make} check' will leave leftover directories 
tests/*.dir])
+  AC_MSG_WARN([you can clean them up manually using `${MAKE-make} clean' or])
+  AC_MSG_WARN([`cd tests && ${MAKE-make} clean-local-check'])
+  dnl restore font-lock: `
+fi
+AC_SUBST([sh_errexit_works], [$am_cv_sh_errexit_works])
+
 AC_CONFIG_FILES([
   Makefile
   doc/Makefile
diff --git a/tests/defs.in b/tests/defs.in
index d44ac9f..47e1c3a 100644
--- a/tests/defs.in
+++ b/tests/defs.in
@@ -251,21 +251,24 @@ chmod -R u+rwx $testSubDir > /dev/null 2>&1
 rm -rf $testSubDir > /dev/null 2>&1
 mkdir $testSubDir
 
-trap 'exit_status=$?
-  cd "$curdir"
-  case $exit_status,$keep_testdirs in
-  0,)
-    chmod -R a+rwx $testSubDir > /dev/null 2>&1
-    rm -rf "$testSubDir" ;;
-  esac
-  test "$signal" != 0 &&
-    echo "$as_me: caught signal $signal"
-  echo "$as_me: exit $exit_status"
-  exit $exit_status
-' 0
-for signal in 1 2 13 15; do
-  trap 'signal='$signal'; { Exit 1; }' $signal
-done
address@hidden@
+if test "$sh_errexit_works" = yes; then
+  trap 'exit_status=$?
+    cd "$curdir"
+    case $exit_status,$keep_testdirs in
+    0,)
+      chmod -R a+rwx $testSubDir > /dev/null 2>&1
+      rm -rf "$testSubDir" ;;
+    esac
+    test "$signal" != 0 &&
+      echo "$as_me: caught signal $signal"
+    echo "$as_me: exit $exit_status"
+    exit $exit_status
+  ' 0
+  for signal in 1 2 13 15; do
+    trap 'signal='$signal'; { Exit 1; }' $signal
+  done
+fi
 signal=0
 
 # Copy in some files we need.




reply via email to

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