test harness: improve catching of usage errors in script 'test-driver'
[platform/upstream/automake.git] / t / tap-signal.tap
old mode 100755 (executable)
new mode 100644 (file)
index cf5c945..f1a8130
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2011-2012 Free Software Foundation, Inc.
+# Copyright (C) 2011-2013 Free Software Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -17,8 +17,7 @@
 # TAP support:
 #  - a test script terminated by a signal causes an hard error
 
-am_parallel_tests=yes
-. ./defs || Exit 1
+. test-init.sh
 
 fetch_tap_driver
 
@@ -61,7 +60,7 @@ for sig in $all_signals; do
 END
   echo TESTS += signal-$sig.test >> Makefile.am
 done
-results_count=`ls *.test | wc -l | tr -d "$tab$sp"`
+results_count=$(ls *.test | wc -l | tr -d "$tab$sp")
 
 chmod a+x *.test
 
@@ -71,7 +70,7 @@ $AUTOMAKE
 
 ./configure
 
-system=`uname -s -r || echo unknown` # Needed later.
+system=$(uname -s -r || echo unknown) # Needed later.
 
 signal_caught ()
 {
@@ -109,19 +108,18 @@ signal_caught ()
 
 command_ok_ '"make check" fails' eval '
   (
-    st=0; $MAKE check >stdout || st=$?
-    cat stdout
+    run_make -e IGNORE -O check
     # Extra "echo" and silencing of xtraces required to avoid possible
     # garbled output with NetBSD make, which would miss some final
     # newlines in the expected places and thus mess up our TAP output.
     set +x; echo
-    test $st -gt 0
+    test $am_make_rc -gt 0
   )
 '
 cat stdout # For debugging.
 
 command_ok_ "count of test results" count_test_results \
-  total=`expr $results_count '*' 2` \
+  total=$(($results_count * 2)) \
   pass=$results_count error=$results_count \
   fail=0 xpass=0 xfail=0 skip=0
 
@@ -131,8 +129,7 @@ done
 
 echo 'TEST_LOG_DRIVER_FLAGS = --ignore-exit' >> Makefile
 
-command_ok_ '"make check" passes [--ignore-exit]' eval '$MAKE check >stdout'
-cat stdout # For debugging.
+command_ok_ '"make check" passes [--ignore-exit]' run_make -O check
 
 command_ok_ "count of test results [--ignore-exit]" count_test_results \
   total=$results_count pass=$results_count \