tests: avoid '$MAKE' redirections, use 'run_make' instead
[platform/upstream/automake.git] / t / check-tests-in-builddir.sh
old mode 100755 (executable)
new mode 100644 (file)
index 9f1fe4a..2d71f70
@@ -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,7 +17,8 @@
 # Check that the testsuite driver can find test in the srcdir as
 # well as in builddir, and that is prefers those in the builddir.
 
-. ./defs || Exit 1
+# For gen-testsuite-part: ==> try-with-serial-tests <==
+. test-init.sh
 
 cat >> configure.ac << 'END'
 AC_OUTPUT
@@ -34,7 +35,7 @@ exit ${FOO_EXIT_STATUS-0}
 END
 chmod a+x foo.test
 
-unset FOO_EXIT_STATUS || :
+unset FOO_EXIT_STATUS
 
 $ACLOCAL
 $AUTOCONF
@@ -51,40 +52,38 @@ exit 0
 END
 chmod a+x bar.test
 
-$MAKE check >out 2>&1 || { cat out; Exit1; }
-cat out
-# The simple-tests driver does not strip VPATH components from
-# the name of the test, but the parallel-tests driver should.
-if test x"$am_parallel_tests" = x"yes"; then
-  grep '\.\./foo' out && Exit 1
-  grep '^PASS: foo.test *$' out
+run_make -M check
+# The serial test driver does not strip VPATH components from
+# the name of the test, but the parallel driver should.
+if test x"$am_serial_tests" = x"yes"; then
+  grep '^PASS: .*foo\.test *$' output
 else
-  grep '^PASS: .*foo.test *$' out
+  grep '\.\./foo' output && exit 1
+  grep '^PASS: foo\.test *$' output
 fi
-grep '^PASS: bar.test *$' out
+grep '^PASS: bar\.test *$' output
 
 rm -f test-suite.log foo.log bar.log
 
-FOO_EXIT_STATUS=1 $MAKE check >out 2>&1 && { cat out; Exit1; }
-cat out
-# See comments above.
-if test x"$am_parallel_tests" = x"yes"; then
-  grep '\.\./foo' out && Exit 1
-  grep '^FAIL: foo.test *$' out
+run_make -M -e FAIL FOO_EXIT_STATUS=1 check
+# The serial test driver does not strip VPATH components from
+# the name of the test, but the parallel driver should.
+if test x"$am_serial_tests" = x"yes"; then
+  grep '^FAIL: .*foo\.test *$' output
 else
-  grep '^FAIL: .*foo.test *$' out
+  grep '\.\./foo' output && exit 1
+  grep '^FAIL: foo\.test *$' output
 fi
-grep '^PASS: bar.test *$' out
+grep '^PASS: bar\.test *$' output
 
 rm -f test-suite.log foo.log bar.log
 
 # Check that if the same test is present in srcdir and builddir,
 # the one in builddir is preferred.
 cp bar.test foo.test
-FOO_EXIT_STATUS=1 $MAKE check >out 2>&1 || { cat out; Exit1; }
-cat out
-grep '^PASS: foo.test *$' out
-grep '^PASS: bar.test *$' out
+run_make -M FOO_EXIT_STATUS=1 check
+grep '^PASS: foo\.test *$' output
+grep '^PASS: bar\.test *$' output
 
 # The tests in the builddir must be preferred also by "make dist".
 FOO_EXIT_STATUS=1 $MAKE distcheck