I will wait until tomorrow for a review, before pushing. Regards, Stefano
From 7f94d680411600563a3491a5ae93f57b2be3044f Mon Sep 17 00:00:00 2001 Message-Id: <7f94d680411600563a3491a5ae93f57b2be3044f.1305733843.git.stefano.lattar...@gmail.com> From: Stefano Lattarini <stefano.lattar...@gmail.com> Date: Sun, 15 May 2011 16:33:01 +0200 Subject: [PATCH] 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. --- ChangeLog | 58 +++++++++ tests/Makefile.am | 9 +- tests/Makefile.in | 22 ++-- tests/ansi10.test | 1 + tests/ansi3.test | 1 + tests/ansi3b.test | 1 + tests/ansi5.test | 1 + tests/ansi6.test | 1 + tests/ansi7.test | 1 + tests/ansi9.test | 13 ++- tests/autohdr4.test | 21 +++- tests/backcompat6.test | 5 +- tests/canon7.test | 7 + tests/{check9.test => check-subst-prog.test} | 15 +- tests/{check9.test => check-subst.test} | 73 ++++++----- tests/check5.test | 17 ++- tests/check8.test | 2 + tests/depcomp2.test | 1 + tests/depcomp8a.test | 4 +- tests/gnits2.test | 1 + tests/lex3.test | 6 +- tests/ltcond2.test | 2 +- tests/ltconv.test | 2 +- tests/ltinit.test | 2 +- ...s7.test => parallel-tests-ext-driver-prog.test} | 24 ++-- tests/parallel-tests-ext-driver.test | 136 ++++++++++++++++++++ ...tests4.test => parallel-tests-suffix-prog.test} | 22 +++- ...llel-tests4.test => parallel-tests-suffix.test} | 24 ++-- tests/parallel-tests5.test | 3 +- tests/pr401.test | 7 + tests/pr401b.test | 7 + tests/pr401c.test | 7 + tests/specflg7.test | 1 + tests/specflg8.test | 1 + tests/subobj3.test | 1 + tests/target-cflags.test | 12 +- tests/yacc-basic.test | 6 +- 37 files changed, 411 insertions(+), 106 deletions(-) copy tests/{check9.test => check-subst-prog.test} (87%) rename tests/{check9.test => check-subst.test} (51%) rename tests/{parallel-tests7.test => parallel-tests-ext-driver-prog.test} (77%) create mode 100755 tests/parallel-tests-ext-driver.test copy tests/{parallel-tests4.test => parallel-tests-suffix-prog.test} (72%) rename tests/{parallel-tests4.test => parallel-tests-suffix.test} (85%) diff --git a/ChangeLog b/ChangeLog index 764a99a..f9c2c6d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,61 @@ +2011-05-18 Stefano Lattarini <stefano.lattar...@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-15 Stefano Lattarini <stefano.lattar...@gmail.com> testsuite: be more cross-compile friendly diff --git a/tests/Makefile.am b/tests/Makefile.am index 2055211..954141b 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 e672e90..74d207f 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 a21d6ca..d97dc8a 100755 --- a/tests/ansi10.test +++ b/tests/ansi10.test @@ -16,6 +16,7 @@ # Make sure ansi2knr works with $(LIBOBJS). +required=non-cross . ./defs || Exit 1 cat >> configure.in << 'END' diff --git a/tests/ansi3.test b/tests/ansi3.test index 233e378..0bc941f 100755 --- a/tests/ansi3.test +++ b/tests/ansi3.test @@ -17,6 +17,7 @@ # Actual test of ansi2knr functionality. +required=non-cross . ./defs || Exit 1 cat >> configure.in << 'END' diff --git a/tests/ansi3b.test b/tests/ansi3b.test index 3a5bedf..8018097 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=non-cross . ./defs || Exit 1 cat > configure.in << 'END' diff --git a/tests/ansi5.test b/tests/ansi5.test index 967f772..57babce 100755 --- a/tests/ansi5.test +++ b/tests/ansi5.test @@ -16,6 +16,7 @@ # Test for ansi2knr in another directory. +required=non-cross . ./defs || Exit 1 cat > configure.in << 'END' diff --git a/tests/ansi6.test b/tests/ansi6.test index c29d7b8..fd8be2e 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=non-cross . ./defs || Exit 1 cat > configure.in << 'END' diff --git a/tests/ansi7.test b/tests/ansi7.test index d73e9eb..2552f81 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=non-cross . ./defs || Exit 1 cat > configure.in << 'END' diff --git a/tests/ansi9.test b/tests/ansi9.test index b57234d..aba430d 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 feee80d..d9bacd3 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 389bc4b..8db4630 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 32b607c..8df283c 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 similarity index 87% copy from tests/check9.test copy to tests/check-subst-prog.test index 07ea4e4..c9c20d2 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=non-cross . ./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/check9.test b/tests/check-subst.test similarity index 51% rename from tests/check9.test rename to tests/check-subst.test index 07ea4e4..63ed689 100755 --- a/tests/check9.test +++ b/tests/check-subst.test @@ -17,60 +17,71 @@ # 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_PROG_CC -AC_SUBST([script_tests], ['subst-pass-script.test subst-xfail-script.test']) -AC_SUBST([prog_tests], ['subst-pass-prog.test$(EXEEXT) subst-xfail-prog.test$(EXEEXT)']) -AC_SUBST([xfail_tests], ['xfail-script.test subst-xfail-script.test xfail-prog$(EXEEXT) subst-xfail-prog.test$(EXEEXT)']) +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@ $(check_PROGRAMS) +TESTS = pass-script.test xfail-script.test @script_tests@ XFAIL_TESTS = @xfail_tests@ -check_PROGRAMS = pass-prog xfail-prog @prog_tests@ -EXTRA_PROGRAMS = subst-pass-prog.test subst-xfail-prog.test END -cat >>pass-script.test <<'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' +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 -cp pass-script.test subst-pass-script.test -cp xfail-script.test subst-xfail-script.test -cat >>pass-prog.c <<'END' -int main() { return 0; } -END -cat >>xfail-prog.c <<'END' -#include <stdlib.h> -int main() { return EXIT_FAILURE; } -END -# The .test extension is removed for the default source file name: -cp pass-prog.c subst-pass-prog.c -cp xfail-prog.c subst-xfail-prog.c +if test "$parallel_tests" != yes; then + chmod a+x subst-pass-script.sh subst-xfail-script.sh +fi $ACLOCAL $AUTOCONF $AUTOMAKE -a -./configure -$MAKE all -$MAKE check -$MAKE distclean +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 -mkdir build -cd build -../configure -$MAKE all -$MAKE check -$MAKE distclean : diff --git a/tests/check5.test b/tests/check5.test index 2db74d1..5d4d8ff 100755 --- a/tests/check5.test +++ b/tests/check5.test @@ -17,6 +17,7 @@ # Test TESTS = $(check_PROGRAMS) +required=non-cross . ./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 4ff71a7..49ef5c6 100755 --- a/tests/check8.test +++ b/tests/check8.test @@ -16,6 +16,7 @@ # Check subdir TESTS. +required=non-cross . ./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 176a31e..63398db 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 0f9b7f5..06544d8 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 26e8747..755a359 100755 --- a/tests/gnits2.test +++ b/tests/gnits2.test @@ -17,6 +17,7 @@ # Test to ensure std-options checking is correct. +required=non-cross . ./defs || Exit 1 cat >> configure.in << 'END' diff --git a/tests/lex3.test b/tests/lex3.test index b10a6cb..2b7f3d1 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 10e155e..cc55232 100755 --- a/tests/ltcond2.test +++ b/tests/ltcond2.test @@ -16,7 +16,7 @@ # Test for bug in conditionals. -required=libtoolize +required='non-cross libtoolize' . ./defs || Exit 1 cat >> configure.in << 'END' diff --git a/tests/ltconv.test b/tests/ltconv.test index 208e2ad..14e71bd 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='non-cross libtoolize' . ./defs || Exit 1 cat >>configure.in <<'END' diff --git a/tests/ltinit.test b/tests/ltinit.test index e541431..189e5c2 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 similarity index 77% rename from tests/parallel-tests7.test rename to tests/parallel-tests-ext-driver-prog.test index c29d32c..6c44146 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=non-cross . ./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 0000000..b53ccdb --- /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-tests4.test b/tests/parallel-tests-suffix-prog.test similarity index 72% copy from tests/parallel-tests4.test copy to tests/parallel-tests-suffix-prog.test index a24bd51..f2e110b 100755 --- a/tests/parallel-tests4.test +++ b/tests/parallel-tests-suffix-prog.test @@ -15,21 +15,26 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # Check parallel-tests features: -# - suffix rules +# - suffix rules, with PROGRAMS involved +# See also sister test 'parallel-tests-suffix.test'. parallel_tests=yes +required=non-cross . ./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 +## 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 @@ -50,18 +55,23 @@ int main (void) END cp baz.c bla.c cp baz.c bli.c +cp baz.c sub/chk.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/chk.log test -f sub/test.log + +$MAKE distcheck + : diff --git a/tests/parallel-tests4.test b/tests/parallel-tests-suffix.test similarity index 85% rename from tests/parallel-tests4.test rename to tests/parallel-tests-suffix.test index a24bd51..c56f4bd 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 7d71841..111856f 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='non-cross 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 ad76cb8..acc21dc 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 1a38443..68d9750 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 2b35d81..7e42aae 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 bf77beb..1bb89e9 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=non-cross . ./defs || Exit 1 cat >> configure.in << 'END' diff --git a/tests/specflg8.test b/tests/specflg8.test index 9d1d5ff..1ff9573 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=non-cross . ./defs || Exit 1 cat >> configure.in << 'END' diff --git a/tests/subobj3.test b/tests/subobj3.test index 0faeaa5..de75849 100755 --- a/tests/subobj3.test +++ b/tests/subobj3.test @@ -17,6 +17,7 @@ # Test of subdir objects with ansi2knr. +required=non-cross . ./defs || Exit 1 cat > configure.in << END diff --git a/tests/target-cflags.test b/tests/target-cflags.test index 9dda2d6..499b752 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 351b409..16caeb2 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 -- 1.7.2.3