test harness: improve catching of usage errors in script 'test-driver'
[platform/upstream/automake.git] / t / tap-fancy2.sh
old mode 100755 (executable)
new mode 100644 (file)
index bb51d54..c0742f1
@@ -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
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # TAP support: more unusual forms for valid TAP input.
-# See also related test 'tap-fancy.test'.
+# See also related test 'tap-fancy.sh'.
 
-am_parallel_tests=yes
-. ./defs || Exit 1
+. test-init.sh
 
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
 
 #
 # From manpage Test::Harness::TAP(3):
 #
-# ``Lines written to standard output matching /^(not )?ok\b/ must be
+#   Lines written to standard output matching /^(not )?ok\b/ must be
 #   interpreted as test lines. All other lines must not be considered
-#   test output.''
+#   test output.
 #
 # Unfortunately, the exact format of TODO and SKIP directives is not as
 # clearly described in that manpage; but a simple reverse-engineering of
@@ -109,7 +108,7 @@ xfail=130 # = 4 * 34 - 6
 xpass=130 # = 4 * 34 - 6
 skip=130  # = 4 * 34 - 6
 error=0
-total=`expr $pass + $fail + $xfail + $xpass + $skip`
+total=$(($pass + $fail + $xfail + $xpass + $skip))
 
 # Even nastier!  But accordingly to the specifics, it should still work.
 for result in 'ok' 'not ok'; do
@@ -118,19 +117,18 @@ done
 echo "ok{[(<#${tab}SKIP>)]}" >> all.test
 
 # We have to update some test counts.
-xfail=`expr $xfail + 1`
-xpass=`expr $xpass + 1`
-skip=`expr $skip + 1`
-total=`expr $total + 3`
+xfail=$(($xfail + 1))
+xpass=$(($xpass + 1))
+skip=$(($skip + 1))
+total=$(($total + 3))
 
 # And add the test plan!
 echo 1..$total >> all.test
 
-$MAKE check >stdout && { cat stdout; Exit 1; }
-cat stdout
+run_make -O -e FAIL check
 
-$EGREP '^(PASS|FAIL|SKIP).*#.*TODO' stdout && Exit 1
-$EGREP '^X?(PASS|FAIL).*#.*SKIP' stdout && Exit 1
+$EGREP '^(PASS|FAIL|SKIP).*#.*TODO' stdout && exit 1
+$EGREP '^X?(PASS|FAIL).*#.*SKIP' stdout && exit 1
 
 count_test_results total=$total pass=$pass fail=$fail skip=$skip \
                    xpass=$xpass xfail=$xfail error=$error