diff options
author | Stefano Lattarini <stefano.lattarini@gmail.com> | 2012-01-16 18:43:28 +0100 |
---|---|---|
committer | Stefano Lattarini <stefano.lattarini@gmail.com> | 2012-01-16 18:43:28 +0100 |
commit | 693557ce7fcd728fa9e7b5d60713b4caefc39e78 (patch) | |
tree | 0cd79ce45592e6dd6953cda9f876bba2006e9d20 | |
parent | 9df60a37caa53335bafc6f0186d4db8f1c462f01 (diff) | |
parent | 3d6197fe647445ecbcfaac6c004449246471d5b6 (diff) | |
download | automake-693557ce7fcd728fa9e7b5d60713b4caefc39e78.tar.gz |
Merge branch 'maint' into branch-1.11
* maint:
recheck: fix interaction with "make -n"
vala: avoid potential useless remakes (minor bugfix)
vala: enhance tests
recheck: behave better with non-GNU make
check: separate .log -> .html conversion from core testsuite harness
docs: deprecate .log -> .html conversion by parallel-tests
tests: list some forgotten test cases in $(TESTS)
maintcheck: consistency of list of test scripts
-rw-r--r-- | CheckListOfTests.am | 62 | ||||
-rw-r--r-- | Makefile.am | 20 | ||||
-rw-r--r-- | NEWS | 4 | ||||
-rw-r--r-- | automake.in | 15 | ||||
-rw-r--r-- | doc/automake.texi | 38 | ||||
-rw-r--r-- | lib/Automake/tests/Makefile.am | 5 | ||||
-rw-r--r-- | lib/am/Makefile.am | 3 | ||||
-rw-r--r-- | lib/am/check-html.am | 61 | ||||
-rw-r--r-- | lib/am/check.am | 103 | ||||
-rw-r--r-- | tests/Makefile.am | 4 | ||||
-rwxr-xr-x | tests/check.test | 4 | ||||
-rw-r--r-- | tests/list-of-tests.mk | 6 | ||||
-rwxr-xr-x | tests/parallel-tests-dryrun.test | 93 | ||||
-rwxr-xr-x | tests/parallel-tests2.test | 35 | ||||
-rwxr-xr-x | tests/vala-mix.test | 116 | ||||
-rwxr-xr-x | tests/vala.test | 56 | ||||
-rwxr-xr-x | tests/vala5.test | 48 |
17 files changed, 548 insertions, 125 deletions
diff --git a/CheckListOfTests.am b/CheckListOfTests.am new file mode 100644 index 000000000..0a484470e --- /dev/null +++ b/CheckListOfTests.am @@ -0,0 +1,62 @@ +## -*- Automake -*- +## +## Copyright (C) 2011, 2012 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/>. +## + +## Temporary files used in the `check-list-of-tests' target. +am__tmk = tests-in-makefile-list.tmp +am__tfs = tests-on-filesystem-list.tmp +am__tdf = diff-in-tests-lists.tmp + +## Check that the list of tests given in the Makefile is equal to the +## list of all test scripts in the Automake testsuite. +.PHONY: maintainer-check-list-of-tests +maintainer-check-list-of-tests: +## Prefer unified diffs over plain diffs, for readability. + @if diff -u /dev/null /dev/null >/dev/null 2>&1; then \ + diff='diff -u'; \ + else \ + diff='diff'; \ + fi; \ +## List of tests in Makefile. + lst='$(expected_list_of_tests)'; \ + test -n "$$lst" || lst='$(TESTS)'; \ + for t in $$lst; do \ + echo "$$t"; \ + done | sort >$(am__tmk); \ +## List of tests on filesystem. Be careful to cater for VPATH builds too. + for ext in $(TEST_EXTENSIONS); do \ + ls *$$ext 2>/dev/null; \ + if test $(srcdir) != $(builddir); then \ + (cd $(srcdir) && ls *$$ext 2>/dev/null); \ + fi; \ + done | sort | uniq >$(am__tfs); \ +## Compare the two lists, complain if they differ. + if $$diff $(am__tmk) $(am__tfs) >$(am__tdf); then \ + result=0; \ + else \ + echo '$@: list of tests in Makefile an on filesystem differ' >&2; \ + echo "+ $$diff in-makefile on-filesystem" >&2; \ + cat $(am__tdf) >&2; \ + result=1; \ + fi; \ + rm -f $(am__tmk) $(am__tfs) $(am__tdf); \ + exit $$result; + +.PHONY: clean-maintcheck-testslist-tmp +clean-local: clean-maintcheck-testslist-tmp +clean-maintcheck-testslist-tmp: + rm -f $(am__tmk) $(am__tfs) $(am__tdf) diff --git a/Makefile.am b/Makefile.am index 893baff1b..735cb009e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -25,6 +25,8 @@ ## run aclocal and automake. SUBDIRS = lib . doc m4 tests +TEST_SUBDIRS = tests lib/Automake/tests + bin_SCRIPTS = automake aclocal CLEANFILES = $(bin_SCRIPTS) @@ -196,6 +198,24 @@ $(syntax_check_rules): automake aclocal maintainer-check: $(syntax_check_rules) .PHONY: maintainer-check $(syntax_check_rules) +## Check that the list of tests given in the Makefile is equal to the +## list of all test scripts in the Automake testsuite. +.PHONY: maintainer-check-list-of-tests +maintainer-check-list-of-tests: + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + for subdir in $(TEST_SUBDIRS); do \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@) || eval $$failcom; \ + done; \ + test -z "$$fail" + +maintainer-check: maintainer-check-list-of-tests + ## Look for test whose names can cause spurious failures when used as ## first argument to AC_INIT (chiefly because they might contain an ## m4/m4sugar builtin or macro name). @@ -2,6 +2,10 @@ New in 1.11.2a: * WARNING: Future backward-incompatibilities! + - The support for ".log -> .html" conversion and the check-html and + recheck-html targets will be removed in the next major Automake + release (1.12). + - The obsolescent AM_WITH_REGEX macro has been deprecated (since the GNU rx library has been decommissioned), and will be removed in the next major Automake release (1.12). diff --git a/automake.in b/automake.in index bc62e8c33..fab921da1 100644 --- a/automake.in +++ b/automake.in @@ -4975,9 +4975,11 @@ sub handle_tests if (var ('TESTS')) { push (@check_tests, 'check-TESTS'); + my $check_deps = "@check"; $output_rules .= &file_contents ('check', new Automake::Location, COLOR => !! option 'color-tests', - PARALLEL_TESTS => !! option 'parallel-tests'); + PARALLEL_TESTS => !! option 'parallel-tests', + CHECK_DEPS => $check_deps); # Tests that are known programs should have $(EXEEXT) appended. # For matching purposes, we need to adjust XFAIL_TESTS as well. @@ -4988,7 +4990,6 @@ sub handle_tests if (option 'parallel-tests') { define_variable ('TEST_SUITE_LOG', 'test-suite.log', INTERNAL); - define_variable ('TEST_SUITE_HTML', '$(TEST_SUITE_LOG:.log=.html)', INTERNAL); my $suff = '.test'; my $at_exeext = ''; my $handle_exeext = exists $configure_vars{'EXEEXT'}; @@ -5104,7 +5105,6 @@ sub handle_tests $clean_files{'$(TEST_LOGS_TMP)'} = MOSTLY_CLEAN; $clean_files{'$(TEST_LOGS)'} = MOSTLY_CLEAN; $clean_files{'$(TEST_SUITE_LOG)'} = MOSTLY_CLEAN; - $clean_files{'$(TEST_SUITE_HTML)'} = MOSTLY_CLEAN; } } } @@ -6099,8 +6099,15 @@ sub lang_vala_finish_target ($$) $output_rules .= "\$(srcdir)/${derived}_vala.stamp: \$(${derived}_SOURCES)\n". +# Since the C files generated from the vala sources depend on the +# ${derived}_vala.stamp file, we must ensure its timestamp is older than +# those of the C files generated by the valac invocation below (this is +# especially important on systems with sub-second timestamp resolution). +# Thus we need to create the stamp file *before* invoking valac, and to +# move it to its final location only after valac has been invoked. + "\t${silent}rm -f \$@ && echo stamp > \$@-t\n". "\t${verbose}\$(am__cd) \$(srcdir) && ${compile} \$(${derived}_SOURCES)\n". - "\t${silent}touch \$@\n"; + "\t${silent}mv -f \$@-t \$@\n"; push_dist_common ("${derived}_vala.stamp"); diff --git a/doc/automake.texi b/doc/automake.texi index d4fdaeba8..5cc33c360 100644 --- a/doc/automake.texi +++ b/doc/automake.texi @@ -8858,17 +8858,17 @@ by the tests, not the tests themselves. Of course you can set @section Simple Tests using @samp{parallel-tests} @cindex @option{parallel-tests}, Using -The option @option{parallel-tests} (@pxref{Options}) enables a test -suite driver that is mostly compatible to the simple test driver described -in the previous section, but provides a few more features and slightly different -semantics. It features concurrent execution of tests with @code{make -j}, -allows to specify inter-test dependencies, lazy reruns of tests that -have not completed in a prior run, summary and verbose output in -@samp{RST} (reStructuredText) and @samp{HTML} format, and hard errors -for exceptional failures. Similar to the simple test driver, -@code{TESTS_ENVIRONMENT}, @code{AM_COLOR_TESTS}, @code{XFAIL_TESTS}, and -the @code{check_*} variables are honored, and the environment variable -@env{srcdir} is set during test execution. +The option @option{parallel-tests} (@pxref{Options}) enables a test suite +driver that is mostly compatible to the simple test driver described in +the previous section, but provides a few more features and slightly +different semantics. It features concurrent execution of tests with +@code{make -j} and automatic collection of the test scripts output and +summary thereof in @file{.log} files, and allows to specify inter-test +dependencies, lazy reruns of tests that have not completed in a prior +run, and hard errors for exceptional failures. Similar to the simple +test driver, @code{TESTS_ENVIRONMENT}, @code{AM_COLOR_TESTS}, +@code{XFAIL_TESTS}, and the @code{check_*} variables are honored, +and the environment variable @env{srcdir} is set during test execution. This test driver is still experimental and may undergo changes in order to satisfy additional portability requirements. @@ -8947,16 +8947,13 @@ intermingled output. The output from failed tests is collected in the file is output after the summary. For best results, the tests should be verbose by default now. -@trindex mostlyclean @trindex check-html @vindex RST2HTML @vindex TEST_SUITE_HTML -With @code{make check-html}, the log files may be converted from RST -(reStructuredText, see @uref{http://docutils.sourceforge.net/@/rst.html}) -to HTML using @samp{RST2HTML}, which defaults to @command{rst2html} or -@command{rst2html.py}. The variable @samp{TEST_SUITE_HTML} contains the -set of converted log files. The log and HTML files are removed upon -@code{make mostlyclean}. +Previous versions of automake used to provide a @code{check-html} target +to convert the log files to HTML. This feature is now deprecated, and +@emph{will be removed} in the next major Automake release, so don't rely +on it anymore. @vindex DISABLE_HARD_ERRORS @cindex Exit status 99, special interpretation @@ -9031,13 +9028,10 @@ env RECHECK_LOGS= make -e check @item @trindex recheck -@trindex recheck-html You can ensure that all tests are rerun which have failed or passed unexpectedly, by running @code{make recheck} in the test directory. This convenience target will set @code{RECHECK_LOGS} appropriately -before invoking the main test driver. The @code{recheck-html} target -does the same as @code{recheck} but again converts the resulting log -file in HTML format, like the @code{check-html} target. +before invoking the main test driver. @end itemize In order to guarantee an ordering between tests even with @code{make diff --git a/lib/Automake/tests/Makefile.am b/lib/Automake/tests/Makefile.am index c5e53d2cf..a537fd1d7 100644 --- a/lib/Automake/tests/Makefile.am +++ b/lib/Automake/tests/Makefile.am @@ -1,6 +1,7 @@ ## Process this file with automake to create Makefile.in -# Copyright (C) 2002, 2003, 2008, 2009 Free Software Foundation, Inc. +# Copyright (C) 2002, 2003, 2008, 2009, 2012 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 @@ -28,3 +29,5 @@ Version.pl \ Wrap.pl EXTRA_DIST = $(TESTS) + +include $(top_srcdir)/CheckListOfTests.am diff --git a/lib/am/Makefile.am b/lib/am/Makefile.am index a255f701d..7b37989db 100644 --- a/lib/am/Makefile.am +++ b/lib/am/Makefile.am @@ -3,7 +3,7 @@ ## Makefile for Automake lib/am. # Copyright (C) 1995, 1996, 1997, 1998, 1999, 2001, 2003, 2004, 2008, -# 2009 Free Software Foundation, Inc. +# 2009, 2012 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 @@ -23,6 +23,7 @@ amdir = $(pkgvdatadir)/am dist_am_DATA = \ ansi2knr.am \ check.am \ +check-html.am \ check2.am \ clean-hdr.am \ clean.am \ diff --git a/lib/am/check-html.am b/lib/am/check-html.am new file mode 100644 index 000000000..13f0a47a8 --- /dev/null +++ b/lib/am/check-html.am @@ -0,0 +1,61 @@ +## automake - create Makefile.in from Makefile.am +## Copyright (C) 2001, 2003, 2006, 2007, 2008, 2009, 2010, 2011, 2012 +## 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/>. + +## Makefile.am fragment to produce HTML output from RST-formatted +## log files produced by the parallel-tests output. +## This fragment was part of the automake core in the 1.11.x release +## series, but is to be moved out in the 1.12 release. + +TEST_SUITE_HTML = $(TEST_SUITE_LOG:.log=.html) + +mostlyclean-am: am--mostlyclean-test-html +.PHONY: am--mostlyclean-test-html +am--mostlyclean-test-html: +## Expand $(TEST_LOGS) only once, to avoid exceeding line length limits. + list='$(TEST_LOGS:.log=.html)'; test -z "$$list" || rm -f $$list + rm -f $(TEST_SUITE_HTML) + +.log.html: + @list='$(RST2HTML) $$RST2HTML rst2html rst2html.py'; \ + for r2h in $$list; do \ + if ($$r2h --version) >/dev/null 2>&1; then \ + R2H=$$r2h; \ + fi; \ + done; \ + if test -z "$$R2H"; then \ + echo >&2 "cannot find rst2html, cannot create $@"; \ + exit 2; \ + fi; \ + $$R2H $< >$@.tmp + @mv $@.tmp $@ + +# Be sure to run check first, and then to convert the result. +# Beware of concurrent executions. Run "check" not "check-TESTS", as +# check-SCRIPTS and other dependencies are rebuilt by the former only. +# And expect check to fail. +check-html recheck-html: + @target=`echo $@ | sed 's/-html$$//'`; \ + rv=0; $(MAKE) $(AM_MAKEFLAGS) $$target || rv=$$?; \ +## The nullification of $(TEST_LOGS) is required to ensure that +## "make recheck-html" do not try to uselessly re-run tests. + $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_HTML) TEST_LOGS= || exit 4; \ + exit $$rv + +AM_RECURSIVE_TARGETS += check-html recheck-html + +.PHONY: check-html recheck-html +.MAKE: check-html recheck-html diff --git a/lib/am/check.am b/lib/am/check.am index 29faa3813..e0a453b32 100644 --- a/lib/am/check.am +++ b/lib/am/check.am @@ -1,6 +1,6 @@ ## automake - create Makefile.in from Makefile.am -## Copyright (C) 2001, 2003, 2006, 2007, 2008, 2009, 2010, 2011 Free -## Software Foundation, Inc. +## Copyright (C) 2001, 2003, 2006, 2007, 2008, 2009, 2010, 2011, 2012 +## 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 @@ -233,15 +233,18 @@ $(TEST_SUITE_LOG): $(TEST_LOGS) RECHECK_LOGS = $(TEST_LOGS) -# Run all the tests. -check-TESTS: +check-TESTS recheck: +## If we are running "make recheck", it's not the user which can decide +## which tests to consider for re-execution, so we must ignore the value +## of $(RECHECK_LOGS). + @if test $@ != recheck; then \ ## Expand $(RECHECK_LOGS) only once, to avoid exceeding line length limits. - @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list + list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list; \ + fi ## We always have to remove TEST_SUITE_LOG, to ensure its rule is run ## in any case even in lazy mode: otherwise, if no test needs rerunning, -## or a prior run plus reruns all happen within the same timestamp -## (can happen with a prior `make TESTS=<subset>'), -## then we get no log output. +## or a prior run plus reruns all happen within the same timestamp (can +## happen with a prior `make TESTS=<subset>'), then we get no log output. ## OTOH, this means that, in the rule for `$(TEST_SUITE_LOG)', we ## cannot use `$?' to compute the set of lazily rerun tests, lest ## we rely on .PHONY to work portably. @@ -251,59 +254,13 @@ check-TESTS: ## 3.80 to erroneously expand $(TESTS_LOGS) to `foo.log .log'. ## Work around this bug. test .log = $$f && continue; \ -## Be careful to avoid extra whitespace in the definition of $list. See -## comments in `recheck' below for why this might be useful. - if test -z "$$list"; then list=$$f; else list="$$list $$f"; fi; \ - done; \ - $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$list" - -AM_RECURSIVE_TARGETS += check - -## -------------- ## -## Produce HTML. ## -## -------------- ## - -.log.html: - @list='$(RST2HTML) $$RST2HTML rst2html rst2html.py'; \ - for r2h in $$list; do \ - if ($$r2h --version) >/dev/null 2>&1; then \ - R2H=$$r2h; \ - fi; \ - done; \ - if test -z "$$R2H"; then \ - echo >&2 "cannot find rst2html, cannot create $@"; \ - exit 2; \ - fi; \ - $$R2H $< >$@.tmp - @mv $@.tmp $@ - -# Be sure to run check first, and then to convert the result. -# Beware of concurrent executions. Run "check" not "check-TESTS", as -# check-SCRIPTS and other dependencies are rebuilt by the former only. -# And expect check to fail. -check-html: - @if $(MAKE) $(AM_MAKEFLAGS) check; then \ - rv=0; else rv=$$?; \ - fi; \ - $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_HTML) || exit 4; \ - exit $$rv - -.PHONY: check-html -.MAKE: check-html - -AM_RECURSIVE_TARGETS += check-html - -## -------------------- ## -## Rechecking failures. ## -## -------------------- ## - -## Rerun all FAILed or XPASSed tests. -recheck recheck-html: - @target=`echo $@ | sed 's,^re,,'`; \ - list='' list2='$(TEST_LOGS)'; for f in $$list2; do \ - test -f $$f || continue; \ - if test -r $$f && read line < $$f; then \ - case $$line in FAIL*|XPASS*) : ;; *) continue;; esac; \ +## If running a "make recheck", we must only consider tests that had +## an unexpected outcome (FAIL or XPASS) in the earlier run. + if test $@ = recheck; then \ + test -f $$f || continue; \ + if test -r $$f && read line < $$f; then \ + case $$line in FAIL*|XPASS*) : ;; *) continue;; esac; \ + fi; \ fi; \ ## Be careful to avoid extra whitespace in the definition of $list, since ## its value will be passed to the recursive make invocation below through @@ -313,12 +270,28 @@ recheck recheck-html: ## <http://lists.gnu.org/archive/html/bug-automake/2010-08/msg00004.html> if test -z "$$list"; then list=$$f; else list="$$list $$f"; fi; \ done; \ - $(MAKE) $(AM_MAKEFLAGS) $$target AM_MAKEFLAGS='$(AM_MAKEFLAGS) TEST_LOGS="'"$$list"'"' +## Under "make recheck", remove the logs of the files to recheck, so that +## those will be rerun by the "make test-suite.log" recursive invocation +## below. But use a proper hack to avoid extra files removal when running +## under "make -n". + if test $@ = recheck && test -n "$$list"; then \ + echo "am--clean: ; rm -f $$list" \ + | $(MAKE) $(AM_MAKEFLAGS) -f - am--clean || exit 1; \ + fi; \ + $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$list" + +## Recheck must depend on $(check_SCRIPTS), $(check_PROGRAMS), etc. +recheck: %CHECK_DEPS% + +AM_RECURSIVE_TARGETS += check recheck + +.PHONY: recheck -.PHONY: recheck recheck-html -.MAKE: recheck recheck-html +## ----------------------------------------------- ## +## Produce HTML. To be removed in automake 1.12. ## +## ----------------------------------------------- ## -AM_RECURSIVE_TARGETS += recheck recheck-html +include check-html.am else !%?PARALLEL_TESTS% diff --git a/tests/Makefile.am b/tests/Makefile.am index cfb0e4d4f..90b4085c9 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -130,6 +130,10 @@ EXTRA_DIST += distcheck-hook-m4.am # Each test case depends on defs, aclocal, and automake. check_SCRIPTS = defs aclocal-$(APIVERSION) automake-$(APIVERSION) +## Checking the list of tests. +include $(top_srcdir)/CheckListOfTests.am +maintainer-check-list-of-tests: $(parallel_tests) + clean-local: clean-local-check .PHONY: clean-local-check clean-local-check: diff --git a/tests/check.test b/tests/check.test index 0c258c5eb..300122821 100755 --- a/tests/check.test +++ b/tests/check.test @@ -29,8 +29,8 @@ END $ACLOCAL $AUTOMAKE -grep '^check-TESTS:' Makefile.in -grep '^check-DEJAGNU' Makefile.in && Exit 1 +grep 'check-TESTS.*:' Makefile.in +grep 'check-DEJAGNU' Makefile.in && Exit 1 # check-TESTS is phony. sed -n '/^\.PHONY:/,/^$/p' Makefile.in | grep check-TESTS diff --git a/tests/list-of-tests.mk b/tests/list-of-tests.mk index 528d9b774..ebaa46e9d 100644 --- a/tests/list-of-tests.mk +++ b/tests/list-of-tests.mk @@ -154,6 +154,7 @@ check8.test \ check9.test \ check10.test \ check11.test \ +check12.test \ check-exported-srcdir.test \ check-tests-in-builddir.test \ check-tests_environment.test \ @@ -318,6 +319,9 @@ discover.test \ dist-auxfile.test \ dist-auxfile-2.test \ dist-included-parent-dir.test \ +dist-missing-am.test \ +dist-missing-included-m4.test \ +dist-missing-m4.test \ distcleancheck.test \ distcom2.test \ distcom3.test \ @@ -632,6 +636,7 @@ parallel-tests7.test \ parallel-tests8.test \ parallel-tests9.test \ parallel-tests10.test \ +parallel-tests-dryrun.test \ parallel-tests-harderror.test \ parallel-tests-unreadable-log.test \ parallel-tests-subdir.test \ @@ -888,6 +893,7 @@ vala3.test \ vala4.test \ vala5.test \ vala-vpath.test \ +vala-mix.test \ vars.test \ vars3.test \ vartar.test \ diff --git a/tests/parallel-tests-dryrun.test b/tests/parallel-tests-dryrun.test new file mode 100755 index 000000000..c79a29386 --- /dev/null +++ b/tests/parallel-tests-dryrun.test @@ -0,0 +1,93 @@ +#! /bin/sh +# Copyright (C) 2012 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 interactions with "make -n". + +parallel_tests=yes +. ./defs || Exit 1 + +set -e + +echo AC_OUTPUT >> configure.in + +cat > Makefile.am <<'END' +TESTS = foo.test bar.test +$(TESTS): +END + +$ACLOCAL +$AUTOCONF +$AUTOMAKE -a + +./configure + +# Avoid confusion with test logs. +rm -f config.log + +log_files='test-suite.log foo.log bar.log' +html_files='test-suite.html foo.html bar.html' +the_files="$log_files $html_files" + +all_exist () +{ + st=0 + for i in $*; do + test -f $i || { echo File $i not found; st=1; } + done + test $st -eq 0 +} + +none_exist () +{ + st=0 + for i in $*; do + { test -r $i || test -f $i; } && { echo File $i found; st=1; } + done + test $st -eq 0 +} + +for targ in check recheck check-html recheck-html $the_files; do + $MAKE -n "$targ" + none_exist $the_files +done + +touch $the_files + +$MAKE -n mostlyclean +all_exist $the_files +$MAKE -n clean +all_exist $the_files + +cat > foo.test <<'END' +#! /bin/sh +exit 0 +END + +cat > bar.test <<'END' +#! /bin/sh +exit 1 +END + +chmod a+x foo.test bar.test + +$MAKE check && Exit 1 + +for targ in recheck recheck-html clean mostlyclean distclean; do + $MAKE -n "$targ" + all_exist $the_files +done + +: diff --git a/tests/parallel-tests2.test b/tests/parallel-tests2.test index 9cfe14fc1..78d5a762c 100755 --- a/tests/parallel-tests2.test +++ b/tests/parallel-tests2.test @@ -76,14 +76,49 @@ env TESTS=foo.test $MAKE -e recheck-html >stdout || { cat stdout; Exit 1; } cat stdout test -f mylog.html +# Create HTML output for an individual test. +$MAKE foo.html +grep 'this is .*foo\.test' foo.html +test ! -f bar.html +test ! -f baz.html + +# Create HTML output for individual tests. Since the pre-existing log +# files are expected to be used for the HTML conversion, this should +# go smoothly even for failed tests. +$MAKE bar.html baz.html +grep 'this is .*bar\.test' bar.html +grep 'this is .*baz\.test' baz.html + +# HTML output removed by mostlyclean. +$MAKE mostlyclean +test ! -f foo.html +test ! -f bar.html +test ! -f baz.html +test ! -f mylog.html + # check-html and recheck-html should cause check_SCRIPTS to be created, # and recheck-html should rerun no tests if check has not been run. + $MAKE clean +test ! -f mylog.html env TESTS=foo.test $MAKE -e check-html test -f bla +test -f foo.log +test ! -f bar.log +test ! -f baz.log + $MAKE clean env TESTS=foo.test $MAKE -e recheck-html test -f bla test ! -f foo.log test -f mylog.html + +$MAKE clean +$MAKE recheck-html +test -f bla +test ! -f foo.log +test ! -f bar.log +test ! -f baz.log +test -f mylog.html + : diff --git a/tests/vala-mix.test b/tests/vala-mix.test new file mode 100755 index 000000000..f597a7f87 --- /dev/null +++ b/tests/vala-mix.test @@ -0,0 +1,116 @@ +#! /bin/sh +# Copyright (C) 2012 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/>. + +# Vala sources and C sources in the same program. Functional test. + +required='cc GNUmake' +. ./defs || Exit 1 + +set -e + +cat >> configure.in <<'END' +AC_PROG_CC +AM_PROG_CC_C_O +AM_PROG_VALAC +AC_OUTPUT +END + +cat > Makefile.am <<'END' +bin_PROGRAMS = zardoz mu +AM_VALAFLAGS = --profile=posix +zardoz_SOURCES = foo.vala bar.c +mu_SOURCES = 1.vala 2.c +mu_VALAFLAGS = $(AM_VALAFLAGS) --main=run +mu_CFLAGS = -DHAVE_MU +END + +if cross_compiling; then :; else + unindent >> Makefile.am <<'END' + check-local: + ./zardoz + ./mu + ./zardoz | grep "foo is alive" + ./mu | grep "Howdy, World!" +END +fi + +cat > foo.vala <<'END' +int main () +{ + stdout.printf ("foo is alive\n"); + return 0; +} +END + +echo 'extern int i = 0;' > bar.c + +cat > 1.vala <<'END' +int run () +{ + stdout.printf ("Howdy, World!\n"); + return 0; +} +END + +cat > 2.c <<'END' +#ifdef HAVE_MU +int all_is_ok = 1; +#else +#error "HAVE_MU no defined" +chocke me +#endif +END + +$ACLOCAL +$AUTOMAKE -a +$AUTOCONF + +./configure + +$MAKE all +ls -l # For debugging. +$MAKE check + +have_generated_files () +{ + test -f mu_vala.stamp + test -f zardoz_vala.stamp + test -f foo.c + test -f 1.c +} + +# Our vala-related rules must create stamp files and intermediate +# C files. +have_generated_files + +$MAKE -q +$MAKE -n | grep stamp && Exit 1 + +# Check the distribution. +$MAKE distcheck + +# Stamp files and intermediate C files should *not* be removed +# by "make clean". +$MAKE clean +have_generated_files + +# But stamp files should be removed by "maintainer-clean" (the +# behaviour w.r.t. intermediate C files is still unclear, and +# better left undefined for the moment). +$MAKE maintainer-clean +ls *vala*.stamp | grep . && Exit 1 + +: diff --git a/tests/vala.test b/tests/vala.test index 34b71d4a4..9750942bd 100755 --- a/tests/vala.test +++ b/tests/vala.test @@ -1,6 +1,6 @@ #! /bin/sh -# Copyright (C) 1996, 2001, 2002, 2006, 2008, 2009 -# Free Software Foundation, Inc. +# Copyright (C) 1996, 2001, 2002, 2006, 2008, 2009, 2012 Free Software +# Foundation, Inc. # # This file is part of GNU Automake. # @@ -19,22 +19,31 @@ # the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, # Boston, MA 02110-1301, USA. -# Test to make sure intermediate .c files are built from vala source. +# Basic "grepping" test on vala support. -required="libtool" . ./defs || Exit 1 set -e -cat >> 'configure.in' << 'END' +# So that we won't require libtool macros. +cat > acinclude.m4 <<'END' +AC_DEFUN([AC_PROG_LIBTOOL], + [AC_SUBST([LIBTOOL], [:])]) +END + +cat >> configure.in <<'END' AC_PROG_CC -AM_PROG_AR +AC_PROG_CXX AC_PROG_LIBTOOL +AM_PROG_AR AM_PROG_VALAC +AC_CONFIG_FILES([sub/Makefile]) AC_OUTPUT END -cat > 'Makefile.am' <<'END' +cat > Makefile.am <<'END' +SUBDIRS = sub + bin_PROGRAMS = zardoz zardoz_SOURCES = zardoz.vala zardoz_VALAFLAGS = --debug @@ -43,6 +52,13 @@ lib_LTLIBRARIES = libzardoz.la libzardoz_la_SOURCES = zardoz-foo.vala zardoz-bar.vala END +mkdir sub + +cat > sub/Makefile.am <<'END' +bin_PROGRAMS = foo +foo_SOURCES = bar.vala baz.vala mu.c zap.cxx +END + : > ltmain.sh : > config.sub : > config.guess @@ -50,11 +66,23 @@ END $ACLOCAL $AUTOMAKE -a -grep 'VALAC' Makefile.in -grep 'am_zardoz_OBJECTS' Makefile.in -grep 'am_libzardoz_la_OBJECTS' Makefile.in -grep 'zardoz_vala.stamp' Makefile.in -grep 'libzardoz_la_vala.stamp' Makefile.in -grep 'zardoz\.c' Makefile.in -grep 'zardoz-foo\.c' Makefile.in +grep '\$(VALAC).* \$(AM_VALAFLAGS) \$(VALAFLAGS) ' Makefile.in +grep '\$(VALAC).* \$(zardoz_VALAFLAGS) \$(VALAFLAGS) ' Makefile.in +$FGREP 'am_zardoz_OBJECTS' Makefile.in +$FGREP 'am_libzardoz_la_OBJECTS' Makefile.in +$FGREP 'zardoz_vala.stamp:' Makefile.in +$FGREP 'libzardoz_la_vala.stamp:' Makefile.in +test `$FGREP -c '.stamp:' Makefile.in` -eq 2 +$FGREP 'zardoz.c' Makefile.in +$FGREP 'zardoz-foo.c' Makefile.in +$FGREP 'zardoz-bar.c' Makefile.in + +grep '\$(VALAC).* \$(AM_VALAFLAGS) \$(VALAFLAGS) ' sub/Makefile.in +$FGREP 'foo_VALAFLAGS' sub/Makefile.in && Exit 1 +$FGREP 'am_foo_OBJECTS' sub/Makefile.in +$FGREP 'bar.c' sub/Makefile.in +$FGREP 'baz.c' sub/Makefile.in +$FGREP 'foo_vala.stamp:' sub/Makefile.in +test `$FGREP -c '.stamp:' sub/Makefile.in` -eq 1 +: diff --git a/tests/vala5.test b/tests/vala5.test index 8fc703c4f..2206b255f 100755 --- a/tests/vala5.test +++ b/tests/vala5.test @@ -1,6 +1,6 @@ #! /bin/sh -# Copyright (C) 1996, 2001, 2002, 2006, 2008, 2009 -# Free Software Foundation, Inc. +# Copyright (C) 1996, 2001, 2002, 2006, 2008, 2009, 2012 Free Software +# Foundation, Inc. # # This file is part of GNU Automake. # @@ -21,54 +21,70 @@ # Test per-target flags. -required="libtool libtoolize pkg-config valac gcc GNUmake" +required="pkg-config valac gcc GNUmake" . ./defs || Exit 1 set -e mkdir src -cat >> 'configure.in' << 'END' +cat >> configure.in <<'END' AC_PROG_CC AM_PROG_CC_C_O -AC_PROG_LIBTOOL AM_PROG_VALAC([0.7.0]) -PKG_CHECK_MODULES([GOBJECT],[gobject-2.0 >= 2.10]) +PKG_CHECK_MODULES([GOBJECT], [gobject-2.0 >= 2.10]) AC_CONFIG_FILES([src/Makefile]) AC_OUTPUT END -cat > 'Makefile.am' <<'END' +cat > Makefile.am <<'END' SUBDIRS = src END -cat > 'src/Makefile.am' <<'END' +cat > src/Makefile.am <<'END' bin_PROGRAMS = foo bar foo_CFLAGS = $(GOBJECT_CFLAGS) foo_LDADD = $(GOBJECT_LIBS) -foo_SOURCES = baz.vala -bar_SOURCES = baz.vala +foo_SOURCES = xfoo.vala +bar_SOURCES = xbar.vala bar_VALAFLAGS = -D BAR bar_CFLAGS = $(GOBJECT_CFLAGS) bar_LDADD = $(GOBJECT_LIBS) END -cat > 'src/baz.vala' <<'END' -void main () { +cat > src/xfoo.vala <<'END' +int main () +{ + stdout.printf ("foo\n"); + return 0; +} +END + +cat > src/xbar.vala <<'END' +void main () +{ #if BAR stdout.printf ("bar\n"); #else - stdout.printf ("foo\n"); + stdout.oops_an_invalid_method (); #endif } END -libtoolize - $ACLOCAL $AUTOCONF $AUTOMAKE -a -./configure || Exit 77 +grep PKG_CHECK_MODULES configure && skip_ "pkg-config m4 macros not found" + +./configure $MAKE +if cross_compiling; then :; else + ./src/foo + ./src/bar + test `./src/foo` = foo + test `./src/bar` = bar +fi + +: |