diff options
Diffstat (limited to 't/ax')
-rw-r--r-- | t/ax/am-test-lib.sh | 2 | ||||
-rw-r--r-- | t/ax/cc-no-c-o.in | 29 | ||||
-rw-r--r-- | t/ax/depcomp.sh | 10 | ||||
-rw-r--r-- | t/ax/runtest.in | 130 | ||||
-rw-r--r-- | t/ax/tap-setup.sh | 2 | ||||
-rw-r--r-- | t/ax/test-defs.in | 16 |
6 files changed, 180 insertions, 9 deletions
diff --git a/t/ax/am-test-lib.sh b/t/ax/am-test-lib.sh index 5804372ea..f35ccd5de 100644 --- a/t/ax/am-test-lib.sh +++ b/t/ax/am-test-lib.sh @@ -823,7 +823,7 @@ am_setup_testdir () || framework_failure_ "cannot chdir into test subdirectory" if test x"$am_create_testdir" != x"empty"; then cp "$am_scriptdir"/install-sh "$am_scriptdir"/missing \ - "$am_scriptdir"/depcomp . \ + "$am_scriptdir"/compile "$am_scriptdir"/depcomp . \ || framework_failure_ "fetching common files from $am_scriptdir" # Build appropriate environment in test directory. E.g., create # configure.ac, touch all necessary files, etc. Don't use AC_OUTPUT, diff --git a/t/ax/cc-no-c-o.in b/t/ax/cc-no-c-o.in new file mode 100644 index 000000000..c18f9b975 --- /dev/null +++ b/t/ax/cc-no-c-o.in @@ -0,0 +1,29 @@ +#! @AM_TEST_RUNNER_SHELL@ +# Copyright (C) 2012-2013 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/>. + +# A "C compiler" that chokes when the '-c' and '-o' options are passed +# together to it on the command line. See also automake bug#13378. + +am_CC=${AM_TESTSUITE_GNU_CC-'@GNU_CC@'} + +case " $* " in + *\ -c*\ -o* | *\ -o*\ -c*) + echo "$0: both '-o' and '-c' seen on the command line" >&2 + exit 2 + ;; +esac + +exec $am_CC "$@" diff --git a/t/ax/depcomp.sh b/t/ax/depcomp.sh index cdeaae5d6..1534d5f8e 100644 --- a/t/ax/depcomp.sh +++ b/t/ax/depcomp.sh @@ -130,9 +130,8 @@ check_distclean () cat > configure.ac <<END AC_INIT([$me], [1.0]) AC_CONFIG_AUX_DIR([build-aux]) -AM_INIT_AUTOMAKE +AM_INIT_AUTOMAKE([subdir-objects]) AC_PROG_CC -AM_PROG_CC_C_O AM_PROG_AR $(if test $depcomp_with_libtool = yes; then echo AC_PROG_LIBTOOL @@ -200,18 +199,17 @@ ${normalized_target}_${LINKADD} = src/libbaz.$a grep-test: ## For debugging. cat \$(DEPDIR)/foo.$po || : - cat \$(DEPDIR)/subfoo.$po || : + cat sub/\$(DEPDIR)/subfoo.$po || : cat src/\$(DEPDIR)/baz.$po || : cat src/sub2/\$(DEPDIR)/sub2foo.$po || : -## Checks done here. +## Checks are done here. grep '^foo.$objext.*:' \$(DEPDIR)/foo.$po - grep '^subfoo\.$objext.*:' \$(DEPDIR)/subfoo.$po + grep '^sub/subfoo\.$objext.*:' sub/\$(DEPDIR)/subfoo.$po grep '^baz\.$objext.*:' src/\$(DEPDIR)/baz.$po grep '^sub2/sub2foo\.$objext.*:' src/sub2/\$(DEPDIR)/sub2foo.$po END cat > src/Makefile.am <<END -AUTOMAKE_OPTIONS = subdir-objects noinst_${LIBPRIMARY} = libbaz.$a # We include sub2foo only to be sure that the munging in depcomp # doesn't remove too much from the object file name. diff --git a/t/ax/runtest.in b/t/ax/runtest.in new file mode 100644 index 000000000..57ce889c1 --- /dev/null +++ b/t/ax/runtest.in @@ -0,0 +1,130 @@ +#!@AM_TEST_RUNNER_SHELL@ +# @configure_input@ +# +# Copyright (C) 2012-2013 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/>. + +# Run an Automake test from the command line. + +set -e; set -u + +: ${AM_TEST_RUNNER_SHELL='@AM_TEST_RUNNER_SHELL@'} +: ${AM_PROVE_CMD='prove'} +: ${AM_PROVEFLAGS='--merge --verbose'} +: ${srcdir='@srcdir@'} +: ${abs_srcdir='@abs_srcdir@'} +: ${abs_builddir='@abs_builddir@'} +: ${PATH_SEPARATOR='@PATH_SEPARATOR@'} + +# For sourcing of extra "shell libraries" by our test scripts. As per +# POSIX, sourcing a file with '.' will cause it to be looked up in $PATH +# in case it is given with a relative name containing no slashes. +if test "$srcdir" != .; then + PATH=$abs_srcdir/t/ax$PATH_SEPARATOR$PATH +fi +PATH=$abs_builddir/t/ax$PATH_SEPARATOR$PATH +export PATH + +# For use by the testsuite framework. The Automake test harness +# define this, so we better do the same. +export srcdir + +# Some testsuite-influential variables should be overridable from the +# test scripts, but not from the environment. +# Keep this in sync with the 'Makefile.am:AM_TESTS_ENVIRONMENT'. +for v in \ + required \ + am_test_protocol \ + am_serial_tests \ + am_test_prefer_config_shell \ + am_original_AUTOMAKE \ + am_original_ACLOCAL \ + am_test_lib_sourced \ + test_lib_sourced \ +; do + eval "$v= && unset $v" || exit 1 +done +unset v + +xecho () { printf '%s\n' "$*"; } +error () { echo "$0: $*" >&2; exit 255; } + +# Some shell flags should be passed over to the test scripts. +shell_opts= +while test $# -gt 0; do + case $1 in + --help) + xecho "Usage: $0 [--shell=PATH] [-k] [SHELL-OPTIONS]" \ + "[VAR=VALUE ...] TEST [TEST-OPTIONS]" + exit $? + ;; + --shell) + test $# -gt 1 || error "missing argument for option '$1'" + AM_TEST_RUNNER_SHELL=$2 + shift + ;; + --shell=*) + AM_TEST_RUNNER_SHELL=${1#--shell=} + ;; + -o) + test $# -gt 1 || error "missing argument for option '$1'" + shell_opts="$shell_opts -o $2" + shift + ;; + -k|--keep-testdir|--keep-testdirs) + keep_testdirs=yes; export keep_testdirs;; + -*) + # Assume it is an option to pass through to the shell. + shell_opts="$shell_opts $1";; + *=*) + var=${1%%=*} val=${1#*=} + xecho "$var" | LC_ALL=C grep '^[a-zA-Z_][a-zA-Z0-9_]*$' >/dev/null \ + || error "'$var': invalid variable name" + eval "$var=\$val && export $var" || exit 1 + ;; + *) + break;; + esac + shift +done + +test $# -gt 0 || error "missing argument" + +tst=$1; shift + +case $tst in + /*) ;; + *) if test -f ./$tst; then + tst=./$tst + # Support for VPATH build. + elif test -f $srcdir/$tst; then + tst=$srcdir/$tst + else + error "could not find test '$tst'" + fi + ;; +esac + +case $tst in + *.sh) + exec $AM_TEST_RUNNER_SHELL $shell_opts "$tst" ${1+"$@"} ;; + *.tap) + exec "$AM_PROVE_CMD" $AM_PROVEFLAGS -e \ + "$AM_TEST_RUNNER_SHELL $shell_opts" "$tst" ${1+"$@"} ;; + *) + error "test '$tst' has an unrecognized extension" ;; +esac + +error "dead code reached" diff --git a/t/ax/tap-setup.sh b/t/ax/tap-setup.sh index 6955c86a0..3c992a388 100644 --- a/t/ax/tap-setup.sh +++ b/t/ax/tap-setup.sh @@ -22,7 +22,7 @@ # Check that we are running from a proper directory: last thing we want # is to overwrite some random user files. -test -f ../../automake && test -f ../../runtest && test -d ../../t \ +test -f ../../bin/automake && test -f ../../runtest && test -d ../../t \ || fatal_ "running from a wrong directory" test ! -f Makefile.am || mv Makefile.am Makefile.am~ \ diff --git a/t/ax/test-defs.in b/t/ax/test-defs.in index fd814791b..c716cab97 100644 --- a/t/ax/test-defs.in +++ b/t/ax/test-defs.in @@ -76,6 +76,11 @@ PATH_SEPARATOR='@PATH_SEPARATOR@' host_alias=${host_alias-'@host_alias@'}; export host_alias build_alias=${build_alias-'@build_alias@'}; export build_alias +# Whether the testsuite is being run by faking the presence of a C +# compiler that doesn't grasp the '-c' and '-o' flags together. By +# default, of course, it isn't. +: "${AM_TESTSUITE_SIMULATING_NO_CC_C_O:=no}" + # A concurrency-safe "mkdir -p" implementation. MKDIR_P=${AM_TESTSUITE_MKDIR_P-'@MKDIR_P@'} @@ -136,7 +141,11 @@ FGREP=${AM_TESTSUITE_FGREP-'@FGREP@'} # Compilers and their flags. These can point to non-GNU compilers (and # on non-Linux and non-BSD systems, they probably will). -CC=${AM_TESTSUITE_CC-${CC-'@CC@'}} +if test $AM_TESTSUITE_SIMULATING_NO_CC_C_O = no; then + CC=${AM_TESTSUITE_CC-${CC-'@CC@'}} +else + CC=$am_testaux_builddir/cc-no-c-o +fi CXX=${AM_TESTSUITE_CXX-${CXX-'@CXX@'}} F77=${AM_TESTSUITE_F77-${F77-'@F77@'}} FC=${AM_TESTSUITE_FC-${FC-'@FC@'}} @@ -147,6 +156,11 @@ FFLAGS=${AM_TESTSUITE_FFLAGS-${FFLAGS-'@FFLAGS@'}} CPPFLAGS=${AM_TESTSUITE_CPPFLAGS-${CPPFLAGS-'@CPPFLAGS@'}} # GNU compilers and their flags. +if test $AM_TESTSUITE_SIMULATING_NO_CC_C_O = no; then + GNU_CC=${AM_TESTSUITE_GNU_CC-${GNU_CC-'@GNU_CC@'}} +else + GNU_CC=$am_testaux_builddir/cc-no-c-o +fi GNU_CC=${AM_TESTSUITE_GNU_CC-${GNU_CC-'@GNU_CC@'}} GNU_CXX=${AM_TESTSUITE_GNU_CXX-${GNU_CXX-'@GNU_CXX@'}} GNU_F77=${AM_TESTSUITE_GNU_F77-${GNU_F77-'@GNU_F77@'}} |