From 8b4dfc2d2923fd5d232b4b20ce147168b3532ab3 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Sat, 6 Aug 2011 12:35:05 +0200 Subject: testsuite: use TAP for `instspc*' tests, related simplifications * tests/instspc-tests.sh: Delete this complex and multifarious script, moving all it checks it used to perform into ... * tests/instspc.tap: ... this TAP-based test script. * tests/instspc-data.test: Deleted. * tests/Makefile.am ($(srcdir)/instspc-tests.am): Don't include nor generate it anymore. (EXTRA_DIST): Don't distribute instspc-tests.sh anymore. (TEST_EXTENSIONS): Remove '.instspc'. (INSTSPC_LOG_COMPILER): Deleted. (XFAIL_TESTS): Remove $(instspc_xfail_tests). (instspc-data.log, $(instspc_tests:.instspc=.log)): Delete dependencies for these files, which are not used anymore. ($(instspc_tests)): Delete this dummy dependency declaration. (TESTS): Remove $(instspc_tests). (handwritten_tests): Remove instspc-data.test, add instspc.tap. * bootstrap: Don't generate tests/instspc-tests.am anymore. --- ChangeLog | 20 +++ bootstrap | 1 - tests/Makefile.am | 29 +--- tests/Makefile.in | 119 ++++------------- tests/instspc-data.test | 31 ----- tests/instspc-tests.sh | 343 ------------------------------------------------ tests/instspc.tap | 266 +++++++++++++++++++++++++++++++++++++ 7 files changed, 315 insertions(+), 494 deletions(-) delete mode 100755 tests/instspc-data.test delete mode 100755 tests/instspc-tests.sh create mode 100755 tests/instspc.tap diff --git a/ChangeLog b/ChangeLog index 6f58794f8..2af559c04 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +2011-08-06 Stefano Lattarini + + testsuite: use TAP for `instspc*' tests, related simplifications + * tests/instspc-tests.sh: Delete this complex and multifarious + script, moving all it checks it used to perform into ... + * tests/instspc.tap: ... this TAP-based test script. + * tests/instspc-data.test: Deleted. + * tests/Makefile.am ($(srcdir)/instspc-tests.am): Don't include + nor generate it anymore. + (EXTRA_DIST): Don't distribute instspc-tests.sh anymore. + (TEST_EXTENSIONS): Remove '.instspc'. + (INSTSPC_LOG_COMPILER): Deleted. + (XFAIL_TESTS): Remove $(instspc_xfail_tests). + (instspc-data.log, $(instspc_tests:.instspc=.log)): Delete + dependencies for these files, which are not used anymore. + ($(instspc_tests)): Delete this dummy dependency declaration. + (TESTS): Remove $(instspc_tests). + (handwritten_tests): Remove instspc-data.test, add instspc.tap. + * bootstrap: Don't generate tests/instspc-tests.am anymore. + 2011-08-06 Stefano Lattarini testsuite: do fd redirections with $(AM_TESTS_FD_REDIRECT) diff --git a/bootstrap b/bootstrap index aafc6eb3f..1abf39b63 100755 --- a/bootstrap +++ b/bootstrap @@ -107,7 +107,6 @@ dosubst automake.in automake.tmp cd tests $BOOTSTRAP_SHELL ./gen-parallel-tests > parallel-tests.am $BOOTSTRAP_SHELL ./gen-config-shell-tests > config-shell-tests.am -$BOOTSTRAP_SHELL ./instspc-tests.sh --generate-makefile > instspc-tests.am $BOOTSTRAP_SHELL ./depmod-tests.sh --generate-makefile > depmod-tests.am cd .. diff --git a/tests/Makefile.am b/tests/Makefile.am index 6a404c7f5..182e98714 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -66,28 +66,6 @@ $(parallel_tests:.ptest=.log): parallel-tests.sh $(parallel_tests): -include $(srcdir)/instspc-tests.am - -TEST_EXTENSIONS += .instspc -INSTSPC_LOG_COMPILER = $(SHELL) $(srcdir)/instspc-tests.sh -EXTRA_DIST += instspc-tests.sh - -$(srcdir)/instspc-tests.am: instspc-tests.sh Makefile.am - $(AM_V_GEN)($(am__cd) $(srcdir) \ - && $(SHELL) ./instspc-tests.sh --generate-makefile) >$@ - -# All `*.instspc' tests work by calling the script `instspc-tests.sh'. -# Also, they all use shared data generated by the `instspc-data.test' -# helper test (for reasons of speed). -instspc-data.log: instspc-tests.sh -$(instspc_tests:.instspc=.log): instspc-tests.sh instspc-data.log -# This dummy declaration is required to have make actually produce -# expected log files from the `.instspc.log' suffix rule. -$(instspc_tests): - -XFAIL_TESTS += $(instspc_xfail_tests) - - include $(srcdir)/depmod-tests.am $(srcdir)/depmod-tests.am: depmod-tests.sh Makefile.am @@ -149,12 +127,14 @@ TESTS = \ $(handwritten_tests) \ $(config_shell_tests) \ $(parallel_tests) \ - $(depmod_tests) \ - $(instspc_tests) + $(depmod_tests) EXTRA_DIST += $(handwritten_tests) handwritten_tests = \ +## This test should take a long time, so put it first to improve +## performance on concurrent testsuite runs. +instspc.tap \ aclocal.test \ aclocal3.test \ aclocal4.test \ @@ -577,7 +557,6 @@ instman2.test \ instmany.test \ instmany-mans.test \ instmany-python.test \ -instspc-data.test \ interp.test \ interp2.test \ java.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index c79e5232c..47a1b695b 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -53,8 +53,7 @@ DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/aclocal.in $(srcdir)/automake.in \ $(srcdir)/config-shell-tests.am $(srcdir)/defs \ $(srcdir)/defs-static.in $(srcdir)/depmod-tests.am \ - $(srcdir)/instspc-tests.am $(srcdir)/parallel-tests.am \ - $(top_srcdir)/CheckListOfTests.am + $(srcdir)/parallel-tests.am $(top_srcdir)/CheckListOfTests.am subdir = tests ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/amversion.m4 \ @@ -187,15 +186,11 @@ am__test_logs4 = $(am__test_logs3:.ptest.log=.log) PTEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/lib/test-driver PTEST_LOG_COMPILE = $(PTEST_LOG_COMPILER) $(AM_PTEST_LOG_FLAGS) \ $(PTEST_LOG_FLAGS) -am__test_logs5 = $(am__test_logs4:.instspc.log=.log) -INSTSPC_LOG_DRIVER = $(SHELL) $(top_srcdir)/lib/test-driver -INSTSPC_LOG_COMPILE = $(INSTSPC_LOG_COMPILER) $(AM_INSTSPC_LOG_FLAGS) \ - $(INSTSPC_LOG_FLAGS) -am__test_logs6 = $(am__test_logs5:.depmod.log=.log) +am__test_logs5 = $(am__test_logs4:.depmod.log=.log) DEPMOD_LOG_DRIVER = $(SHELL) $(top_srcdir)/lib/test-driver DEPMOD_LOG_COMPILE = $(DEPMOD_LOG_COMPILER) $(AM_DEPMOD_LOG_FLAGS) \ $(DEPMOD_LOG_FLAGS) -TEST_LOGS = $(am__test_logs6:.shtst.log=.log) +TEST_LOGS = $(am__test_logs5:.shtst.log=.log) SHTST_LOG_DRIVER = $(SHELL) $(top_srcdir)/lib/test-driver SHTST_LOG_COMPILE = $(SHTST_LOG_COMPILER) $(AM_SHTST_LOG_FLAGS) \ $(SHTST_LOG_FLAGS) @@ -298,25 +293,32 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -TEST_EXTENSIONS = .test .tap .ptest .instspc .depmod .shtst +TEST_EXTENSIONS = .test .tap .ptest .depmod .shtst TAP_LOG_DRIVER = $(PERL) $(top_srcdir)/lib/tap-driver TAP_LOG_DRIVER_FLAGS = --merge --comments --diagnostic-string `printf \ '\043%%\043\n'` MAINTAINERCLEANFILES = EXTRA_DIST = ChangeLog-old gen-parallel-tests parallel-tests.sh \ - instspc-tests.sh depmod-tests.sh gen-config-shell-tests \ - config-shell-tests.sh $(handwritten_tests) tap-functions.sh \ - plain-functions.sh trivial-test-driver \ - testsuite-summary-checks.sh extract-testsuite-summary \ - tap-setup.sh tap-summary-aux.sh + depmod-tests.sh gen-config-shell-tests config-shell-tests.sh \ + $(handwritten_tests) tap-functions.sh plain-functions.sh \ + trivial-test-driver testsuite-summary-checks.sh \ + extract-testsuite-summary tap-setup.sh tap-summary-aux.sh # Run the tests with the shell detected at configure time. TEST_LOG_COMPILER = $(SHELL) -XFAIL_TESTS = all.test auxdir2.test cond17.test gcj6.test \ - override-conditional-2.test pr8365-remake-timing.test \ - yacc-dist-nobuild-subdir.test tap-plan-corner2.test \ - tap-message-0.test tap-signal.test txinfo5.test \ - $(instspc_xfail_tests) +XFAIL_TESTS = \ +all.test \ +auxdir2.test \ +cond17.test \ +gcj6.test \ +override-conditional-2.test \ +pr8365-remake-timing.test \ +yacc-dist-nobuild-subdir.test \ +tap-plan-corner2.test \ +tap-message-0.test \ +tap-signal.test \ +txinfo5.test + parallel_tests = backcompat5-p.ptest check-exported-srcdir-p.ptest \ check-fd-redirect-p.ptest check-subst-prog-p.ptest \ check-subst-p.ptest check-tests-in-builddir-p.ptest \ @@ -327,58 +329,6 @@ parallel_tests = backcompat5-p.ptest check-exported-srcdir-p.ptest \ maken3-p.ptest maken4-p.ptest posixsubst-tests-p.ptest \ tests-environment-p.ptest PTEST_LOG_COMPILER = $(SHELL) $(srcdir)/parallel-tests.sh -instspc_tests = build-squote.instspc install-squote.instspc \ - build-dquote.instspc install-dquote.instspc \ - build-bquote.instspc install-bquote.instspc \ - build-sharp.instspc install-sharp.instspc build-dollar.instspc \ - install-dollar.instspc build-bang.instspc install-bang.instspc \ - build-bslash.instspc install-bslash.instspc \ - build-ampersand.instspc install-ampersand.instspc \ - build-percent.instspc install-percent.instspc \ - build-leftpar.instspc install-leftpar.instspc \ - build-rightpar.instspc install-rightpar.instspc \ - build-pipe.instspc install-pipe.instspc build-caret.instspc \ - install-caret.instspc build-tilde.instspc \ - install-tilde.instspc build-qmark.instspc \ - install-qmark.instspc build-star.instspc install-star.instspc \ - build-plus.instspc install-plus.instspc build-minus.instspc \ - install-minus.instspc build-comma.instspc \ - install-comma.instspc build-colon.instspc \ - install-colon.instspc build-semicol.instspc \ - install-semicol.instspc build-equal.instspc \ - install-equal.instspc build-less.instspc install-less.instspc \ - build-more.instspc install-more.instspc build-at.instspc \ - install-at.instspc build-lqbrack.instspc \ - install-lqbrack.instspc build-rqbrack.instspc \ - install-rqbrack.instspc build-lcbrack.instspc \ - install-lcbrack.instspc build-rcbrack.instspc \ - install-rcbrack.instspc build-space.instspc \ - install-space.instspc build-tab.instspc install-tab.instspc \ - build-linefeed.instspc install-linefeed.instspc \ - build-backspace.instspc install-backspace.instspc \ - build-formfeed.instspc install-formfeed.instspc \ - build-carriageret.instspc install-carriageret.instspc \ - build-quadrigraph0.instspc install-quadrigraph0.instspc \ - build-quadrigraph1.instspc install-quadrigraph1.instspc \ - build-quadrigraph2.instspc install-quadrigraph2.instspc \ - build-quadrigraph3.instspc install-quadrigraph3.instspc \ - build-quadrigraph4.instspc install-quadrigraph4.instspc \ - build-a_b.instspc install-a_b.instspc build-a__b.instspc \ - install-a__b.instspc build-a_lf_b.instspc \ - install-a_lf_b.instspc build-dotdotdot.instspc \ - install-dotdotdot.instspc build-dosdrive.instspc \ - install-dosdrive.instspc build-miscglob1.instspc \ - install-miscglob1.instspc build-miscglob2.instspc \ - install-miscglob2.instspc -instspc_xfail_tests = build-squote.instspc build-dquote.instspc \ - build-bquote.instspc build-sharp.instspc build-dollar.instspc \ - build-bslash.instspc build-ampersand.instspc \ - build-linefeed.instspc build-quadrigraph0.instspc \ - build-a_lf_b.instspc install-squote.instspc \ - install-dquote.instspc install-bquote.instspc \ - install-sharp.instspc install-dollar.instspc \ - install-linefeed.instspc install-a_lf_b.instspc -INSTSPC_LOG_COMPILER = $(SHELL) $(srcdir)/instspc-tests.sh depmod_tests = depcomp-gcc3.depmod depcomp-gcc.depmod \ depcomp-hp.depmod depcomp-sgi.depmod depcomp-aix.depmod \ depcomp-icc.depmod depcomp-hp2.depmod depcomp-tru64.depmod \ @@ -416,10 +366,10 @@ TESTS = \ $(handwritten_tests) \ $(config_shell_tests) \ $(parallel_tests) \ - $(depmod_tests) \ - $(instspc_tests) + $(depmod_tests) handwritten_tests = \ +instspc.tap \ aclocal.test \ aclocal3.test \ aclocal4.test \ @@ -842,7 +792,6 @@ instman2.test \ instmany.test \ instmany-mans.test \ instmany-python.test \ -instspc-data.test \ interp.test \ interp2.test \ java.test \ @@ -1508,8 +1457,8 @@ am__tdf = diff-in-tests-lists.tmp all: all-am .SUFFIXES: -.SUFFIXES: .depmod .html .instspc .log .ptest .shtst .tap .test .trs -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(srcdir)/parallel-tests.am $(srcdir)/instspc-tests.am $(srcdir)/depmod-tests.am $(srcdir)/config-shell-tests.am $(top_srcdir)/CheckListOfTests.am $(am__configure_deps) +.SUFFIXES: .depmod .html .log .ptest .shtst .tap .test .trs +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(srcdir)/parallel-tests.am $(srcdir)/depmod-tests.am $(srcdir)/config-shell-tests.am $(top_srcdir)/CheckListOfTests.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ @@ -1732,11 +1681,6 @@ recheck recheck-html: --log-file '$*.log' --trs-file '$*.trs' \ $(am__common_driver_flags) $(AM_PTEST_LOG_DRIVER_FLAGS) $(PTEST_LOG_DRIVER_FLAGS) -- $(PTEST_LOG_COMPILE) "$$tst" \ $(AM_TESTS_FD_REDIRECT) -.instspc.log: - @p='$<'; $(am__check_pre) $(INSTSPC_LOG_DRIVER) --test-name "$$f" \ - --log-file '$*.log' --trs-file '$*.trs' \ - $(am__common_driver_flags) $(AM_INSTSPC_LOG_DRIVER_FLAGS) $(INSTSPC_LOG_DRIVER_FLAGS) -- $(INSTSPC_LOG_COMPILE) "$$tst" \ - $(AM_TESTS_FD_REDIRECT) .depmod.log: @p='$<'; $(am__check_pre) $(DEPMOD_LOG_DRIVER) --test-name "$$f" \ --log-file '$*.log' --trs-file '$*.trs' \ @@ -1933,19 +1877,6 @@ $(parallel_tests:.ptest=.log): parallel-tests.sh # expected log files from the `.ptest.log' suffix rule. $(parallel_tests): -$(srcdir)/instspc-tests.am: instspc-tests.sh Makefile.am - $(AM_V_GEN)($(am__cd) $(srcdir) \ - && $(SHELL) ./instspc-tests.sh --generate-makefile) >$@ - -# All `*.instspc' tests work by calling the script `instspc-tests.sh'. -# Also, they all use shared data generated by the `instspc-data.test' -# helper test (for reasons of speed). -instspc-data.log: instspc-tests.sh -$(instspc_tests:.instspc=.log): instspc-tests.sh instspc-data.log -# This dummy declaration is required to have make actually produce -# expected log files from the `.instspc.log' suffix rule. -$(instspc_tests): - $(srcdir)/depmod-tests.am: depmod-tests.sh Makefile.am $(AM_V_GEN)($(am__cd) $(srcdir) \ && $(SHELL) ./depmod-tests.sh --generate-makefile) >$@ diff --git a/tests/instspc-data.test b/tests/instspc-data.test deleted file mode 100755 index 7b222ff3a..000000000 --- a/tests/instspc-data.test +++ /dev/null @@ -1,31 +0,0 @@ -#! /bin/sh -# Copyright (C) 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 . - -# Helper testcase which generate input data for the `*.instspc' tests. -# It basically delegates the work to the driver script `instspc-test.sh'. - -# Ensure proper definition of $testsrcdir. -# FIXME: we employ useless quoting below to please maintainer-check. -. ./defs-static || 'exit' 99 - -# Sanity check. -if test x"$testsrcdir" = x; then - echo "$0: \$testsrcdir not set after sourcing of ./defs-static" >&2 - # FIXME: we employ useless quoting below to please maintainer-check. - 'exit' 99 -fi - -exec $SHELL $testsrcdir/instspc-tests.sh --generate-data diff --git a/tests/instspc-tests.sh b/tests/instspc-tests.sh deleted file mode 100755 index 9c6c96863..000000000 --- a/tests/instspc-tests.sh +++ /dev/null @@ -1,343 +0,0 @@ -#! /bin/sh -# Copyright (C) 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 . - -# -# Driver script to run tests checking that building from, or installing -# to, directories with shell metacharacters succeed. -# -# Original report from James Amundson about file names with spaces. -# Other characters added by Paul Eggert. -# -# This script fulfills a threefold role: -# 1. It is called to generate a Makefile.am snippet, containing the -# definition of proper lists of tests. -# 2. It is called to set up a directory containing some common data -# files and autotools-generated files used by the aforementioned -# tests (this is done for speed reasons only). -# 3. It is called to properly run those tests, one at a time. -# - -# Be more Bourne compatible (snippet copied from `tests/defs'). -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac -fi - -set -e - -# We need this early. It will be overridden when we source ./defs below, -# which will offer a more proper implementation. -fatal_ () { echo "$0: $*" >&2; exit 99; } - -case $# in - 0) fatal_ "missing argument";; - 1) ;; - *) fatal_ "too many arguments";; -esac - -case $1 in - --generate-makefile|--generate-data) - instspc_action=`expr x"$1" : x'--\(.*\)'` - ;; - build-*.instspc|*/build-*.instspc) - instspc_action=test-build - instspc_test_name=`expr /"$1" : '.*/build-\(.*\)\.instspc'` - ;; - install-*.instspc|*/install-*.instspc) - instspc_action=test-install - instspc_test_name=`expr /"$1" : '.*/install-\(.*\)\.instspc'` - ;; - *) - fatal_ "invalid argument '$1'" - ;; -esac - -# Helper subroutine for test data definition. -# Usage: define_problematic_string NAME STRING -define_problematic_string () -{ - tst=$1 - shift - eval "instspc__$tst=\$1" \ - || fatal_ "define_problematic_string: bad argument: '$tst'" - shift - instspc_names_list="$instspc_names_list $tst" - # Some of the "problematic" characters cannot be used in the name of - # a build or install directory on a POSIX host. These lists should - # be empty, but are not due to limitations in Autoconf, Automake, Make, - # M4, or the shell. - case " $* " in *' fail-build '*|*' build-fail '*) - instspc_xfail_builds_list="$instspc_xfail_builds_list $tst";; - esac - case " $* " in *' fail-install '*|*' install-fail '*) - instspc_xfail_installs_list="$instspc_xfail_installs_list $tst";; - esac -} - -# Helper subroutines for creation of input data files. - -create_input_data () -{ - mkdir sub - - unindent > configure.in << 'EOF' - AC_INIT([instspc], [1.0]) - AM_INIT_AUTOMAKE - AC_CONFIG_FILES([Makefile]) - AC_PROG_CC - AC_PROG_RANLIB - AC_OUTPUT -EOF - - : > sub/base.h - : > sub/nobase.h - : > sub/base.dat - : > sub/nobase.dat - : > sub/base.sh - : > sub/nobase.sh - - unindent > source.c << 'EOF' - int - main (int argc, char **argv) - { - return 0; - } -EOF - - unindent > Makefile.am << 'EOF' - foodir = $(prefix)/foo - fooexecdir = $(prefix)/foo - - foo_HEADERS = sub/base.h - nobase_foo_HEADERS = sub/nobase.h - - dist_foo_DATA = sub/base.dat - nobase_dist_foo_DATA = sub/nobase.dat - - dist_fooexec_SCRIPTS = sub/base.sh - nobase_dist_fooexec_SCRIPTS = sub/nobase.sh - - fooexec_PROGRAMS = sub/base - nobase_fooexec_PROGRAMS = sub/nobase - sub_base_SOURCES = source.c - sub_nobase_SOURCES = source.c - - fooexec_LIBRARIES = sub/libbase.a - nobase_fooexec_LIBRARIES = sub/libnobase.a - sub_libbase_a_SOURCES = source.c - sub_libnobase_a_SOURCES = source.c - - .PHONY: test-install-sep - test-install-sep: install - test -f '$(DESTDIR)/$(file)-prefix/foo/sub/nobase.h' - test ! -f '$(DESTDIR)/$(file)-prefix/foo/nobase.h' - test -f '$(DESTDIR)/$(file)-prefix/foo/base.h' - test -f '$(DESTDIR)/$(file)-prefix/foo/sub/nobase.dat' - test ! -f '$(DESTDIR)/$(file)-prefix/foo/nobase.dat' - test -f '$(DESTDIR)/$(file)-prefix/foo/base.dat' - test -f '$(DESTDIR)/$(file)-prefix/foo/sub/nobase.sh' - test ! -f '$(DESTDIR)/$(file)-prefix/foo/nobase.sh' - test -f '$(DESTDIR)/$(file)-prefix/foo/base.sh' - test -f '$(DESTDIR)/$(file)-prefix/foo/sub/nobase$(EXEEXT)' - test ! -f '$(DESTDIR)/$(file)-prefix/foo/nobase$(EXEEXT)' - test -f '$(DESTDIR)/$(file)-prefix/foo/base$(EXEEXT)' - test -f '$(DESTDIR)/$(file)-prefix/foo/sub/libnobase.a' - test ! -f '$(DESTDIR)/$(file)-prefix/foo/libnobase.a' - test -f '$(DESTDIR)/$(file)-prefix/foo/libbase.a' -EOF - - $ACLOCAL - $AUTOCONF - $AUTOMAKE -a - - : > success -} - -# Be sure to avoid interferences from the environment. -instspc_names_list='' -instspc_xfail_builds_list='' -instspc_xfail_installs_list='' - - -# ================= # -# Test data begin # -# ----------------- # - -# Some control characters that are white space. -bs='' # back space -cr=' ' # carriage return -ff=' ' # form feed -ht=' ' # horizontal tab -lf=' -' # line feed (aka newline) - -# Hack to save typing and make code visually clearer. -def=define_problematic_string - -$def squote \' fail-build fail-install -$def dquote '"' fail-build fail-install -$def bquote '`' fail-build fail-install -$def sharp '#' fail-build fail-install -$def dollar '$' fail-build fail-install -$def bang '!' -$def bslash '\' fail-build -$def ampersand '&' fail-build -$def percent '%' -$def leftpar '(' -$def rightpar ')' -$def pipe '|' -$def caret '^' -$def tilde '~' -$def qmark '?' -$def star '*' -$def plus '+' -$def minus '-' -$def comma ',' -$def colon ':' -$def semicol ';' -$def equal '=' -$def less '<' -$def more '>' -$def at '@' -$def lqbrack '[' -$def rqbrack ']' -$def lcbrack '{' -$def rcbrack '}' -$def space ' ' -$def tab "$ht" -$def linefeed "$lf" fail-build fail-install -$def backspace "$bs" -$def formfeed "$ff" -$def carriageret "$cr" -$def quadrigraph0 '@&t@' fail-build -$def quadrigraph1 '@<:@' -$def quadrigraph2 '@:>@' -$def quadrigraph3 '@S|@' -$def quadrigraph4 '@%:@' -$def a_b 'a b' -$def a__b 'a b' -$def a_lf_b "a${lf}b" fail-build fail-install -$def dotdotdot '...' -$def dosdrive 'a:' -$def miscglob1 '?[a-z]*' -$def miscglob2 '.*?[0-9]' - -unset def - -# --------------- # -# Test data end # -# =============== # - - -if test x"$instspc_action" = x"generate-makefile"; then - # We must generate a makefile fragment on stdout. It must refer - # to all tests at once, hence the loop below. - echo '## Generated by instspc-tests.sh. DO NOT EDIT!' - echo 'instspc_tests =' - echo 'instspc_xfail_tests =' - for test_name in $instspc_names_list; do - echo "instspc_tests += build-$test_name.instspc" - echo "instspc_tests += install-$test_name.instspc" - done - for test_name in $instspc_xfail_builds_list; do - echo "instspc_xfail_tests += build-$test_name.instspc" - done - for test_name in $instspc_xfail_installs_list; do - echo "instspc_xfail_tests += install-$test_name.instspc" - done - exit 0 -fi - -# We'll need the full setup provided by `tests/defs'. Temporarily disable -# the errexit flag, since the setup code might not be prepared to deal -# with it. Also pre-set `$me' for `tests/defs', so that different calls -# to `instspc-tests.sh' won't try to use the same temporary directory. -# The actual tests require a C compiler, so require it for them; but do -# not require it when generating data, as it's not needed then. -if test x"$instspc_action" = x"generate-data"; then - me=instspc-data -else - required=cc - me=$instspc_action-$instspc_test_name -fi -set +e -. ./defs || Exit 99 -set -e - -# The directory set up by the `generate-data' action should contain all -# the files we need. So remove the other files created by ./defs. And -# check we really are in a temporary `*.dir' directory in the build tree, -# since the last thing we want is to remove some random user files! -test -f ../defs-static && test -f ../defs \ - && case `pwd` in *.dir) :;; *) false;; esac \ - || fatal_ "running from the wrong directory" -rm -f * - -if test x"$instspc_action" = x"generate-data"; then - # We must *not* remove the test directory, since its contents must be - # used by following dependent tests. - keep_testdirs=yes - create_input_data - Exit 0 -fi - -### If we are still here, we have to run a test ... - -eval "instspc_test_string=\${instspc__$instspc_test_name}" \ - && test x"$instspc_test_string" != x \ - || fatal_ "invalid test name: '$instspc_test_name'" - -if test ! -f ../instspc-data.dir/success; then - framework_failure_ "instspc-data.test failure" -fi - -# Skip if this system doesn't support these characters in file names. -mkdir "./$instspc_test_string" || Exit 77 - -case $instspc_action in - test-build) - dest=`pwd`/_dest - relbuilddir=../.. - cd "./$instspc_test_string" - ;; - test-install) - dest=`pwd`/$instspc_test_string - relbuilddir=.. - ;; - *) - fatal_ "invalid action '$instspc_action'" - ;; -esac - -$relbuilddir/instspc-data.dir/configure \ - --prefix "/$instspc_test_string-prefix" -$MAKE -# Some make implementations eliminate leading and trailing whitespace -# from macros passed on the command line, and some eliminate leading -# whitespace from macros set from environment variables, so prepend -# './' and use the latter here. -# Tru64 sh -e needs '|| Exit' in order to work correctly. -DESTDIR="$dest" file="./$instspc_test_string" $MAKE -e test-install-sep \ - || Exit 1 - -: diff --git a/tests/instspc.tap b/tests/instspc.tap new file mode 100755 index 000000000..ed57eb29d --- /dev/null +++ b/tests/instspc.tap @@ -0,0 +1,266 @@ +#! /bin/sh +# Copyright (C) 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 . + +# Check that building from, or installing to, directories with shell +# metacharacters succeed. +# Original report from James Amundson about file names with spaces. +# Other characters added by Paul Eggert. + +. ./defs || Exit 99 + +# Helper subroutine for test data definition. +# Usage: define_problematic_string NAME STRING +define_problematic_string () +{ + tst=$1; shift + eval "instspc__$tst=\$1" \ + || fatal_ "define_problematic_string: bad argument: '$tst'" + shift + instspc_names_list="$instspc_names_list $tst" + # Some of the "problematic" characters cannot be used in the name of + # a build or install directory on a POSIX host. These lists should + # be empty, but are not due to limitations in Autoconf, Automake, Make, + # M4, or the shell. + case " $* " in *' fail-build '*|*' build-fail '*) + instspc_xfail_builds_list="$instspc_xfail_builds_list $tst";; + esac + case " $* " in *' fail-install '*|*' install-fail '*) + instspc_xfail_installs_list="$instspc_xfail_installs_list $tst";; + esac +} + +# Be sure to avoid interferences from the environment. +instspc_names_list='' +instspc_xfail_builds_list='' +instspc_xfail_installs_list='' + +expected_to_fail () +{ + case $1 in + build) + case " $instspc_xfail_builds_list " in + *" $2 "*) return 0 ;; + *) return 1 ;; + esac;; + dest) + case " $instspc_xfail_installs_list " in + *" $2 "*) return 0 ;; + *) return 1 ;; + esac;; + esac + fatal_ "incorrect 'expected_to_fail' usage" +} + +# Helper subroutines for creation of input data files. +create_input_data () +{ + mkdir sub + + unindent >> configure.in << 'EOF' + AC_PROG_CC + AC_PROG_RANLIB + AC_OUTPUT +EOF + + : > sub/base.h + : > sub/nobase.h + : > sub/base.dat + : > sub/nobase.dat + : > sub/base.sh + : > sub/nobase.sh + + unindent > source.c << 'EOF' + int + main (int argc, char **argv) + { + return 0; + } +EOF + + unindent > Makefile.am << 'EOF' + foodir = $(prefix)/foo + fooexecdir = $(prefix)/foo + + foo_HEADERS = sub/base.h + nobase_foo_HEADERS = sub/nobase.h + + dist_foo_DATA = sub/base.dat + nobase_dist_foo_DATA = sub/nobase.dat + + dist_fooexec_SCRIPTS = sub/base.sh + nobase_dist_fooexec_SCRIPTS = sub/nobase.sh + + fooexec_PROGRAMS = sub/base + nobase_fooexec_PROGRAMS = sub/nobase + sub_base_SOURCES = source.c + sub_nobase_SOURCES = source.c + + fooexec_LIBRARIES = sub/libbase.a + nobase_fooexec_LIBRARIES = sub/libnobase.a + sub_libbase_a_SOURCES = source.c + sub_libnobase_a_SOURCES = source.c + + .PHONY: test-inst + test-inst: install + test -f '$(DESTDIR)/$(file)-prefix/foo/sub/nobase.h' + test ! -f '$(DESTDIR)/$(file)-prefix/foo/nobase.h' + test -f '$(DESTDIR)/$(file)-prefix/foo/base.h' + test -f '$(DESTDIR)/$(file)-prefix/foo/sub/nobase.dat' + test ! -f '$(DESTDIR)/$(file)-prefix/foo/nobase.dat' + test -f '$(DESTDIR)/$(file)-prefix/foo/base.dat' + test -f '$(DESTDIR)/$(file)-prefix/foo/sub/nobase.sh' + test ! -f '$(DESTDIR)/$(file)-prefix/foo/nobase.sh' + test -f '$(DESTDIR)/$(file)-prefix/foo/base.sh' + test -f '$(DESTDIR)/$(file)-prefix/foo/sub/nobase$(EXEEXT)' + test ! -f '$(DESTDIR)/$(file)-prefix/foo/nobase$(EXEEXT)' + test -f '$(DESTDIR)/$(file)-prefix/foo/base$(EXEEXT)' + test -f '$(DESTDIR)/$(file)-prefix/foo/sub/libnobase.a' + test ! -f '$(DESTDIR)/$(file)-prefix/foo/libnobase.a' + test -f '$(DESTDIR)/$(file)-prefix/foo/libbase.a' +EOF + + $ACLOCAL + $AUTOCONF + $AUTOMAKE -a +} + +# ================= # +# Test data begin # +# ----------------- # + +# Some control characters that are white space. +bs='' # back space +cr=' ' # carriage return +ff=' ' # form feed +ht=' ' # horizontal tab +lf=' +' # line feed (aka newline) + +# Hack to save typing and make code visually clearer. +def=define_problematic_string + +$def squote \' fail-build fail-install +$def dquote '"' fail-build fail-install +$def bquote '`' fail-build fail-install +$def sharp '#' fail-build fail-install +$def dollar '$' fail-build fail-install +$def bang '!' +$def bslash '\' fail-build +$def ampersand '&' fail-build +$def percent '%' +$def leftpar '(' +$def rightpar ')' +$def pipe '|' +$def caret '^' +$def tilde '~' +$def qmark '?' +$def star '*' +$def plus '+' +$def minus '-' +$def comma ',' +$def colon ':' +$def semicol ';' +$def equal '=' +$def less '<' +$def more '>' +$def at '@' +$def lqbrack '[' +$def rqbrack ']' +$def lcbrack '{' +$def rcbrack '}' +$def space ' ' +$def tab "$ht" +$def linefeed "$lf" fail-build fail-install +$def backspace "$bs" +$def formfeed "$ff" +$def carriageret "$cr" +$def quadrigraph0 '@&t@' fail-build +$def quadrigraph1 '@<:@' +$def quadrigraph2 '@:>@' +$def quadrigraph3 '@S|@' +$def quadrigraph4 '@%:@' +$def a_b 'a b' +$def a__b 'a b' +$def a_lf_b "a${lf}b" fail-build fail-install +$def dotdotdot '...' +$def dosdrive 'a:' +$def miscglob1 '?[a-z]*' +$def miscglob2 '.*?[0-9]' + +unset def + +# --------------- # +# Test data end # +# =============== # + +ocwd=`pwd` || fatal_ "cannot get current working directory" + +create_input_data + +for test_name in $instspc_names_list; do + + eval "instspc_test_string=\${instspc__$test_name}" \ + && test x"$instspc_test_string" != x \ + || fatal_ "invalid test name: '$test_name'" + + # Skip the next checks if this system doesn't support the required + # characters in file names. + + mkdir "./$instspc_test_string" || \ + skip_row_ 2 -r "mkdir failed" "$test_name" + + for where in build dest; do + + case $where in + build) + build=./$instspc_test_string + dest=$ocwd/dest-$test_name + ;; + dest) + build=build-$test_name + dest=$ocwd/$instspc_test_string + mkdir "$build" || fatal_ "cannot create '$build'" + ;; + *) + fatal_ "invalid where '$where'" + ;; + esac + + cd "$build" || fatal_ "cannot chdir into '$build'" + + # Some make implementations eliminate leading and trailing whitespace + # from macros passed on the command line, and some eliminate leading + # whitespace from macros set from environment variables, so prepend + # './' and use the latter here. + r=ok + ../configure --prefix "/$instspc_test_string-prefix" \ + && $MAKE all \ + && DESTDIR="$dest" file="./$instspc_test_string" $MAKE -e test-inst \ + || r='not ok' + + tap_text="$test_name in ${where}dir" + if expected_to_fail "$where" "$test_name"; then + tap_text="$tap_text # TODO long-standing limitation" + fi + result_ "$r" "$tap_text" + + cd "$ocwd" || fatal_ "cannot chdir back to test directory" + + done # $instspc_action + +done # $test_name + +: -- cgit v1.2.1