test harness: improve catching of usage errors in script 'test-driver'
[platform/upstream/automake.git] / t / parallel-tests-dry-run-2.sh
old mode 100755 (executable)
new mode 100644 (file)
index 0bd6523..efb96e1
@@ -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
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Check parallel-tests interactions with "make -n".
-# See also sister test 'parallel-tests-dry-run-1.test'.
+# Check interactions between the parallel test harness and "make -n".
+# See also sister test 'parallel-tests-dry-run-1.sh'.
 
-. ./defs || exit 1
+. test-init.sh
 
 cat >> configure.ac << 'END'
 AC_OUTPUT
@@ -37,8 +37,7 @@ $AUTOCONF
 make_n_ ()
 {
   st=0
-  $MAKE -n "$@" >output 2>&1 || { cat output; ls -l; exit 1; }
-  cat output
+  run_make -M -- -n "$@" || { ls -l; exit 1; }
   # Look out for possible errors from common tools used by recipes.
   $EGREP -i ' (exist|permission|denied|no .*(such|file))' output && exit 1
   $EGREP '(mv|cp|rm|cat|grep|sed|awk): ' output && exit 1
@@ -49,17 +48,18 @@ make_n_ ()
 
 files='foo.log bar.log foo.trs bar.trs'
 
-for target in check recheck test-suite.log; do
-  test ! -f foo.log
-  test ! -f foo.trs
-  test ! -f bar.log
-  test ! -f bar.trs
-  test ! -f test-suite.log
-done
-
 echo 'exit 0' > foo.test
 echo 'exit 1' > bar.test
 
+for target in check recheck test-suite.log; do
+  make_n_ $target
+  test ! -e foo.log
+  test ! -e foo.trs
+  test ! -e bar.log
+  test ! -e bar.trs
+  test ! -e test-suite.log
+done
+
 $MAKE check && exit 1
 
 chmod a-w .
@@ -101,9 +101,9 @@ rm -f foo.log bar.trs
 chmod a-w .
 for target in check recheck test-suite.log $files; do
   make_n_ $target
-  test ! -f foo.log
+  test ! -e foo.log
   test -f foo.trs
-  test ! -f bar.trs
+  test ! -e bar.trs
   test -f bar.log
 done