diff options
37 files changed, 517 insertions, 69 deletions
@@ -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' diff --git a/tests/Makefile.am b/tests/Makefile.am index 20552111d..954141bf8 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -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 \ diff --git a/tests/Makefile.in b/tests/Makefile.in index e672e90ff..74d207fdf 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -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 diff --git a/tests/ansi10.test b/tests/ansi10.test index a21d6ca23..5cba1ce96 100755 --- a/tests/ansi10.test +++ b/tests/ansi10.test @@ -16,6 +16,7 @@ # Make sure ansi2knr works with $(LIBOBJS). +required=native . ./defs || Exit 1 cat >> configure.in << 'END' diff --git a/tests/ansi3.test b/tests/ansi3.test index 233e3785b..f41035cd1 100755 --- a/tests/ansi3.test +++ b/tests/ansi3.test @@ -17,6 +17,7 @@ # Actual test of ansi2knr functionality. +required=native . ./defs || Exit 1 cat >> configure.in << 'END' diff --git a/tests/ansi3b.test b/tests/ansi3b.test index 3a5bedf74..59eef0882 100755 --- a/tests/ansi3b.test +++ b/tests/ansi3b.test @@ -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' diff --git a/tests/ansi5.test b/tests/ansi5.test index 967f77249..b29183c06 100755 --- a/tests/ansi5.test +++ b/tests/ansi5.test @@ -16,6 +16,7 @@ # Test for ansi2knr in another directory. +required=native . ./defs || Exit 1 cat > configure.in << 'END' diff --git a/tests/ansi6.test b/tests/ansi6.test index c29d7b859..2a25ee1d2 100755 --- a/tests/ansi6.test +++ b/tests/ansi6.test @@ -17,6 +17,7 @@ # Check ansi2knr on a source file in subdirectory. # From Kevin Ryde. +required=native . ./defs || Exit 1 cat > configure.in << 'END' diff --git a/tests/ansi7.test b/tests/ansi7.test index d73e9eb97..3b0a37f1a 100755 --- a/tests/ansi7.test +++ b/tests/ansi7.test @@ -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' diff --git a/tests/ansi9.test b/tests/ansi9.test index b57234d86..aba430d99 100755 --- a/tests/ansi9.test +++ b/tests/ansi9.test @@ -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 + +: diff --git a/tests/autohdr4.test b/tests/autohdr4.test index feee80de8..d9bacd3ac 100755 --- a/tests/autohdr4.test +++ b/tests/autohdr4.test @@ -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 diff --git a/tests/backcompat6.test b/tests/backcompat6.test index 389bc4ba4..8db46303f 100755 --- a/tests/backcompat6.test +++ b/tests/backcompat6.test @@ -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' diff --git a/tests/canon7.test b/tests/canon7.test index 32b607c25..8df283c2d 100755 --- a/tests/canon7.test +++ b/tests/canon7.test @@ -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' diff --git a/tests/check9.test b/tests/check-subst-prog.test index 07ea4e42f..bda0629b2 100755 --- a/tests/check9.test +++ b/tests/check-subst-prog.test @@ -14,10 +14,10 @@ # 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 index 000000000..63ed689cc --- /dev/null +++ b/tests/check-subst.test @@ -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 + +: diff --git a/tests/check5.test b/tests/check5.test index 2db74d18d..639f34342 100755 --- a/tests/check5.test +++ b/tests/check5.test @@ -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 + +: diff --git a/tests/check8.test b/tests/check8.test index 4ff71a77a..c8711e85f 100755 --- a/tests/check8.test +++ b/tests/check8.test @@ -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 + : diff --git a/tests/depcomp2.test b/tests/depcomp2.test index 176a31eae..63398db53 100755 --- a/tests/depcomp2.test +++ b/tests/depcomp2.test @@ -43,6 +43,7 @@ $ACLOCAL $AUTOMAKE --add-missing $AUTOCONF ./configure 2>stderr || { cat stderr >&2; Exit 1; } +cat stderr >&2 test ! -s stderr : diff --git a/tests/depcomp8a.test b/tests/depcomp8a.test index 0f9b7f557..06544d830 100755 --- a/tests/depcomp8a.test +++ b/tests/depcomp8a.test @@ -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 : diff --git a/tests/gnits2.test b/tests/gnits2.test index 26e8747d7..1b60387b3 100755 --- a/tests/gnits2.test +++ b/tests/gnits2.test @@ -17,6 +17,7 @@ # Test to ensure std-options checking is correct. +required=native . ./defs || Exit 1 cat >> configure.in << 'END' diff --git a/tests/lex3.test b/tests/lex3.test index b10a6cbf0..2b7f3d15a 100755 --- a/tests/lex3.test +++ b/tests/lex3.test @@ -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 diff --git a/tests/ltcond2.test b/tests/ltcond2.test index 10e155e48..b917eb4b7 100755 --- a/tests/ltcond2.test +++ b/tests/ltcond2.test @@ -16,7 +16,7 @@ # Test for bug in conditionals. -required=libtoolize +required='native libtoolize' . ./defs || Exit 1 cat >> configure.in << 'END' diff --git a/tests/ltconv.test b/tests/ltconv.test index 208e2adf7..65ee86ded 100755 --- a/tests/ltconv.test +++ b/tests/ltconv.test @@ -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' diff --git a/tests/ltinit.test b/tests/ltinit.test index e541431dc..189e5c26c 100755 --- a/tests/ltinit.test +++ b/tests/ltinit.test @@ -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 diff --git a/tests/parallel-tests7.test b/tests/parallel-tests-ext-driver-prog.test index c29d32c21..fca4746cf 100755 --- a/tests/parallel-tests7.test +++ b/tests/parallel-tests-ext-driver-prog.test @@ -15,10 +15,14 @@ # 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 index 000000000..b53ccdb53 --- /dev/null +++ b/tests/parallel-tests-ext-driver.test @@ -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 index 000000000..5e7c2ab1b --- /dev/null +++ b/tests/parallel-tests-suffix-prog.test @@ -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 + +: diff --git a/tests/parallel-tests4.test b/tests/parallel-tests-suffix.test index a24bd5135..c56f4bd32 100755 --- a/tests/parallel-tests4.test +++ b/tests/parallel-tests-suffix.test @@ -16,20 +16,21 @@ # 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 + : diff --git a/tests/parallel-tests5.test b/tests/parallel-tests5.test index 7d7184166..4d981c394 100755 --- a/tests/parallel-tests5.test +++ b/tests/parallel-tests5.test @@ -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 + : diff --git a/tests/pr401.test b/tests/pr401.test index ad76cb842..acc21dc55 100755 --- a/tests/pr401.test +++ b/tests/pr401.test @@ -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) diff --git a/tests/pr401b.test b/tests/pr401b.test index 1a38443a8..68d9750bb 100755 --- a/tests/pr401b.test +++ b/tests/pr401b.test @@ -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) diff --git a/tests/pr401c.test b/tests/pr401c.test index 2b35d810f..7e42aae2e 100755 --- a/tests/pr401c.test +++ b/tests/pr401c.test @@ -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) diff --git a/tests/specflg7.test b/tests/specflg7.test index bf77bebf3..a7aa38ab4 100755 --- a/tests/specflg7.test +++ b/tests/specflg7.test @@ -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' diff --git a/tests/specflg8.test b/tests/specflg8.test index 9d1d5ffa3..7f8aa1440 100755 --- a/tests/specflg8.test +++ b/tests/specflg8.test @@ -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' diff --git a/tests/subobj3.test b/tests/subobj3.test index 0faeaa51a..404965f48 100755 --- a/tests/subobj3.test +++ b/tests/subobj3.test @@ -17,6 +17,7 @@ # Test of subdir objects with ansi2knr. +required=native . ./defs || Exit 1 cat > configure.in << END diff --git a/tests/target-cflags.test b/tests/target-cflags.test index 9dda2d6ad..499b7523c 100755 --- a/tests/target-cflags.test +++ b/tests/target-cflags.test @@ -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 : diff --git a/tests/yacc-basic.test b/tests/yacc-basic.test index 351b409fc..16caeb22c 100755 --- a/tests/yacc-basic.test +++ b/tests/yacc-basic.test @@ -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 |