]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
test defs: small cleanups and tweakings
authorStefano Lattarini <stefano.lattarini@gmail.com>
Mon, 8 Aug 2011 14:37:36 +0000 (16:37 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Mon, 8 Aug 2011 16:46:43 +0000 (18:46 +0200)
* tests/defs: Where possible, prefer `framework_failure_' or
`fatal_' to `Exit 99'.  Try to catch more possible hard errors
and setup failures.  Do not hide expected error messages.  Avoid
a couple of forks when copying files from `$(top_srcdir)/lib'.
($signal): Remove, no more needed.

ChangeLog
tests/defs

index b3e9573b069bfe542c77c14df468b2f7479a029c..3d2824aff4f0bd2d938bb1263ad0a5fac2042d21 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2011-08-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       test defs: small cleanups and tweakings
+       * tests/defs: Where possible, prefer `framework_failure_' or
+       `fatal_' to `Exit 99'.  Try to catch more possible hard errors
+       and setup failures.  Do not hide expected error messages.  Avoid
+       a couple of forks when copying files from `$(top_srcdir)/lib'.
+       ($signal): Remove, no more needed.
+
 2011-08-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        testsuite: improve interface for giving early TAP plan
index 8db108437830842ec26639b142ec66387e6c3964..dc2fee7406e328298def10a7b28075c7252e6a39 100644 (file)
@@ -281,8 +281,7 @@ using_gmake ()
         return 1
       fi;;
     *)
-      echo "invalid value for \$am__using_gmake: '$am__using_gmake'" >&2
-      Exit 99;;
+      fatal_ "invalid value for \$am__using_gmake: '$am__using_gmake'";;
   esac
 }
 am__using_gmake="" # Avoid interferences from the environment.
@@ -607,9 +606,11 @@ do
       # Skip this test case if the user is root.
       # We try to append to a read-only file to detect this.
       priv_check_temp=priv-check.$$
-      touch $priv_check_temp || exit 99
-      chmod a-w $priv_check_temp || exit 99
-      (echo foo >> $priv_check_temp) >/dev/null 2>&1
+      touch $priv_check_temp && chmod a-w $priv_check_temp \
+        || framework_failure_ "creating unwritable file $priv_check_temp"
+      # Not a useless use of subshell: lesser shells like Solaris /bin/sh
+      # can exit if a builtin fails.
+      (echo foo >> $priv_check_temp)
       overwrite_status=$?
       rm -f $priv_check_temp
       if test $overwrite_status -eq 0; then
@@ -634,9 +635,11 @@ do
       # Skip this test case if read-only directories aren't supported
       # (e.g., under DOS.)
       ro_dir_temp=ro_dir.$$
-      mkdir $ro_dir_temp || exit 99
-      chmod a-w $ro_dir_temp || exit 99
-      (: > $ro_dir_temp/probe) >/dev/null 2>/dev/null
+      mkdir $ro_dir_temp && chmod a-w $ro_dir_temp \
+        || framework_failure_ "creating unwritable directory $ro_dir_temp"
+      # Not a useless use of subshell: lesser shells like Solaris /bin/sh
+      # can exit if a builtin fails.
+      (: > $ro_dir_temp/probe)
       create_status=$?
       rm -rf $ro_dir_temp
       if test $create_status -eq 0; then
@@ -813,7 +816,7 @@ distdir=$me-1.0
 testSubDir=$me.dir
 
 test ! -d $testSubDir || rm_rf_ $testSubDir
-mkdir $testSubDir
+mkdir $testSubDir || framework_failure_ "creating test subdirectory"
 
 cd ./$testSubDir
 
@@ -853,20 +856,19 @@ if test "$sh_errexit_works" = yes; then
     fi
     test $keep_testdirs = no && rm_rf_ $testSubDir
     set +x
-    test "$signal" != 0 && echo "$me: caught signal $signal"
     echo "$me: exit $exit_status"
     exit $exit_status
   ' 0
   for signal in 1 2 13 15; do
-    trap 'signal='$signal'; { Exit 99; }' $signal
+    trap "fatal_ 'caught signal $signal'" $signal
   done
-  signal=0
+  unset signal
 fi
 
 # Copy in some files we need.
-for file in install-sh missing depcomp; do
-   cp "$top_testsrcdir/lib/$file" . || Exit 99
-done
+cp "$top_testsrcdir"/lib/install-sh "$top_testsrcdir"/lib/missing \
+   "$top_testsrcdir"/lib/depcomp . \
+  || framework_failure_ "fetching common files from lib/"
 
 # Build appropriate environment in test directory.  Eg create
 # configure.in, touch all necessary files, etc.