#! /bin/sh
-# Copyright (C) 2011-2012 Free Software Foundation, Inc.
+# Copyright (C) 2011-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
# Sanity check for the automake testsuite.
# Check that, in case of failing commands, the correct exit status is
-# passed to the exit trap installed by the './defs' script.
+# passed to the exit trap installed by the 'test-init.sh' script.
# Also check that the 'errexit' shell flag is active.
am_create_testdir=no
-. ./defs || exit 99
+. test-init.sh
-plan_ 34
+plan_ 32
# This test becomes more cumbersome if we keep the 'errexit' shell flag
# set. And removing it is no big deal, as this test is a TAP-based one,
# so that false positives remain very unlikely.
set +e
-AM_TESTS_REEXEC=no; export AM_TESTS_REEXEC
-
# It's especially important that the 'unset' is done before sourcing
-# ./defs, i.e., when 'set -e' is not active yet, for the benefit of shells
-# (like Bash 2.05 and Solaris 10 /bin/ksh) that returns a non-zero status
-# when unsetting an already-unset variable.
-# Add an extra newline at the end so that the aliases defined by 'defs'
-# can take effect. Yes, this is truly required.
-init="stderr_fileno_=2; unset am_explicit_skips; . ./defs${nl}"
+# test-init.sh, i.e., when 'set -e' is not active yet, for the benefit
+# of shells (like Bash 2.05 and Solaris 10 /bin/ksh) that returns a
+# non-zero status when unsetting an already-unset variable.
+# Add an extra newline at the end so that the aliases defined by
+# test-init.sh can take effect. Yes, this is truly required.
+init="stderr_fileno_=2; unset am_explicit_skips;. test-init.sh${nl}"
-# Required so that the code in defs doesn't go crazy trying to creating a
+# Required so that the code in test-init.sh doesn't go crazy trying to creating a
# temporary directory in the absolute dir of $AM_TEST_RUNNER_SHELL.
dummy_test_script=t/$me.sh
done
: Non-existent program.
-# Solaris 10 /bin/sh erroneously exit with success right away when the
-# following three conditions are met at the same time:
-# 1. the 'errexit' flag is active,
-# 2. an exit trap is installed, and
-# 3. a non-existing command is issued.
-# Note that the non-existent command is issued as the last command to
-# the shell in the next line; this is deliberate.
-# FIXME: remove this workaround once we have a better configure-time
-# determination of '$AM_TEST_RUNNER_SHELL'.
-if $AM_TEST_RUNNER_SHELL -c 'set -e; trap "exit \$?" 0; non-existent-program'; then
- maybe_todo=TODO reason="known Solaris /bin/sh bug"
-else
- maybe_todo="" reason=""
-fi
$AM_TEST_RUNNER_SHELL -c "$init non-existent-prog; :" "$dummy_test_script"
-command_ok_ "command not found" -D "$maybe_todo" -r "$reason" \
- -- test $? -gt 0
+command_ok_ "command not found" -- test $? -gt 0
: Non-executable command.
test -f Makefile && test ! -x Makefile || \
$AM_TEST_RUNNER_SHELL -c "$init ./Makefile; :" "$dummy_test_script"
command_ok_ "permission denied" test $? -gt 0
-: Syntax errors in the test code.
-$AM_TEST_RUNNER_SHELL -c "$init if :; then" "$dummy_test_script"
-command_ok_ "syntax error 1" test $? -gt 0
-$AM_TEST_RUNNER_SHELL -c "$init true ( true )" "$dummy_test_script"
-command_ok_ "syntax error 2" test $? -gt 0
-
: