summaryrefslogtreecommitdiff
path: root/contrib/t
diff options
context:
space:
mode:
authorStefano Lattarini <stefano.lattarini@gmail.com>2012-07-02 17:24:24 +0200
committerStefano Lattarini <stefano.lattarini@gmail.com>2012-07-02 19:04:50 +0200
commitd7d983b0276e903b492054d99cbbd6918279cb6a (patch)
treeb7e915ae02dff66c05b1c92c3d0e93cf5b82a2c7 /contrib/t
parent22786e467794bb1ee0daf4f47b59de7db612204b (diff)
downloadautomake-d7d983b0276e903b492054d99cbbd6918279cb6a.tar.gz
tests: tests for stuff in contrib goes in 'contrib/t'
* t/help-multilib.sh: Move ... * contrib/t/help-multilib.sh: .. here. Remove a now-obsolete "FIXME" comment. * t/multlib.sh: Move ... * contrib/t/multilib.sh: .. here. Remove a now-obsolete "FIXME" comment. * t/parallel-test2.sh: Move ... * contrib/t/parallel-tests-html.sh: .. here. Remove a now-obsolete "FIXME" comment. * contrib/t/local.am: New, basically defining the list of tests for stuff in 'contrib/'. * t/list-of-tests.mk, Makefile.am: Adjust. * .gitignore: Update. * syntax-checks.mk (xtests): Likewise. Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Diffstat (limited to 'contrib/t')
-rwxr-xr-xcontrib/t/help-multilib.sh32
-rw-r--r--contrib/t/local.am24
-rwxr-xr-xcontrib/t/multilib.sh160
-rwxr-xr-xcontrib/t/parallel-tests-html.sh144
4 files changed, 360 insertions, 0 deletions
diff --git a/contrib/t/help-multilib.sh b/contrib/t/help-multilib.sh
new file mode 100755
index 000000000..3e89bbe6a
--- /dev/null
+++ b/contrib/t/help-multilib.sh
@@ -0,0 +1,32 @@
+#! /bin/sh
+# Copyright (C) 2010-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/>.
+
+# Make sure that our macro 'AM_ENABLE_MULTILIB' adds proper text to
+# the configure help screen.
+
+. ./defs || exit 1
+
+cat > configure.ac <<END
+AC_INIT([$me], [1.0])
+AM_ENABLE_MULTILIB
+END
+
+cat "$am_top_srcdir"/contrib/multilib/multi.m4 > aclocal.m4
+$AUTOCONF
+
+grep_configure_help --enable-multilib ' many library versions \(default\)'
+
+:
diff --git a/contrib/t/local.am b/contrib/t/local.am
new file mode 100644
index 000000000..0a5f5c1fc
--- /dev/null
+++ b/contrib/t/local.am
@@ -0,0 +1,24 @@
+# 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)/help-multilib.sh \
+ $(contrib_testsuite_dir)/multilib.sh
diff --git a/contrib/t/multilib.sh b/contrib/t/multilib.sh
new file mode 100755
index 000000000..fef1ec2ab
--- /dev/null
+++ b/contrib/t/multilib.sh
@@ -0,0 +1,160 @@
+#! /bin/sh
+# Copyright (C) 2003-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 multilib support.
+# Based on a test case from Ralf Corsepius.
+
+required='gcc GNUmake'
+. ./defs || exit 1
+
+mldir=$am_top_srcdir/contrib/multilib
+mkdir m4
+cp "$mldir"/config-ml.in "$mldir"/symlink-tree .
+cp "$mldir"/multi.m4 m4
+
+ACLOCAL_PATH=${ACLOCAL_PATH+"$ACLOCAL_PATH:"}$(pwd)/m4
+export ACLOCAL_PATH
+
+cat >configure.ac <<'END'
+AC_INIT([multlib], [1.0])
+AC_CONFIG_SRCDIR(libfoo/foo.c)
+AC_CONFIG_AUX_DIR(.)
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([Makefile])
+AC_CONFIG_SUBDIRS(libfoo)
+AC_CONFIG_SUBDIRS(libbar)
+AC_OUTPUT
+END
+
+cat >mycc <<'END'
+#! /bin/sh
+case ${1+"$@"} in
+ *-print-multi-lib*)
+ echo ".;"
+ echo "debug;@g"
+ exit 0 ;;
+esac
+gcc ${1+"$@"}
+END
+
+chmod +x mycc
+PATH=$(pwd)$PATH_SEPARATOR$PATH; export PATH
+
+cat >Makefile.am <<'EOF'
+SUBDIRS = @subdirs@
+EXTRA_DIST = config-ml.in symlink-tree
+check-all:
+ test -f debug/libfoo/libfoo.a
+ test -f debug/libbar/libbar.a
+ test -f libfoo/libfoo.a
+ test -f libbar/libbar.a
+EOF
+
+# libfoo tests multilib supports when there are no subdirectories
+# libbar tests multilib supports when there are subdirectories
+
+mkdir libfoo
+cp "$mldir"/multilib.am libfoo/
+
+cat >libfoo/configure.ac <<'END'
+AC_PREREQ(2.57)
+AC_INIT(libfoo, 0.1, nobody@localhost)
+AC_CONFIG_SRCDIR(foo.c)
+# Apparently it doesn't work to have auxdir=.. when
+# multilib uses symlinked trees.
+AC_CONFIG_AUX_DIR(.)
+AM_INIT_AUTOMAKE
+AC_PROG_CC
+AM_PROG_AR
+AC_PROG_RANLIB
+AM_ENABLE_MULTILIB(Makefile,[..])
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+END
+
+cat >libfoo/Makefile.am <<'END'
+noinst_LIBRARIES = libfoo.a
+libfoo_a_SOURCES = foo.c
+include $(top_srcdir)/multilib.am
+END
+
+: > libfoo/foo.c
+
+mkdir libbar
+cp "$mldir"/multilib.am libbar/
+
+cat >libbar/configure.ac <<'END'
+AC_PREREQ(2.57)
+AC_INIT(libbar, 0.1, nobody@localhost)
+# Apparently it doesn't work to have auxdir=.. when
+# multilib uses symlinked trees.
+AC_CONFIG_AUX_DIR(.)
+AM_INIT_AUTOMAKE
+AC_PROG_CC
+AM_PROG_AR
+AC_PROG_RANLIB
+AM_ENABLE_MULTILIB(Makefile,[..])
+AC_CONFIG_FILES([Makefile sub/Makefile])
+AC_OUTPUT
+END
+
+cat >libbar/Makefile.am <<'END'
+SUBDIRS = sub
+noinst_LIBRARIES = libbar.a
+libbar_a_SOURCES = bar.c
+include $(top_srcdir)/multilib.am
+END
+
+mkdir libbar/sub
+echo 'include $(top_srcdir)/multilib.am' >libbar/sub/Makefile.am
+: > libbar/bar.c
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing
+
+cd libfoo
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing
+cd ..
+
+cd libbar
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing
+cd ..
+
+# Check VPATH builds
+mkdir build
+cd build
+../configure --enable-multilib CC=mycc
+$MAKE
+test -f debug/libfoo/libfoo.a
+test -f debug/libbar/libbar.a
+test -f libfoo/libfoo.a
+test -f libbar/libbar.a
+$MAKE install
+$MAKE distcleancheck
+
+# Check standard builds.
+cd ..
+# Why to I have to specify --with-target-subdir?
+./configure --enable-multilib --with-target-subdir=. CC=mycc
+$MAKE check
+DISTCHECK_CONFIGURE_FLAGS='--enable-multilib CC=mycc' $MAKE distcheck
+
+:
diff --git a/contrib/t/parallel-tests-html.sh b/contrib/t/parallel-tests-html.sh
new file mode 100755
index 000000000..e7abc6637
--- /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
+env TESTS=foo.test $MAKE -e check-html
+test -f mylog.html
+
+# Create summarizing HTML output also with recheck-html.
+rm -f mylog.html
+env TESTS=foo.test $MAKE -e 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
+env TEST_LOGS=foo.log $MAKE -e check-html
+test -f bla
+test -f foo.log
+test ! -e bar.log
+test ! -e baz.log
+test -f mylog.html
+
+$MAKE clean
+env TESTS=foo.test $MAKE -e recheck-html
+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
+
+: