diff options
author | Stefano Lattarini <stefano.lattarini@gmail.com> | 2012-07-02 21:40:47 +0200 |
---|---|---|
committer | Stefano Lattarini <stefano.lattarini@gmail.com> | 2012-07-02 21:40:47 +0200 |
commit | cf2a81c0fc6579ce2fce57cea25fcac57e919c7a (patch) | |
tree | fc6bfcf78a3228dbd335fe5a0d6cd75ddf4f36ae /contrib | |
parent | e1b72b8f69b934116018c4d9fcb42dabe89e14a5 (diff) | |
parent | 67abae49732991b596e6fa6d9d93a925720abe64 (diff) | |
download | automake-cf2a81c0fc6579ce2fce57cea25fcac57e919c7a.tar.gz |
Merge branch 'master' into ng/master
* master:
contrib: check-html: pass flags to rst2html invocations
contrib: simple improvements to check-html
coverage: check-html can be used recursively
tests: tests for stuff in contrib goes in 'contrib/t'
recursion: support user-defined recursive targets
tests: rename 'recurs*.sh' to 'var-recurs*.sh'
tests: minor improvements to 'recurs*.sh'
Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/check-html.am | 21 | ||||
-rw-r--r-- | contrib/t/local.am | 25 | ||||
-rwxr-xr-x | contrib/t/parallel-tests-html-recursive.sh | 163 | ||||
-rwxr-xr-x | contrib/t/parallel-tests-html.sh | 144 |
4 files changed, 342 insertions, 11 deletions
diff --git a/contrib/check-html.am b/contrib/check-html.am index c9d44cd6a..2604c5ec8 100644 --- a/contrib/check-html.am +++ b/contrib/check-html.am @@ -29,18 +29,17 @@ mostlyclean-check-html: 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 $@"; \ + @list='$(RST2HTML) rst2html rst2html.py'; \ + while :; do \ + for r2h in $$list; do \ + if ($$r2h --version) >/dev/null 2>&1; then break 2; \ + else :; fi; \ + done; \ + echo "cannot find rst2html, cannot create $@" >&2; \ exit 2; \ - fi; \ - $$R2H $< >$@.tmp - @mv $@.tmp $@ + done; \ + $$r2h $(AM_RST2HTMLFLAGS) $(RST2HTMLFLAGS) $< >$@-t \ + && mv -f $@-t $@ # Be sure to run check first, and then to convert the result. # Beware of concurrent executions. Run "check" not "check-TESTS", as diff --git a/contrib/t/local.am b/contrib/t/local.am new file mode 100644 index 000000000..3859c70c7 --- /dev/null +++ b/contrib/t/local.am @@ -0,0 +1,25 @@ +# Copyright (C) 1995-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/>. + +# Automake: tests for stuff in 'contrib/'. + +## Relative to the top-level directory. +contrib_testsuite_dir = contrib/t + +contrib_TESTS = \ + $(contrib_testsuite_dir)/parallel-tests-html.sh \ + $(contrib_testsuite_dir)/parallel-tests-html-recursive.sh \ + $(contrib_testsuite_dir)/help-multilib.sh \ + $(contrib_testsuite_dir)/multilib.sh diff --git a/contrib/t/parallel-tests-html-recursive.sh b/contrib/t/parallel-tests-html-recursive.sh new file mode 100755 index 000000000..12d967ecf --- /dev/null +++ b/contrib/t/parallel-tests-html-recursive.sh @@ -0,0 +1,163 @@ +#! /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/>. + +# Recursive use of 'check-html'. See Automake bug#11287. + +. ./defs || exit 1 + +# Try the variants that are tried in check-html.am. +while :; do + for r2h in $RST2HTML rst2html rst2html.py; do + echo "$me: running $r2h --version" + $r2h --version && break 2 + : For shells with busted 'set -e'. + done + skip_all_ "no proper rst2html program found" +done +unset r2h + +cp "$am_top_srcdir"/contrib/check-html.am . \ + || fatal_ "cannot fetch 'check-html.am' from contrib" + +cat >> configure.ac << 'END' +AM_EXTRA_RECURSIVE_TARGETS([check-html]) +AC_CONFIG_FILES([sub/Makefile sub/more/Makefile]) +AC_OUTPUT +END + +cat > Makefile.am << 'END' +SUBDIRS = sub +EXTRA_DIST = $(TESTS) +TEST_SUITE_LOG = mylog.log +TESTS = foo.test bar.sh mu +XFAIL_TESTS = bar.sh +check_SCRIPTS = bla +bla: + echo '#!/bin/sh' > $@-t + echo 'echo Blah Blah Blah' >> $@-t + chmod a+x,a-w $@-t + mv -f $@-t $@ +CLEANFILES = bla +include $(srcdir)/check-html.am +END + +mkdir sub +echo SUBDIRS = more > sub/Makefile.am + +mkdir sub/more +cat > sub/more/Makefile.am << 'END' +include $(top_srcdir)/check-html.am +TEST_EXTENSIONS = .test .sh +TESTS = sh.sh test.test +LOG_COMPILER = true +test.log: sh.log +nodist_check_DATA = x.txt +$(nodist_check_DATA): + echo $@ > $@ +CLEANFILES = $(nodist_check_DATA) +EXTRA_DIST = $(TESTS) +END + +cat > foo.test <<'END' +#! /bin/sh +./bla +exit 77 +END + +cat > bar.sh <<'END' +#! /bin/sh +echo "this is $0" +exit 1 +END + +cat > mu <<'END' +#! /bin/sh +set -x +test -f sub/more/test.log +test -f sub/more/sh.log +END + +cat > sub/more/test.test << 'END' +#!/bin/sh +echo "this is $0" +set -x +test -f sh.log +test -f x.txt +exit 77 +END + +cat > sub/more/sh.sh << 'END' +#!/bin/sh +set -x +test ! -f test.log +test -f x.txt +END + + +cat > sub/more/mu << 'END' +#!/bin/sh +exit 99 +END + +chmod a+x foo.test bar.sh mu sub/more/test.test sub/more/sh.sh + +$ACLOCAL +$AUTOCONF +$AUTOMAKE -a + +./configure + +$MAKE check-html +grep 'Blah Blah Blah' mylog.html +grep 'this is .*bar\.sh' mylog.html +grep 'this is .*test\.test' sub/more/test-suite.html +# check-html should cause check_SCRIPTS and check_DATA to be created. +test -f bla +test -f sub/more/x.txt + +# "make clean" should remove HTML files. +$MAKE clean +test ! -e mylog.html +test ! -e sub/more/test-suite.html +test ! -e bla +test ! -e sub/more/x.txt + +# Create HTML output for individual tests. + +$MAKE bla +$MAKE foo.html bar.sh.html +grep 'Blah Blah Blah' foo.html +grep 'this is .*bar\.sh' bar.sh.html +test ! -e mu.hml + +ocwd=$(pwd) || fatal_ "getting current workind directory" +( cd sub/more \ + && $MAKE sh.html \ + && test -f sh.html \ + && test ! -e test.html \ + && $MAKE test.html \ + && grep 'this is .*test\.test' test.html) || exit 1 + +# HTML output removed by mostlyclean. +$MAKE check-html +test -f mylog.html +test -f sub/more/test-suite.html +$MAKE mostlyclean +find . -name '*.html' | grep . && exit 1 + +$MAKE distcheck + +: diff --git a/contrib/t/parallel-tests-html.sh b/contrib/t/parallel-tests-html.sh new file mode 100755 index 000000000..78cae7a19 --- /dev/null +++ b/contrib/t/parallel-tests-html.sh @@ -0,0 +1,144 @@ +#! /bin/sh +# Copyright (C) 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 +# 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: +# - check-html +# - recheck-html + +. ./defs || exit 1 + +# Try the variants that are tried in check-html.am. +while :; do + for r2h in $RST2HTML rst2html rst2html.py; do + echo "$me: running $r2h --version" + $r2h --version && break 2 + : For shells with busted 'set -e'. + done + skip_all_ "no proper rst2html program found" +done +unset r2h + +cp "$am_top_srcdir"/contrib/check-html.am . \ + || fatal_ "cannot fetch 'check-html.am' from contrib" + +cat >> configure.ac << 'END' +AC_OUTPUT +END + +cat > Makefile.am << 'END' +TEST_SUITE_LOG = mylog.log +TESTS = foo.test bar.test baz.test +check_SCRIPTS = bla +bla: + echo bla > $@ +CLEANFILES = bla +include $(srcdir)/check-html.am +END + +cat > foo.test <<'END' +#! /bin/sh +echo "this is $0" +test -f bla || exit 1 +exit 0 +END + +cat > bar.test <<'END' +#! /bin/sh +echo "this is $0" +exit 99 +END + +cat > baz.test <<'END' +#! /bin/sh +echo "this is $0" +exit 1 +END + +chmod a+x foo.test bar.test baz.test + +$ACLOCAL +$AUTOCONF +$AUTOMAKE -a + +./configure + +$MAKE check-html && exit 1 +test -f mylog.html +# check-html should cause check_SCRIPTS to be created. +test -f bla + +# "make clean" should remove HTML files. +$MAKE clean +test ! -e mylog.html +test ! -e bla + +# Always create the HTML output, even if there were no failures. +rm -f mylog.html +$MAKE TESTS=foo.test check-html +test -f mylog.html + +# Create summarizing HTML output also with recheck-html. +rm -f mylog.html +$MAKE TESTS=foo.test recheck-html +test -f mylog.html + +# Create HTML output for an individual test. +$MAKE foo.html +grep 'this is .*foo\.test' foo.html +test ! -e bar.html +test ! -e 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 ! -e foo.html +test ! -e bar.html +test ! -e baz.html +test ! -e 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 ! -e mylog.html +$MAKE check-html TEST_LOGS=foo.log +test -f bla +test -f foo.log +test ! -e bar.log +test ! -e baz.log +test -f mylog.html + +$MAKE clean +$MAKE recheck-html TESTS=foo.test +test -f bla +test ! -e foo.log +test -f mylog.html + +$MAKE clean +$MAKE recheck-html +test -f bla +test ! -e foo.log +test ! -e bar.log +test ! -e baz.log +test -f mylog.html + +: |