]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
tests: avoid spurious failures in cross-compile mode
authorStefano Lattarini <stefano.lattarini@gmail.com>
Sun, 15 May 2011 14:33:01 +0000 (16:33 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Thu, 19 May 2011 20:11:44 +0000 (22:11 +0200)
* tests/depcomp2.test: Ensure verbose printing of captured stderr
from configure.
* tests/ansi3.test ($required): Add 'native', as the ansi2knr
functionality is not meant to work with a cross-compiler.
* tests/ansi3b.test: Likewise.
* tests/ansi5.test: Likewise.
* tests/ansi6.test: Likewise.
* tests/ansi7.test: Likewise.
* tests/ansi8.test: Likewise.
* tests/ansi10.test: Likewise.
* tests/subobj3.test: Likewise.
* tests/check8.test ($required): Add 'native', as this test is
not meant to work with a cross-compiler.
* tests/gnits2.test: Likewise.
* tests/ltconv.test: Likewise.
* tests/ltcond2.test: Likewise.
* tests/parallel-tests5.test: Likewise.
* tests/specflg7.test: Likewise.
* tests/specflg8.test: Likewise.
* tests/check5.test: Likewise.  Also, ensure verbose printing of
captured make output, and thrown in few cosmetic and consistency
improvements.
* tests/ltinit.test: Be laxer in grepping configure output, to
avoid spurious failures on systems which lack POSIX dynamic
linking (e.g., MinGW), or when cross-compiling for such systems.
* tests/ansi9.test: Skip parts of the test that would require a
native compiler.
* tests/backcompat6.test: Likewise.
* tests/depcomp8a.test: Likewise.
* tests/pr401.test: Likewise.
* tests/pr401b.test: Likewise.
* tests/pr401c.test: Likewise.
* tests/target-cflags.test: Likewise.
* tests/lex3.test: Likewise.
* tests/yacc-basic.test: Likewise.
* tests/autohdr4.test: Likewise.  Also, extend the test to ensure
more coverage in cross-compile mode.
* tests/canon7.test: Likewise.
* tests/check9.test: Removed, split into two new tests ...
* tests/check-subst-prog.test: ... this one, which requires a
native C compiler ...
* tests/check-subst.test: ... and this one, which doesn't require
any compiler.
* tests/parallel-tests4.test: Removed, split into two new tests ...
* tests/parallel-tests-suffix-prog.test: ... this one, which
requires a native C compiler ...
* tests/parallel-tests-suffix.test: ... and this one, which
doesn't require any compiler.
* tests/parallel-tests7.test: Removed, split into two new tests ...
* tests/parallel-tests-ext-driver-prog.test: ... this one, which
requires a native C compiler ...
* tests/parallel-tests-ext-driver.test: ... and this one, which
doesn't require any compiler.
* tests/Makefile.am (TESTS): Update.

37 files changed:
ChangeLog
tests/Makefile.am
tests/Makefile.in
tests/ansi10.test
tests/ansi3.test
tests/ansi3b.test
tests/ansi5.test
tests/ansi6.test
tests/ansi7.test
tests/ansi9.test
tests/autohdr4.test
tests/backcompat6.test
tests/canon7.test
tests/check-subst-prog.test [moved from tests/check9.test with 87% similarity]
tests/check-subst.test [new file with mode: 0755]
tests/check5.test
tests/check8.test
tests/depcomp2.test
tests/depcomp8a.test
tests/gnits2.test
tests/lex3.test
tests/ltcond2.test
tests/ltconv.test
tests/ltinit.test
tests/parallel-tests-ext-driver-prog.test [moved from tests/parallel-tests7.test with 77% similarity]
tests/parallel-tests-ext-driver.test [new file with mode: 0755]
tests/parallel-tests-suffix-prog.test [new file with mode: 0755]
tests/parallel-tests-suffix.test [moved from tests/parallel-tests4.test with 85% similarity]
tests/parallel-tests5.test
tests/pr401.test
tests/pr401b.test
tests/pr401c.test
tests/specflg7.test
tests/specflg8.test
tests/subobj3.test
tests/target-cflags.test
tests/yacc-basic.test

index be9e8768006018a0111f92e8eb4c2269712b3db1..55d1694dd59df2e755d069f9da0d7ebe0451833a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,61 @@
+2011-05-18  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: avoid spurious failures in cross-compile mode
+       * tests/depcomp2.test: Ensure verbose printing of captured stderr
+       from configure.
+       * tests/ansi3.test ($required): Add 'non-cross', as the ansi2knr
+       functionality is not meant to work with a cross-compiler.
+       * tests/ansi3b.test: Likewise.
+       * tests/ansi5.test: Likewise.
+       * tests/ansi6.test: Likewise.
+       * tests/ansi7.test: Likewise.
+       * tests/ansi8.test: Likewise.
+       * tests/ansi10.test: Likewise.
+       * tests/subobj3.test: Likewise.
+       * tests/check8.test ($required): Add 'non-cross', as this test
+       is not meant to work with a cross-compiler.
+       * tests/gnits2.test: Likewise.
+       * tests/ltconv.test: Likewise.
+       * tests/ltcond2.test: Likewise.
+       * tests/parallel-tests5.test: Likewise.
+       * tests/specflg7.test: Likewise.
+       * tests/specflg8.test: Likewise.
+       * tests/check5.test: Likewise.  Also, ensure verbose printing of
+       captured make output, and thrown in few cosmetic and consistency
+       improvements.
+       * tests/ltinit.test: Be laxer in grepping configure output, to
+       avoid spurious failures on systems which lack POSIX dynamic
+       linking (e.g., MinGW), or when cross-compiling for such systems.
+       * tests/ansi9.test: Skip parts of the test that would require a
+       native compiler.
+       * tests/backcompat6.test: Likewise.
+       * tests/depcomp8a.test: Likewise.
+       * tests/pr401.test: Likewise.
+       * tests/pr401b.test: Likewise.
+       * tests/pr401c.test: Likewise.
+       * tests/target-cflags.test: Likewise.
+       * tests/lex3.test: Likewise.
+       * tests/yacc-basic.test: Likewise.
+       * tests/autohdr4.test: Likewise.  Also, extend the test to ensure
+       more coverage in cross-compile mode.
+       * tests/canon7.test: Likewise.
+       * tests/check9.test: Removed, split into two new tests ...
+       * tests/check-subst-prog.test: ... this one, which requires a
+       native C compiler ...
+       * tests/check-subst.test: ... and this one, which doesn't require
+       any compiler.
+       * tests/parallel-tests4.test: Removed, split into two new tests ...
+       * tests/parallel-tests-suffix-prog.test: ... this one, which
+       requires a native C compiler ...
+       * tests/parallel-tests-suffix.test: ... and this one, which
+       doesn't require any compiler.
+       * tests/parallel-tests7.test: Removed, split into two new tests ...
+       * tests/parallel-tests-ext-driver-prog.test: ... this one, which
+       requires a native C compiler ...
+       * tests/parallel-tests-ext-driver.test: ... and this one, which
+       doesn't require any compiler.
+       * tests/Makefile.am (TESTS): Update.
+
 2011-05-19  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        test defs: rename requirement 'non-cross' -> 'native'
index 20552111d0d6eada2e4d31dc5ea15f05c983c28c..954141bf8bd64932c12ed754aec38eab16f4cf18 100644 (file)
@@ -247,10 +247,11 @@ check5.test \
 check6.test \
 check7.test \
 check8.test \
-check9.test \
 check10.test \
 check11.test \
 check12.test \
+check-subst.test \
+check-subst-prog.test \
 check-exported-srcdir.test \
 check-tests-in-builddir.test \
 check-tests_environment.test \
@@ -723,13 +724,15 @@ parallel-am3.test \
 parallel-tests.test \
 parallel-tests2.test \
 parallel-tests3.test \
-parallel-tests4.test \
 parallel-tests5.test \
 parallel-tests6.test \
-parallel-tests7.test \
 parallel-tests8.test \
 parallel-tests9.test \
 parallel-tests10.test \
+parallel-tests-suffix.test \
+parallel-tests-suffix-prog.test \
+parallel-tests-ext-driver.test \
+parallel-tests-ext-driver-prog.test \
 parallel-tests-am_tests_environment.test \
 parallel-tests-unreadable-log.test \
 parallel-tests-subdir.test \
index e672e90ff26b7691712ab8833347c03f59b860e8..74d207fdf60551b984e20829c438e6760613e0e4 100644 (file)
@@ -299,14 +299,14 @@ XFAIL_TESTS = all.test auxdir2.test cond17.test gcj6.test \
        yacc-dist-nobuild-subdir.test txinfo5.test \
        $(instspc_xfail_tests)
 parallel_tests = backcompat5-p.test check-exported-srcdir-p.test \
+       check-subst-prog-p.test check-subst-p.test \
        check-tests-in-builddir-p.test check-tests_environment-p.test \
        check-p.test check10-p.test check11-p.test check12-p.test \
        check2-p.test check3-p.test check4-p.test check5-p.test \
-       check6-p.test check7-p.test check8-p.test check9-p.test \
-       color-p.test color2-p.test comment9-p.test dejagnu-p.test \
-       exeext4-p.test maken3-p.test maken4-p.test \
-       posixsubst-tests-p.test pr401-p.test pr401b-p.test \
-       pr401c-p.test
+       check6-p.test check7-p.test check8-p.test color-p.test \
+       color2-p.test comment9-p.test dejagnu-p.test exeext4-p.test \
+       maken3-p.test maken4-p.test posixsubst-tests-p.test \
+       pr401-p.test pr401b-p.test pr401c-p.test
 instspc_tests = build-squote.instspc install-squote.instspc \
        build-dquote.instspc install-dquote.instspc \
        build-bquote.instspc install-bquote.instspc \
@@ -508,10 +508,11 @@ check5.test \
 check6.test \
 check7.test \
 check8.test \
-check9.test \
 check10.test \
 check11.test \
 check12.test \
+check-subst.test \
+check-subst-prog.test \
 check-exported-srcdir.test \
 check-tests-in-builddir.test \
 check-tests_environment.test \
@@ -984,13 +985,15 @@ parallel-am3.test \
 parallel-tests.test \
 parallel-tests2.test \
 parallel-tests3.test \
-parallel-tests4.test \
 parallel-tests5.test \
 parallel-tests6.test \
-parallel-tests7.test \
 parallel-tests8.test \
 parallel-tests9.test \
 parallel-tests10.test \
+parallel-tests-suffix.test \
+parallel-tests-suffix-prog.test \
+parallel-tests-ext-driver.test \
+parallel-tests-ext-driver-prog.test \
 parallel-tests-am_tests_environment.test \
 parallel-tests-unreadable-log.test \
 parallel-tests-subdir.test \
@@ -1664,6 +1667,8 @@ uninstall-am:
 
 backcompat5-p.log: backcompat5.test
 check-exported-srcdir-p.log: check-exported-srcdir.test
+check-subst-prog-p.log: check-subst-prog.test
+check-subst-p.log: check-subst.test
 check-tests-in-builddir-p.log: check-tests-in-builddir.test
 check-tests_environment-p.log: check-tests_environment.test
 check-p.log: check.test
@@ -1677,7 +1682,6 @@ check5-p.log: check5.test
 check6-p.log: check6.test
 check7-p.log: check7.test
 check8-p.log: check8.test
-check9-p.log: check9.test
 color-p.log: color.test
 color2-p.log: color2.test
 comment9-p.log: comment9.test
index a21d6ca230a230d5bc453dbd651bdbdd7c861ab7..5cba1ce96e5cfa066461043f0e601e0d39a211cd 100755 (executable)
@@ -16,6 +16,7 @@
 
 # Make sure ansi2knr works with $(LIBOBJS).
 
+required=native
 . ./defs || Exit 1
 
 cat >> configure.in << 'END'
index 233e3785baf8d772e0f4e5c98262f51a01d6a770..f41035cd1791e57cbf1ec2f2991d3fb269041eac 100755 (executable)
@@ -17,6 +17,7 @@
 
 # Actual test of ansi2knr functionality.
 
+required=native
 . ./defs || Exit 1
 
 cat >> configure.in << 'END'
index 3a5bedf7498fa57ddeae09d4f072da523654053c..59eef0882bd414c353d9143233e5bdddb83cec86 100755 (executable)
@@ -19,6 +19,7 @@
 # of working gcc.  Same as ansi3.test, but with AUTOMAKE_OPTIONS
 # defined in configure.in.
 
+required=native
 . ./defs || Exit 1
 
 cat > configure.in << 'END'
index 967f77249901536b7c5a0cf9102b1eb4c170b9b1..b29183c06664e2894ca051935e7b406275cba50d 100755 (executable)
@@ -16,6 +16,7 @@
 
 # Test for ansi2knr in another directory.
 
+required=native
 . ./defs || Exit 1
 
 cat > configure.in << 'END'
index c29d7b8597d4b359f3a0a390fa61949810561e7a..2a25ee1d2321d921b6566bb236f7e17eccba7599 100755 (executable)
@@ -17,6 +17,7 @@
 # Check ansi2knr on a source file in subdirectory.
 # From Kevin Ryde.
 
+required=native
 . ./defs || Exit 1
 
 cat > configure.in << 'END'
index d73e9eb97bf972e9310c469ff08f097722797652..3b0a37f1a0ca63c300ae06b598248bb18c4f4c9d 100755 (executable)
@@ -18,6 +18,7 @@
 # ansi6.test is the same test without subdir-objects.
 # From Kevin Ryde.
 
+required=native
 . ./defs || Exit 1
 
 cat > configure.in << 'END'
index b57234d862effaecc14587d1728864b2ec50a7fb..aba430d9993a59034b068f010f933eeb83696586 100755 (executable)
@@ -54,6 +54,13 @@ $FGREP 'loadavg-loadavg$U.o: loadavg$U.c' Makefile.in
 # The following rule should not exist, because the
 # default .o.c: inference rule is enough.
 $FGREP 'sub/sub$U.o: sub/sub$U.c' Makefile.in && Exit 1
-# Force ansi2knr's use, regardless of the compiler.
-./configure ac_cv_prog_cc_stdc=no
-$MAKE sub/sub_.c
+
+if cross_compiling; then
+  :
+else
+  # Force ansi2knr's use, regardless of the compiler.
+  ./configure ac_cv_prog_cc_stdc=no
+  $MAKE sub/sub_.c
+fi
+
+:
index feee80de8d7314e488b958cd5555657d69cb95f6..d9bacd3ac0419c9b86476f1bad1f88d9fb3f2ec8 100755 (executable)
@@ -32,8 +32,18 @@ mkdir sub1 sub2 sub3
 
 : > sub1/config.top
 echo '#define NAME "grepme1"' >sub2/config.bot
-echo SUBDIRS = sub3 >Makefile.am
-echo noinst_PROGRAMS = run >sub3/Makefile.am
+
+cat > Makefile.am <<'END'
+SUBDIRS = sub3
+.PHONY: test-prog-updated
+test-prog-updated:
+       stat older sub3/run$(EXEEXT) || : For debugging.
+       test `ls -t older sub3/run$(EXEEXT) | sed 1q` = sub3/run$(EXEEXT)
+END
+
+cat > sub3/Makefile.am <<'END'
+noinst_PROGRAMS = run
+END
 
 cat >sub3/run.c <<'EOF'
 #include <defs.h>
@@ -56,12 +66,15 @@ $AUTOMAKE
 # Do not reject slow dependency extractors: we need dependency tracking.
 ./configure --enable-dependency-tracking
 $MAKE
-sub3/run | grep grepme1
+# Sanity check.
+cross_compiling || { sub3/run | grep grepme1; }
 
+: > older
 $sleep
 echo '#define NAME "grepme2"' > sub2/config.bot
 $MAKE
-sub3/run | grep grepme2
+cross_compiling || { sub3/run | grep grepme2; }
+$MAKE test-prog-updated
 
 $MAKE distcheck
 
index 389bc4ba4ef6c0356a903561c4b58961425d04f5..8db46303f170b8bdc57f0d7784048fdc25c0aa98 100755 (executable)
@@ -16,7 +16,7 @@
 
 # Backward-compatibility test: try to build and distribute a package
 # using obsoleted forms of AC_INIT, AM_INIT_AUTOMAKE and AC_OUTPUT.
-# This script can also serve as mild stress-testing for Automke.
+# This script can also serve as mild stress-testing for Automake.
 # See also the similar test `backcompat5.test'.
 
 . ./defs || Exit 1
@@ -36,6 +36,7 @@ three=3
 AC_SUBST(three)
 AC_PROG_CC
 AC_CONFIG_HEADERS(config.h:config.hin)
+AM_CONDITIONAL(CROSS_COMPILING, test "$cross_compiling" = yes)
 AC_OUTPUT(Makefile foo.got:foo1.in:foo2.in:foo3.in)
 END
 
@@ -54,12 +55,14 @@ foo_SOURCES = quux.c
 check-local:
        test x'$(PACKAGE)' = x'nonesuch-zardoz'
        test x'$(VERSION)' = x'nonesuch-0.1'
+if ! CROSS_COMPILING
        ./foo
        ## Do not anchor the regexps w.r.t. the end of line, because on
        ## MinGW/MSYS, grep may assume LF line endings only, while our
        ## `foo' program may generate CRLF line endings.
        ./foo | grep '^PACKAGE = nonesuch-zardoz!'
        ./foo | echo '^VERSION = nonesuch-0\.1!'
+endif
 END
 
 cat > quux.c <<'END'
index 32b607c2540b5894330a72969125cff9b7eac308..8df283c2d273d06e7478455d0558a8252cf2412d 100755 (executable)
@@ -23,6 +23,7 @@ cat >> configure.in << 'END'
 AC_PROG_CC
 AC_PROG_RANLIB  dnl: for static libraries
 AC_PROG_LIBTOOL dnl: for libtool libraries
+AM_CONDITIONAL([CROSS_COMPILING], [test "$cross_compiling" = yes])
 AC_OUTPUT
 END
 
@@ -49,12 +50,18 @@ lib_zardoz___la_SOURCES = libd.c
 
 check-local:
        ls -l
+if CROSS_COMPILING
+       test -f ./,foo-bar$(EXEEXT)
+       test -f ./dummy_static$(EXEEXT)
+       test -f ./dummy_dynamic$(EXEEXT)
+else !CROSS_COMPILING
        ./,foo-bar
        ./dummy_static
        ./dummy_dynamic
        ./,foo-bar | grep 'Hello, FooBar!'
        ./dummy_static | grep 'Hello from Static!'
        ./dummy_dynamic | grep 'Hello from Dynamic!'
+endif !CROSS_COMPILING
 END
 
 cat > foobar.c << 'END'
similarity index 87%
rename from tests/check9.test
rename to tests/check-subst-prog.test
index 07ea4e42f1c7c82e7f40cbddfcb1c785afe1afbc..bda0629b22ed3f02b79b472e8888ae437766221e 100755 (executable)
 # 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 @substituted@ TESTS.
-# Note that in this test, we rely on the .test extension for the
-# substituted names: this is necessary for parallel-tests.
+# Check @substituted@ TESTS, some of which are also PROGRAMS.
+# See also sister test `check-subst.test'.
 
+required=native
 . ./defs || Exit 1
 
 cat >> configure.in << 'END'
@@ -35,11 +35,11 @@ check_PROGRAMS = pass-prog xfail-prog @prog_tests@
 EXTRA_PROGRAMS = subst-pass-prog.test subst-xfail-prog.test
 END
 
-cat >>pass-script.test <<'END'
+cat > pass-script.test <<'END'
 #! /bin/sh
 exit 0
 END
-cat >>xfail-script.test <<'END'
+cat > xfail-script.test <<'END'
 #! /bin/sh
 exit 1
 END
@@ -47,10 +47,10 @@ chmod a+x pass-script.test xfail-script.test
 cp pass-script.test subst-pass-script.test
 cp xfail-script.test subst-xfail-script.test
 
-cat >>pass-prog.c <<'END'
+cat > pass-prog.c <<'END'
 int main() { return 0; }
 END
-cat >>xfail-prog.c <<'END'
+cat > xfail-prog.c <<'END'
 #include <stdlib.h>
 int main() { return EXIT_FAILURE; }
 END
@@ -73,4 +73,5 @@ cd build
 $MAKE all
 $MAKE check
 $MAKE distclean
+
 :
diff --git a/tests/check-subst.test b/tests/check-subst.test
new file mode 100755 (executable)
index 0000000..63ed689
--- /dev/null
@@ -0,0 +1,87 @@
+#! /bin/sh
+# Copyright (C) 2008, 2009, 2010, 2011 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
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# 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 @substituted@ TESTS.
+# Note that in this test, we rely on the .test extension for the
+# substituted names: this is necessary for parallel-tests.
+# See also sister test `check-subst-prog.test'.
+
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_SUBST([script_tests], ['subst-pass-script.sh subst-xfail-script.sh'])
+AC_SUBST([xfail_tests], ['xfail-script.test subst-xfail-script.sh'])
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+TESTS = pass-script.test xfail-script.test @script_tests@
+XFAIL_TESTS = @xfail_tests@
+END
+
+if test "$parallel_tests" = yes; then
+  unindent >> Makefile.am <<'END'
+    TEST_EXTENSIONS = .sh .test
+    SH_LOG_COMPILER = $(SHELL)
+END
+fi
+
+cat > pass-script.test <<'END'
+#! /bin/sh
+exit 0
+END
+cat > xfail-script.test <<'END'
+#! /bin/sh
+exit 1
+END
+cp pass-script.test subst-pass-script.sh
+cp xfail-script.test subst-xfail-script.sh
+chmod a+x pass-script.test xfail-script.test
+
+if test "$parallel_tests" != yes; then
+  chmod a+x subst-pass-script.sh subst-xfail-script.sh
+fi
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+for vpath in false : ; do
+
+  if $vpath; then
+    mkdir build
+    cd build
+    srcdir=..
+  else
+    srcdir=.
+  fi
+
+  $srcdir/configure
+  $MAKE all
+  $MAKE check
+  if test "$parallel_tests" = yes; then
+    ls -l
+    test -f pass-script.log
+    test -f xfail-script.log
+    test -f subst-pass-script.log
+    test -f subst-xfail-script.log
+  fi
+  $MAKE distclean
+  cd $srcdir
+
+done
+
+:
index 2db74d18d4dfc65ad565e49a27acfa2f1250fbf9..639f343427e40e89ffad7c831b3acfc2644bf9cf 100755 (executable)
@@ -17,6 +17,7 @@
 
 # Test TESTS = $(check_PROGRAMS)
 
+required=native
 . ./defs || Exit 1
 
 cat >> configure.in << 'END'
@@ -31,6 +32,7 @@ check-local:
        test -f one$(EXEEXT)
        test -f two$(EXEEXT)
        touch ok
+.PHONY: print-tests
 print-tests:
        echo BEG: $(TESTS) :END
 END
@@ -39,17 +41,22 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -a
 
-cat >one.c <<END
-int main() { return 0; }
+cat > one.c << 'END'
+int main (void)
+{
+  return 0;
+}
 END
 cp one.c two.c
 
 ./configure
 $MAKE check
 test -f ok
-EXEEXT=.bin $MAKE -e print-tests >output
-cat output
+EXEEXT=.bin $MAKE -e print-tests >stdout || { cat stdout; Exit 1; }
+cat stdout
+$FGREP 'BEG: one.bin two.bin :END' stdout
 # No am__EXEEXT_* variable is needed.
 grep '_EXEEXT_[1-9]' Makefile.in && Exit 1
-grep 'BEG: one.bin two.bin :END' output
 $FGREP 'TESTS = $(check_PROGRAMS)' Makefile.in
+
+:
index 4ff71a77aa5e92af1cdffa25d29ef63ac964aa1c..c8711e85f1a57dff2f3fc54a88e891fc984cb0ce 100755 (executable)
@@ -16,6 +16,7 @@
 
 # Check subdir TESTS.
 
+required=native
 . ./defs || Exit 1
 
 cat >> configure.in << 'END'
@@ -93,4 +94,5 @@ grep '^[^X]*PASS.*bar' stdout
 grep '^[^X]*PASS.*sub/bar' stdout
 grep '^[^X]*FAIL.*baz' stdout
 grep 'XFAIL.*sub/baz' stdout
+
 :
index 176a31eae724d18c0def871f9237cf577348c566..63398db5326342d6928db49040101049c089d4f3 100755 (executable)
@@ -43,6 +43,7 @@ $ACLOCAL
 $AUTOMAKE --add-missing
 $AUTOCONF
 ./configure 2>stderr || { cat stderr >&2; Exit 1; }
+cat stderr >&2
 test ! -s stderr
 
 :
index 0f9b7f55730bdb4484643127d8e188cfc3a7dbb7..06544d8303ba1354d19aca5310bc97aba1b4ebd0 100755 (executable)
@@ -54,7 +54,7 @@ $AUTOCONF
 # Don't reject slower dependency extractors, for better coverage.
 ./configure --enable-dependency-tracking
 $MAKE
-./zardoz
+cross_compiling || ./zardoz
 $MAKE DISTCHECK_CONFIGURE_FLAGS='--enable-dependency-tracking' distcheck
 
 # Try again with subdir-objects option.
@@ -73,7 +73,7 @@ $AUTOCONF
 # Don't reject slower dependency extractors, for better coverage.
 ./configure --enable-dependency-tracking
 $MAKE
-./zardoz
+cross_compiling || ./zardoz
 $MAKE DISTCHECK_CONFIGURE_FLAGS='--enable-dependency-tracking' distcheck
 
 :
index 26e8747d7b9439014e426989b52e164463020adc..1b60387b34022bf04e89aafb97475a76323ece91 100755 (executable)
@@ -17,6 +17,7 @@
 
 # Test to ensure std-options checking is correct.
 
+required=native
 . ./defs || Exit 1
 
 cat >> configure.in << 'END'
index b10a6cbf09d64e485bb73bd4ef32cad6cf2e9d77..2b7f3d15afc0842d103467d247e3ce85b50b3c21 100755 (executable)
@@ -59,8 +59,10 @@ $AUTOMAKE -a
 
 # Program should build and run.
 $MAKE
-echo GOOD | ./foo
-echo BAD | ./foo && Exit 1
+if cross_compiling; then :; else
+  echo GOOD | ./foo
+  echo BAD | ./foo && Exit 1
+fi
 
 # The generated file `foo.c' must be shipped.
 $MAKE distdir
index 10e155e4866d7fffce0a3c89f2bead30b8d6ac13..b917eb4b79336c3b2f7d80e3f280f555f979cd03 100755 (executable)
@@ -16,7 +16,7 @@
 
 # Test for bug in conditionals.
 
-required=libtoolize
+required='native libtoolize'
 . ./defs || Exit 1
 
 cat >> configure.in << 'END'
index 208e2adf7c9dfa2f4edf3292d355b4faa4564776..65ee86ded99f54826e77b35b9222efe36a5bdca4 100755 (executable)
@@ -17,7 +17,7 @@
 # Test for libtool convenience libraries.
 # This example is taken from the manual.
 
-required=libtoolize
+required='native libtoolize'
 . ./defs || Exit 1
 
 cat >>configure.in <<'END'
index e541431dc4140ea0157fad5d50d98b161667a2b2..189e5c26c807b28451a415b64efd0abfba425d54 100755 (executable)
@@ -57,7 +57,7 @@ $AUTOMAKE -a
 cwd=`pwd`
 ./configure --prefix="$cwd/inst" >stdout || { cat stdout; Exit 1; }
 cat stdout
-grep '^checking.*dlopen' stdout
+grep '^checking.*dlfcn\.h.* no$' stdout || grep '^checking.*dlopen' stdout
 
 $MAKE
 $MAKE install
similarity index 77%
rename from tests/parallel-tests7.test
rename to tests/parallel-tests-ext-driver-prog.test
index c29d32c21ed748567891caf044fbe3420abba4d2..fca4746cf11ce834b00029e34d1882dfa1315950 100755 (executable)
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Check parallel-tests features:
-# - per-extension test drivers
+# - per-extension test drivers (xxx_LOG_COMPILER and xxx_LOG_FLAGS),
+#   when some tests are PROGRAMS.
+# See also related test 'parallel-tests-ext-driver.test'.
 
 parallel_tests=yes
+required=native
 . ./defs || Exit 1
+
 cat >> configure.in << 'END'
 AC_PROG_CC
 AC_OUTPUT
@@ -77,12 +81,14 @@ $AUTOCONF
 $AUTOMAKE -a
 
 ./configure
-$MAKE
-$MAKE check
-grep 'chk-driver  *1  *2' foo.log
-grep 'test-driver  *3  *4' bar.log
-grep 'noext-driver  *5  *6' baz.log
-grep 'test-driver  *3  *4' bla.log
-grep 'noext-driver  *5  *6' bli.suff.log
-grep 'noext-driver  *5  *6' sub/test.log
+$MAKE check || { cat test-suite.log; Exit 1; }
+ls -l . sub
+cat test-suite.log
+grep 'chk-driver  *1  *2 ' foo.log
+grep 'test-driver  *3  *4 ' bar.log
+grep 'noext-driver  *5  *6 ' baz.log
+grep 'test-driver  *3  *4 ' bla.log
+grep 'noext-driver  *5  *6 ' bli.suff.log
+grep 'noext-driver  *5  *6 ' sub/test.log
+
 :
diff --git a/tests/parallel-tests-ext-driver.test b/tests/parallel-tests-ext-driver.test
new file mode 100755 (executable)
index 0000000..b53ccdb
--- /dev/null
@@ -0,0 +1,136 @@
+#! /bin/sh
+# Copyright (C) 2009, 2010, 2011 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
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# 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 features:
+# - per-extension test drivers (xxx_LOG_COMPILER and xxx_LOG_FLAGS),
+#   also with AC_SUBST'd stuff.
+# See also related test 'parallel-tests-ext-driver-prog.test'
+
+parallel_tests=yes
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_SUBST([acsubst_driver], [t-driver])
+AC_CONFIG_LINKS([chk-driver:chk-driver])
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+# Note that automake should not match the '/test' part of 'sub/test'
+# as '.test' suffix.
+TESTS = foo.chk bar.test baz bla.t bli.suff sub/test
+
+TEST_EXTENSIONS = .chk .test .t
+
+CHK_LOG_COMPILER = CHK=ok; export CHK; ./chk-driver
+TEST_LOG_COMPILER = CHK=ok $(SHELL) $(srcdir)/test-driver
+T_LOG_COMPILER = @acsubst_driver@
+LOG_COMPILER = @SHELL@ -x $(srcdir)/noext-driver
+
+CHK_LOG_FLAGS = --chk
+
+AM_TEST_LOG_FLAGS = --am-test
+
+T_LOG_FLAGS = --t
+AM_T_LOG_FLAGS = --am-t
+
+AM_LOG_FLAGS = -a
+LOG_FLAGS = -b
+
+# t-driver is deliberately not distributed; it should be available
+# in PATH also from "make distcheck".
+EXTRA_DIST = $(TESTS) chk-driver test-driver noext-driver
+END
+
+unset CHK || :
+
+mkdir sub
+
+cat > chk-driver <<'END'
+#! /bin/sh
+test x"$1" = x"--chk" || {
+  echo "$0: invalid command line: $*" >&2
+  exit 1
+}
+test x"$CHK" = x"ok" || {
+  echo "$0: bad \$CHK value '$CHK'" >&2
+  exit 1
+}
+shift
+exec "$@"
+exit 127
+END
+sed 's/--chk/--am-test/' chk-driver > test-driver
+
+mkdir bin
+PATH=`pwd`/bin$PATH_SEPARATOR$PATH; export PATH
+
+cat > bin/t-driver <<'END'
+#! /bin/sh
+if test x"$1,$2" != x"--am-t,--t"; then
+  echo "$0: invalid command line: $*" >&2
+  exit 1
+fi
+if test x${CHK+"set"} = x"set"; then
+  echo "$0: $CHK is set in the environment" >&2
+  exit 1
+fi
+shift; shift
+exec "$@"
+exit 127
+END
+sed 's/--am-t,--t/-a,-b/' bin/t-driver > noext-driver
+
+chmod a+x chk-driver chk-driver test-driver bin/t-driver noext-driver
+
+cat >foo.chk << 'END'
+#! /bin/sh
+exit 0
+END
+chmod a+x foo.chk
+cp foo.chk bar.test
+cp foo.chk baz
+cp foo.chk bla.t
+cp foo.chk bli.suff
+cp foo.chk sub/test
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+$MAKE check || { cat test-suite.log; Exit 1; }
+ls -l . sub
+cat test-suite.log
+test -f foo.log
+test -f bar.log
+test -f baz.log
+test -f bla.log
+test -f bli.suff.log
+test -f sub/test.log
+
+T_LOG_FLAGS=--bad $MAKE -e check && Exit 1
+cat test-suite.log
+cat bla.log
+# With the above flag overridden, bla.t should fail ...
+$EGREP '(^ *|/)t-driver:.* invalid .*--bad' bla.log
+# ... but no oher test should.
+grep -v '^FAIL: bla\.t ' bla.log | grep 'FAIL:' && Exit 1
+
+# Try also with a VPATH build.
+$MAKE distcheck
+
+:
diff --git a/tests/parallel-tests-suffix-prog.test b/tests/parallel-tests-suffix-prog.test
new file mode 100755 (executable)
index 0000000..5e7c2ab
--- /dev/null
@@ -0,0 +1,77 @@
+#! /bin/sh
+# Copyright (C) 2009, 2010, 2011 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
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# 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 features:
+# - suffix rules, with PROGRAMS involved
+# See also sister test 'parallel-tests-suffix.test'.
+
+parallel_tests=yes
+required=native
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+## Note that automake should not match the '/test' part of 'sub/test' as
+## '.test' suffix, nor the '/chk' part of 'sub/chk' as '.chk' suffix.
+TESTS = $(dist_TESTS) $(check_PROGRAMS)
+dist_TESTS = foo.chk bar.test sub/test
+check_PROGRAMS = baz bla.test bli.suff sub/chk
+TEST_EXTENSIONS = .chk .test
+EXTRA_DIST = $(dist_TESTS)
+END
+
+mkdir sub
+
+cat >foo.chk << 'END'
+#! /bin/sh
+exit 0
+END
+chmod a+x foo.chk
+cp foo.chk bar.test
+cp foo.chk sub/test
+
+cat >baz.c << 'END'
+int main (void)
+{
+  return 0;
+}
+END
+cp baz.c bla.c
+cp baz.c bli.c
+cp baz.c sub/chk.c
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+$MAKE check
+ls -l . sub
+test -f foo.log
+test -f bar.log
+test -f baz.log
+test -f bla.log
+test -f bli.suff.log
+test -f sub/chk.log
+test -f sub/test.log
+
+$MAKE distcheck
+
+:
similarity index 85%
rename from tests/parallel-tests4.test
rename to tests/parallel-tests-suffix.test
index a24bd51358d35d386b95d2022300c2aed379a8ea..c56f4bd3269cc7fd4bbd733f8269e4b77f259b44 100755 (executable)
 
 # Check parallel-tests features:
 # - suffix rules
+# See also sister test 'parallel-tests-suffix-prog.test'.
 
 parallel_tests=yes
 . ./defs || Exit 1
+
 cat >> configure.in << 'END'
-AC_PROG_CC
 AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
 ## Note that automake should not match the '/test' part
 ## of 'sub/test' as '.test' suffix.
-TESTS = foo.chk bar.test $(check_PROGRAMS) sub/test
-check_PROGRAMS = baz bla.test bli.suff
+TESTS = foo.chk bar.test baz bli.suff sub/test
 TEST_EXTENSIONS = .chk .test
+EXTRA_DIST = $(TESTS)
 END
 
 mkdir sub
@@ -40,28 +41,23 @@ exit 0
 END
 chmod a+x foo.chk
 cp foo.chk bar.test
+cp foo.chk baz
+cp foo.chk bli.suff
 cp foo.chk sub/test
 
-cat >baz.c << 'END'
-int main (void)
-{
-  return 0;
-}
-END
-cp baz.c bla.c
-cp baz.c bli.c
-
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -a
 
 ./configure
-$MAKE
 $MAKE check
+ls -l . sub
 test -f foo.log
 test -f bar.log
 test -f baz.log
-test -f bla.log
 test -f bli.suff.log
 test -f sub/test.log
+
+$MAKE distcheck
+
 :
index 7d7184166a97bf796202bd86c641718cd8586ce0..4d981c394c2bdcc4e9f350b9d76350faa7f3b5db 100755 (executable)
@@ -21,7 +21,7 @@
 # It merely serves as demonstration.  :-)
 
 parallel_tests=yes
-required=GNUmake
+required='native GNUmake'
 . ./defs || Exit 1
 
 cat >> configure.in << 'END'
@@ -62,4 +62,5 @@ $AUTOMAKE -a
 ./configure
 $MAKE -j4 check
 $MAKE distcheck
+
 :
index ad76cb8425206c01d43c8948fa3ad925db520b36..acc21dc556e562b8882567889a49895117d6f043 100755 (executable)
@@ -50,6 +50,7 @@ AC_LIBOBJ([feep])
 AC_LIBSOURCE([feep.c])
 AC_PROG_RANLIB
 AC_CONFIG_FILES([lib/Makefile src/Makefile])
+AM_CONDITIONAL([CROSS_COMPILING], [test $cross_compiling = yes])
 AC_OUTPUT
 EOF
 
@@ -71,7 +72,9 @@ cat >src/Makefile.am <<'EOF'
 check_PROGRAMS = main
 main_LDADD = ../lib/libfeep.a
 
+if !CROSS_COMPILING
 TESTS = main
+endif
 EOF
 
 $ACLOCAL
@@ -129,7 +132,9 @@ libfeep_a_LIBADD = $(LIBOBJS)
 check_PROGRAMS = main
 main_LDADD = libfeep.a
 
+if !CROSS_COMPILING
 TESTS = main
+endif
 EOF
 
 $ACLOCAL
@@ -161,7 +166,9 @@ check_PROGRAMS = src/main
 src_main_SOURCES = src/main.c
 src_main_LDADD = lib/libfeep.a
 
+if !CROSS_COMPILING
 TESTS = src/main
+endif
 
 check-local:
        test -f src/main.$(OBJEXT)
index 1a38443a86b25d7548f29d3c5fae504a7ca16b70..68d9750bb4f528bed3340cfea82891fd2382782b 100755 (executable)
@@ -51,6 +51,7 @@ AC_LIBOBJ([feep])
 AC_LIBSOURCE([feep.c])
 AC_PROG_LIBTOOL
 AC_CONFIG_FILES([lib/Makefile src/Makefile])
+AM_CONDITIONAL([CROSS_COMPILING], [test $cross_compiling = yes])
 AC_OUTPUT
 EOF
 
@@ -72,7 +73,9 @@ cat >src/Makefile.am <<'EOF'
 check_PROGRAMS = main
 main_LDADD = ../lib/libfeep.la
 
+if !CROSS_COMPILING
 TESTS = main
+endif
 EOF
 
 libtoolize
@@ -130,7 +133,9 @@ libfeep_la_LIBADD = $(LTLIBOBJS)
 check_PROGRAMS = main
 main_LDADD = libfeep.la
 
+if !CROSS_COMPILING
 TESTS = main
+endif
 EOF
 
 $ACLOCAL
@@ -162,7 +167,9 @@ check_PROGRAMS = src/main
 src_main_SOURCES = src/main.c
 src_main_LDADD = lib/libfeep.la
 
+if !CROSS_COMPILING
 TESTS = src/main
+endif
 
 check-local:
        test -f src/main.$(OBJEXT)
index 2b35d810f58da42eb06300884ebf304fb10ffdd2..7e42aae2e08306815f03bbd71519b850deb23606 100755 (executable)
@@ -52,6 +52,7 @@ AC_PROG_CC
 AC_PROG_RANLIB
 AC_FUNC_ALLOCA
 AC_CONFIG_FILES([lib/Makefile src/Makefile])
+AM_CONDITIONAL([CROSS_COMPILING], [test $cross_compiling = yes])
 AC_OUTPUT
 EOF
 
@@ -73,7 +74,9 @@ cat >src/Makefile.am <<'EOF'
 check_PROGRAMS = main
 main_LDADD = ../lib/libfeep.a
 
+if !CROSS_COMPILING
 TESTS = main
+endif
 EOF
 
 $ACLOCAL
@@ -132,7 +135,9 @@ libfeep_a_LIBADD = $(ALLOCA) $(LIBOBJS) # Add LIBOBJS for fun
 check_PROGRAMS = main
 main_LDADD = libfeep.a
 
+if !CROSS_COMPILING
 TESTS = main
+endif
 EOF
 
 $ACLOCAL
@@ -164,7 +169,9 @@ check_PROGRAMS = src/main
 src_main_SOURCES = src/main.c
 src_main_LDADD = lib/libfeep.a
 
+if !CROSS_COMPILING
 TESTS = src/main
+endif
 
 check-local:
        test -f src/main.$(OBJEXT)
index bf77bebf3d3cdecce0fe5b5a927e3cd9045c589d..a7aa38ab43e6befa73ea8789500fb3ed43987199 100755 (executable)
@@ -16,6 +16,7 @@
 
 # The true/false example from the manual, plus a check for _SHORTNAME.
 
+required=native
 . ./defs || Exit 1
 
 cat >> configure.in << 'END'
index 9d1d5ffa38e5b45055aeba60ee3db34523ea5026..7f8aa1440918ff86aba982d66ccd675e65bdab83 100755 (executable)
@@ -18,6 +18,7 @@
 # with one extra indirection in the sources (PR/315), and
 # use of _CPPFLAGS (PR/337).
 
+required=native
 . ./defs || Exit 1
 
 cat >> configure.in << 'END'
index 0faeaa51a84c8117884c1943e8b12ff48aa8c82e..404965f48d0afb128fa2833b7b0d1d4a9021c1ec 100755 (executable)
@@ -17,6 +17,7 @@
 
 # Test of subdir objects with ansi2knr.
 
+required=native
 . ./defs || Exit 1
 
 cat > configure.in << END
index 9dda2d6ad484678fe693c2a1d25243844f7a337b..499b7523c2620bbb22b3c013c885bbfcd25cbb6a 100755 (executable)
@@ -60,13 +60,17 @@ mkdir build
 cd build
 ../configure
 $MAKE
-./foo
-./bar
+if cross_compiling; then :; else
+  ./foo
+  ./bar
+fi
 cd ..
 
 ./configure
 $MAKE
-./foo
-./bar
+if cross_compiling; then :; else
+  ./foo
+  ./bar
+fi
 
 :
index 351b409fc3c78779834789c192f36be097ca0874..16caeb22cb08eb13cdc788c25a9022990389fc37 100755 (executable)
@@ -59,8 +59,10 @@ $MAKE
 # like an "intermediate file" in the GNU make sense).
 test -f parse.c
 
-echo a | ./foo
-echo b | ./foo && Exit 1
+if cross_compiling; then :; else
+  echo a | ./foo
+  echo b | ./foo && Exit 1
+fi
 
 # The generated file `parse.c' must be shipped.
 $MAKE echo-distcom