3 # Copyright (C) 1996-2012 Free Software Foundation, Inc.
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2, or (at your option)
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 ########################################################
19 ### IMPORTANT NOTE: keep this file 'set -e' clean. ###
20 ########################################################
22 # Enable the errexit shell flag early.
25 # The name of the current test (without the '.sh' or '.tap' suffix).
26 # Test scripts can override it if they need to (but this should
28 if test -z "$me"; then
29 # Strip all directory components.
33 *.tap) me=${me%.tap};;
39 ## --------------------- ##
40 ## Early sanity checks. ##
41 ## --------------------- ##
43 # Ensure $am_top_srcdir is set correctly.
44 test -f "$am_top_srcdir/defs-static.in" || {
45 echo "$me: $am_top_srcdir/defs-static.in not found," \
46 "check \$am_top_srcdir" >&2
50 # Ensure $am_top_builddir is set correctly.
51 test -f "$am_top_builddir/defs-static" || {
52 echo "$me: $am_top_builddir/defs-static not found," \
53 "check \$am_top_builddir" >&2
58 ## ------------------ ##
59 ## Early variables. ##
60 ## ------------------ ##
62 # A single whitespace character.
64 # A tabulation character.
66 # A newline character.
69 # A literal escape character. Used by test checking colored output.
72 # As autoconf-generated configure scripts do, ensure that IFS
73 # is defined initially, so that saving and restoring $IFS works.
77 ## ----------------------- ##
78 ## Early debugging info. ##
79 ## ----------------------- ##
81 echo "Running from installcheck: $am_running_installcheck"
82 echo "Using TAP: $am_using_tap"
86 ## ---------------------- ##
87 ## Environment cleanup. ##
88 ## ---------------------- ##
90 # Temporarily disable this, since some shells (e.g., older version
91 # of Bash) can return a non-zero exit status upon the when a non-set
95 # Unset some make-related variables that may cause $MAKE to act like
96 # a recursively invoked sub-make. Any $MAKE invocation in a test is
97 # conceptually an independent invocation, not part of the main
99 unset MFLAGS MAKEFLAGS AM_MAKEFLAGS MAKELEVEL
100 unset __MKLVL__ MAKE_JOBS_FIFO # For BSD make.
101 unset DMAKE_CHILD DMAKE_DEF_PRINTED DMAKE_MAX_JOBS # For Solaris dmake.
102 # Unset verbosity flag.
104 # Also unset variables that will let "make -e install" divert
105 # files into unwanted directories.
107 unset prefix exec_prefix bindir datarootdir datadir docdir dvidir
108 unset htmldir includedir infodir libdir libexecdir localedir mandir
109 unset oldincludedir pdfdir psdir sbindir sharedstatedir sysconfdir
110 # Unset variables that might change the "make distcheck" behaviour.
111 unset DISTCHECK_CONFIGURE_FLAGS AM_DISTCHECK_CONFIGURE_FLAGS
112 # Used by install rules for info files.
113 unset AM_UPDATE_INFO_DIR
114 # The tests call "make -e" but we do not want $srcdir from the environment
115 # to override the definition from the Makefile.
117 # Also unset variables that control our test driver. While not
118 # conceptually independent, they cause some changed semantics we
119 # need to control (and test for) in some of the tests to ensure
120 # backward-compatible behavior.
121 unset TESTS_ENVIRONMENT AM_TESTS_ENVIRONMENT
122 unset DISABLE_HARD_ERRORS
130 for pfx in TEST_ SH_ TAP_ ''; do
131 unset ${pfx}LOG_COMPILER
132 unset ${pfx}LOG_COMPILE # Not a typo!
133 unset ${pfx}LOG_FLAGS
134 unset AM_${pfx}LOG_FLAGS
135 unset ${pfx}LOG_DRIVER
136 unset ${pfx}LOG_DRIVER_FLAGS
137 unset AM_${pfx}LOG_DRIVER_FLAGS
141 # Re-enable, it had been temporarily disabled above.
144 ## ---------------------------- ##
145 ## Auxiliary shell functions. ##
146 ## ---------------------------- ##
148 # Tell whether we should keep the test directories around, even in
149 # case of success. By default, we don't.
150 am_keeping_testdirs ()
152 case $keep_testdirs in
153 ""|n|no|NO) return 1;;
158 # This is used in 'Exit' and in the exit trap. See comments in the latter
159 # for more information,
162 # We use a trap below for cleanup. This requires us to go through
163 # hoops to get the right exit status transported through the signal.
164 # So use "Exit STATUS" instead of "exit STATUS" inside of the tests.
165 # Turn off errexit here so that we don't trip the bug with OSF1/Tru64
166 # sh inside this function.
170 # See comments in the exit trap for the reason we do this.
171 test 77 = $1 && am__test_skipped=yes
175 if test $am_using_tap = yes; then
176 am_funcs_file=tap-functions.sh
178 am_funcs_file=plain-functions.sh
181 if test -f "$am_testauxdir/$am_funcs_file"; then
182 . "$am_testauxdir/$am_funcs_file" || {
183 echo "$me: error sourcing $am_testauxdir/$am_funcs_file" >&2
187 echo "$me: $am_testauxdir/$am_funcs_file not found" >&2
194 # Tell whether we are cross-compiling. This is especially useful to skip
195 # tests (or portions of them) that requires a native compiler.
198 # Quoting from the autoconf manual:
199 # ... [$host_alias and $build both] default to the result of running
200 # config.guess, unless you specify either --build or --host. In
201 # this case, the default becomes the system type you specified.
202 # If you specify both, *and they're different*, configure enters
203 # cross compilation mode (so it doesn't run any tests that require
205 test x"$host_alias" != x && test x"$build_alias" != x"$host_alias"
208 # is_blocked_signal SIGNAL-NUMBER
209 # --------------------------------
210 # Return success if the given signal number is blocked in the shell,
211 # return a non-zero exit status and print a proper diagnostic otherwise.
214 # Use perl, since trying to do this portably in the shell can be
215 # very tricky, if not downright impossible. For reference, see:
216 # <http://lists.gnu.org/archive/html/bug-autoconf/2011-09/msg00004.html>
219 use warnings FATAL => "all";
221 my %oldsigaction = ();
222 sigaction('"$1"', 0, \%oldsigaction);
223 exit ($oldsigaction{"HANDLER"} eq "IGNORE" ? 0 : 77);
226 elif test $? -eq 77; then
229 fatal_ "couldn't determine whether signal $1 is blocked"
233 # AUTOMAKE_run [-e STATUS] [-d DESCRIPTION] [--] [AUTOMAKE-ARGS...]
234 # -----------------------------------------------------------------
235 # Run automake with AUTOMAKE-ARGS, and fail if it doesn't exit with
236 # STATUS. Should be polymorphic for TAP and "plain" tests. The
237 # DESCRIPTION, when provided, is used for console reporting, only if
238 # the TAP protocol is in use in the current test script.
243 while test $# -gt 0; do
245 -d) am__desc=$2; shift;;
246 -e) am__exp_rc=$2; shift;;
248 # Don't fail on unknown option: assume they (and the rest of the
249 # command line) are to be passed verbatim to automake (so stop our
250 # own option parsing).
256 $AUTOMAKE ${1+"$@"} >stdout 2>stderr || am__got_rc=$?
259 if test $am_using_tap != yes; then
260 test $am__got_rc -eq $am__exp_rc || Exit 1
263 if test -z "$am__desc"; then
264 if test $am__got_rc -eq $am__exp_rc; then
265 am__desc="automake exited $am__got_rc"
267 am__desc="automake exited $am__got_rc, expecting $am__exp_rc"
270 command_ok_ "$am__desc" test $am__got_rc -eq $am__exp_rc
273 # AUTOMAKE_fails [-d DESCRIPTION] [OPTIONS...]
274 # --------------------------------------------
275 # Run automake with OPTIONS, and fail if doesn't exit with status 1.
276 # Should be polymorphic for TAP and "plain" tests. The DESCRIPTION,
277 # when provided, is used for console reporting, only if the TAP
278 # protocol is in use in the current test script.
281 AUTOMAKE_run -e 1 ${1+"$@"}
284 # extract_configure_help { --OPTION | VARIABLE-NAME } [FILES]
285 # -----------------------------------------------------------
286 # Use this to extract from the output of "./configure --help" (or similar)
287 # the description or help message associated to the given --OPTION or
289 extract_configure_help ()
291 am__opt_re='' am__var_re=''
293 --*'=') am__opt_re="^ $1";;
294 --*'[=]') am__opt_re='^ '$(printf '%s\n' "$1" | sed 's/...$//')'\[=';;
295 --*) am__opt_re="^ $1( .*|$)";;
296 *) am__var_re="^ $1( .*|$)";;
299 if test x"$am__opt_re" != x; then
301 /'"$am__opt_re"'/ { print; do_print = 1; next; }
302 /^$/ { do_print = 0; next }
303 /^ --/ { do_print = 0; next }
304 (do_print == 1) { print }
308 /'"$am__var_re"'/ { print; do_print = 1; next; }
309 /^$/ { do_print = 0; next }
310 /^ [A-Z][A-Z0-9_]* / { do_print = 0; next }
311 /^ [A-Z][A-Z0-9_]*$/ { do_print = 0; next }
312 (do_print == 1) { print }
317 # grep_configure_help { --OPTION | VARIABLE-NAME } REGEXP
318 # -------------------------------------------------------
319 # Grep the section of "./configure --help" output associated with either
320 # --OPTION or VARIABLE-NAME for the given *extended* regular expression.
321 grep_configure_help ()
323 ./configure --help > am--all-help \
324 || { cat am--all-help; Exit 1; }
326 extract_configure_help "$1" am--all-help > am--our-help \
327 || { cat am--our-help; Exit 1; }
329 $EGREP "$2" am--our-help || Exit 1
334 # Return success if $MAKE is GNU make, return failure otherwise.
335 # Caches the result for speed reasons.
338 case $am__using_gmake in
344 # Use --version AND -v, because SGI Make doesn't fail on --version.
345 # Also grep for GNU because newer versions of FreeBSD make do
346 # not complain about --version (they seem to silently ignore it).
347 if $MAKE --version -v | grep GNU; then
355 fatal_ "invalid value for \$am__using_gmake: '$am__using_gmake'";;
358 am__using_gmake="" # Avoid interferences from the environment.
360 # make_can_chain_suffix_rules
361 # ---------------------------
362 # Return 0 if $MAKE is a make implementation that can chain suffix rules
363 # automatically, return 1 otherwise. Caches the result for speed reasons.
364 make_can_chain_suffix_rules ()
366 if test -z "$am__can_chain_suffix_rules"; then
368 am__can_chain_suffix_rules=yes
371 mkdir am__chain.dir$$
373 unindent > Makefile << 'END'
378 echo make can chain suffix rules > foo.u
379 if $MAKE foo.w && diff foo.u foo.w; then
380 am__can_chain_suffix_rules=yes
382 am__can_chain_suffix_rules=no
385 rm -rf am__chain.dir$$
388 case $am__can_chain_suffix_rules in
391 *) fatal_ "make_can_chain_suffix_rules: internal error";;
394 am__can_chain_suffix_rules="" # Avoid interferences from the environment.
396 # useless_vpath_rebuild
397 # ---------------------
398 # Tell whether $MAKE suffers of the bug triggering automake bug#7884.
399 # For example, this happens with FreeBSD make, since in a VPATH build
400 # it tends to rebuilt files for which there is an explicit or even just
401 # a suffix rule, even if said files are already available in the VPATH
403 useless_vpath_rebuild ()
405 if test -z "$am__useless_vpath_rebuild"; then
407 am__useless_vpath_rebuild=no
410 mkdir am__vpath.dir$$
412 touch foo.a foo.b bar baz
415 unindent > Makefile << 'END'
421 baz: bar ; cp ../baz bar
423 if $MAKE all && test ! -f foo.b && test ! -f bar; then
424 am__useless_vpath_rebuild=no
426 am__useless_vpath_rebuild=yes
429 rm -rf am__vpath.dir$$
431 case $am__useless_vpath_rebuild in
435 *) fatal_ "no_useless_builddir_remake: internal error";;
438 am__useless_vpath_rebuild=""
440 yl_distcheck () { useless_vpath_rebuild || $MAKE distcheck ${1+"$@"}; }
442 # seq_ - print a sequence of numbers
443 # ----------------------------------
444 # This function simulates GNU seq(1) portably. Valid usages:
447 # - seq FIRST INCREMENT LAST
451 0) fatal_ "seq_: missing argument";;
452 1) seq_first=1 seq_incr=1 seq_last=$1;;
453 2) seq_first=$1 seq_incr=1 seq_last=$2;;
454 3) seq_first=$1 seq_incr=$2 seq_last=$3;;
455 *) fatal_ "seq_: too many arguments";;
458 while test $i -le $seq_last; do
460 i=$(($i + $seq_incr))
464 # rm_rf_ [FILES OR DIRECTORIES ...]
465 # ---------------------------------
466 # Recursively remove the given files or directory, also handling the case
467 # of non-writable subdirectories.
470 test $# -gt 0 || return 0
471 # Ignore failures in find, we are only interested in failures of the
473 find "$@" -type d ! -perm -700 -exec chmod u+rwx {} \; || :
477 # count_test_results total=N pass=N fail=N xpass=N xfail=N skip=N error=N
478 # -----------------------------------------------------------------------
479 # Check that a testsuite run driven by the parallel-tests harness has
480 # had the specified numbers of test results (specified by kind).
481 # This function assumes that the output of "make check" or "make recheck"
482 # has been saved in the 'stdout' file in the current directory, and its
483 # log in the 'test-suite.log' file.
484 count_test_results ()
486 # Use a subshell so that we won't pollute the script namespace.
488 # TODO: Do proper checks on the arguments?
489 total=ERR pass=ERR fail=ERR xpass=ERR xfail=ERR skip=ERR error=ERR
492 $EGREP -i '(total|x?pass|x?fail|skip|error)' stdout || :
494 # Avoid spurious failures with shells with "overly sensible"
495 # errexit shell flag, such as e.g., Solaris /bin/sh.
497 test $(grep -c '^PASS:' stdout) -eq $pass || rc=1
498 test $(grep -c '^XFAIL:' stdout) -eq $xfail || rc=1
499 test $(grep -c '^SKIP:' stdout) -eq $skip || rc=1
500 test $(grep -c '^FAIL:' stdout) -eq $fail || rc=1
501 test $(grep -c '^XPASS:' stdout) -eq $xpass || rc=1
502 test $(grep -c '^ERROR:' stdout) -eq $error || rc=1
503 grep "^# TOTAL: *$total$" stdout || rc=1
504 grep "^# PASS: *$pass$" stdout || rc=1
505 grep "^# XFAIL: *$xfail$" stdout || rc=1
506 grep "^# SKIP: *$skip$" stdout || rc=1
507 grep "^# FAIL: *$fail$" stdout || rc=1
508 grep "^# XPASS: *$xpass$" stdout || rc=1
509 grep "^# ERROR: *$error$" stdout || rc=1
514 commented_sed_unindent_prog='
515 /^$/b # Nothing to do for empty lines.
516 x # Get x<indent> into pattern space.
517 /^$/{ # No prior x<indent>, go prepare it.
518 g # Copy this 1st non-blank line into pattern space.
519 s/^\(['"$tab"' ]*\).*/x\1/ # Prepare x<indent> in pattern space.
520 } # Now: x<indent> in pattern and <line> in hold.
521 G # Build x<indent>\n<line> in pattern space, and
522 h # duplicate it into hold space.
523 s/\n.*$// # Restore x<indent> in pattern space, and
524 x # exchange with the above duplicate in hold space.
525 s/^x\(.*\)\n\1// # Remove leading <indent> from <line>.
526 s/^x.*\n// # Restore <line> when there is no leading <indent>.
529 # unindent [input files...]
530 # -------------------------
531 # Remove the "proper" amount of leading whitespace from the given files,
532 # and output the result on stdout. That amount is determined by looking
533 # at the leading whitespace of the first non-blank line in the input
534 # files. If no input file is specified, standard input is implied.
537 if test x"$sed_unindent_prog" = x; then
538 sed_unindent_prog=$(printf '%s\n' "$commented_sed_unindent_prog" \
539 | sed -e "s/ *# .*//")
541 sed "$sed_unindent_prog" ${1+"$@"}
543 sed_unindent_prog="" # Avoid interferences from the environment.
545 # get_shell_script SCRIPT-NAME
546 # -----------------------------
547 # Fetch an Automake-provided shell script from the 'lib/' directory into
548 # the current directory, and, if the '$am_test_prefer_config_shell'
549 # variable is set to "yes", modify its shebang line to use $SHELL instead
553 test ! -f "$1" || rm -f "$1" || return 99
554 if test x"$am_test_prefer_config_shell" = x"yes"; then
555 sed "1s|#!.*|#! $SHELL|" "$am_scriptdir/$1" > "$1" \
559 cp -f "$am_scriptdir/$1" . || return 99
561 sed 10q "$1" # For debugging.
566 # Skip the test if the given shell fails to support common XSI constructs.
569 test $# -eq 1 || fatal_ "require_xsi needs exactly one argument"
570 echo "$me: trying some XSI constructs with $1"
571 $1 -c "$xsi_shell_code" || skip_all_ "$1 lacks XSI features"
573 # Shell code supposed to work only with XSI shells. Keep this in sync
574 # with libtool.m4:_LT_CHECK_SHELL_FEATURES.
577 test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
579 && eval '\''test $(( 1 + 1 )) -eq 2 \
580 && test "${#_lt_dummy}" -eq 5'\'
584 # Fetch the Automake-provided TAP driver from the 'lib/' directory into
585 # the current directory, and edit its shebang line so that it will be
586 # run with the perl interpreter determined at configure time.
589 # TODO: we should devise a way to make the shell TAP driver tested also
590 # TODO: with /bin/sh, for better coverage.
591 case $am_tap_implementation in
593 $PERL -MTAP::Parser -e 1 \
594 || skip_all_ "cannot import TAP::Parser perl module"
595 sed "1s|#!.*|#! $PERL -w|" "$am_scriptdir"/tap-driver.pl >tap-driver
598 AM_TAP_AWK=$AWK; export AM_TAP_AWK
599 sed "1s|#!.*|#! $SHELL|" "$am_scriptdir"/tap-driver.sh >tap-driver
602 fatal_ "invalid \$am_tap_implementation '$am_tap_implementation'" ;;
604 && chmod a+x tap-driver \
605 || framework_failure_ "couldn't fetch $am_tap_implementation TAP driver"
606 sed 10q tap-driver # For debugging.
608 # The shell/awk implementation of the TAP driver is still mostly dummy, so
609 # use the perl implementation by default for the moment.
610 am_tap_implementation=${am_tap_implementation-shell}
612 # Usage: require_compiler_ {cc|c++|fortran|fortran77}
616 0) fatal_ "require_compiler_: missing argument";;
618 *) fatal_ "require_compiler_: too many arguments";;
624 am__comp_flag_vars='CFLAGS CPPFLAGS'
629 am__comp_flag_vars='CXXFLAGS CPPFLAGS'
632 am__comp_lang="Fortran"
634 am__comp_flag_vars='FCFLAGS'
637 am__comp_lang="Fortran 77"
639 am__comp_flag_vars='FFLAGS'
643 eval "am__comp_prog=\${$am__comp_var}" \
644 || fatal_ "expanding \${$am__comp_var} in require_compiler_"
645 case $am__comp_prog in
647 fatal_ "botched configuration: \$$am__comp_var is empty";;
649 skip_all_ "no $am__comp_lang compiler available";;
650 autodetect|autodetected)
651 # Let the ./configure commands in the test script try to determine
652 # these automatically.
653 unset $am__comp_var $am__comp_flag_vars;;
655 # Pre-set these for the ./configure commands in the test script.
656 export $am__comp_var $am__comp_flag_vars;;
658 # Delete private variables.
659 unset am__comp_lang am__comp_prog am__comp_var am__comp_flag_vars
662 ## ----------------------------------------------------------- ##
663 ## Checks for required tools, and additional setups (if any) ##
664 ## required by them. ##
665 ## ----------------------------------------------------------- ##
667 # Performance tests must be enabled explicitly.
670 case $AM_TESTSUITE_PERF in
672 *) skip_ "performance tests not explicitly enabled" ;;
677 # Look for (and maybe set up) required tools and/or system features; skip
678 # the current test if they are not found.
679 for tool in : $required
681 # Check that each required tool is present.
684 cc|c++|fortran|fortran77)
685 require_compiler_ $tool;;
687 if test x"$am_test_prefer_config_shell" = x"yes"; then
690 require_xsi "/bin/sh"
694 # Do not use --version, older versions bzip2 still tries to compress
696 echo "$me: running bzip2 --help"
698 || skip_all_ "required program 'bzip2' not available"
702 # Don't export CFLAGS, as that could have been initialized to only
703 # work with the C compiler detected at configure time. If the user
704 # wants CFLAGS to also influence 'cl', he can still export CFLAGS
705 # in the environment "by hand" before calling the testsuite.
707 echo "$me: running $CC -?"
708 $CC -? || skip_all_ "Microsoft C compiler '$CC' not available"
711 # Exuberant Ctags will create a TAGS file even
712 # when asked for --help or --version. (Emacs's etags
713 # does not have such problem.) Use -o /dev/null
714 # to make sure we do not pollute the build directory.
715 echo "$me: running etags --version -o /dev/null"
716 etags --version -o /dev/null \
717 || skip_all_ "required program 'etags' not available"
720 for make_ in "$MAKE" gmake gnumake :; do
721 MAKE=$make_ am__using_gmake=''
722 test "$MAKE" = : && break
723 echo "$me: determine whether $MAKE is GNU make"
725 : For shells with busted 'set -e'.
727 test "$MAKE" = : && skip_all_ "this test requires GNU make"
732 GCJ=$GNU_GCJ GCJFLAGS=$GNU_GCJFLAGS; export GCJ GCJFLAGS
733 test "$GCJ" = false && skip_all_ "GNU Java compiler unavailable"
734 : For shells with busted 'set -e'.
737 CC=$GNU_CC CFLAGS=$GNU_CFLAGS; export CC CFLAGS CPPFLAGS
738 test "$CC" = false && skip_all_ "GNU C compiler unavailable"
739 : For shells with busted 'set -e'.
742 CXX=$GNU_CXX CXXFLAGS=$GNU_CXXFLAGS; export CXX CXXFLAGS CPPFLAGS
743 test "$CXX" = false && skip_all_ "GNU C++ compiler unavailable"
744 : For shells with busted 'set -e'.
747 FC=$GNU_FC FCFLAGS=$GNU_FCFLAGS; export FC FCFLAGS
748 test "$FC" = false && skip_all_ "GNU Fortran compiler unavailable"
749 case " $required " in
751 *) F77=$FC FFLAGS=$FCFLAGS; export F77 FFLAGS;;
755 F77=$GNU_F77 FFLAGS=$GNU_FFLAGS; export F77 FFLAGS
756 test "$F77" = false && skip_all_ "GNU Fortran 77 compiler unavailable"
757 case " $required " in
759 *) FC=$F77 FCFLAGS=$FFLAGS; export FC FCFLAGS;;
763 # Check that grep can parse nonprinting characters correctly.
764 # BSD 'grep' works from a pipe, but not a seekable file.
765 # GNU or BSD 'grep -a' works on files, but is not portable.
766 case $(echo "$esc" | grep .)$(echo "$esc" | grep "$esc") in
768 *) skip_ "grep can't handle nonprinting characters correctly";;
772 # The Java compiler from JDK 1.5 (and presumably earlier versions)
773 # cannot handle the '-version' option by itself: it bails out
774 # telling that source files are missing. Adding also the '-help'
775 # option seems to solve the problem.
776 echo "$me: running javac -version -help"
777 javac -version -help || skip_all_ "Sun Java compiler not available"
780 # See the comments above about 'javac' for why we use also '-help'.
781 echo "$me: running java -version -help"
782 java -version -help || skip_all_ "Sun Java interpreter not found"
787 # Attempting to create an empty archive will actually not
788 # create the archive, but lib will output its version.
789 echo "$me: running $AR -out:defstest.lib"
790 $AR -out:defstest.lib \
791 || skip_all_ "Microsoft 'lib' utility not available"
794 echo "$me: running makedepend -f-"
796 || skip_all_ "required program 'makedepend' not available"
799 uname_s=$(uname -s || echo UNKNOWN)
800 echo "$me: system name: $uname_s"
803 *) skip_all_ "this test requires MSYS in MinGW mode" ;;
808 # Skip this test case if the user is root.
809 # We try to append to a read-only file to detect this.
810 priv_check_temp=priv-check.$$
811 touch $priv_check_temp && chmod a-w $priv_check_temp \
812 || framework_failure_ "creating unwritable file $priv_check_temp"
813 # Not a useless use of subshell: lesser shells like Solaris /bin/sh
814 # can exit if a builtin fails.
816 (echo foo >> $priv_check_temp) || overwrite_status=$?
817 rm -f $priv_check_temp
818 if test $overwrite_status -eq 0; then
819 skip_all_ "cannot drop file write permissions"
821 unset priv_check_temp overwrite_status
824 if test "$WANT_NO_THREADS" = "yes"; then
825 skip_all_ "Devel::Cover cannot cope with threads"
829 # Don't use "&&" here, to avoid a bug of 'set -e' present in
830 # some (even relatively recent) versions of the BSD shell.
831 # We add the dummy "else" branch for extra safety.
832 ! cross_compiling || skip_all_ "doesn't work in cross-compile mode"
835 # Python doesn't support --version, it has -V
836 echo "$me: running python -V"
837 python -V || skip_all_ "python interpreter not available"
840 # Skip this test case if read-only directories aren't supported
842 ro_dir_temp=ro_dir.$$
843 mkdir $ro_dir_temp && chmod a-w $ro_dir_temp \
844 || framework_failure_ "creating unwritable directory $ro_dir_temp"
845 # Not a useless use of subshell: lesser shells like Solaris /bin/sh
846 # can exit if a builtin fails.
848 (: > $ro_dir_temp/probe) || create_status=$?
850 if test $create_status -eq 0; then
851 skip_all_ "cannot drop directory write permissions"
853 unset ro_dir_temp create_status
856 # DejaGnu's runtest program. We rely on being able to specify
857 # the program on the runtest command-line. This requires
858 # DejaGnu 1.4.3 or later.
859 echo "$me: running runtest SOMEPROGRAM=someprogram --version"
860 runtest SOMEPROGRAM=someprogram --version \
861 || skip_all_ "DejaGnu is not available"
864 # No all versions of Tex support '--version', so we use
866 if test -z "$TEX"; then
867 skip_all_ "TeX is required, but it wasn't found by configure"
871 test x"$LEX" = x"false" && skip_all_ "lex not found or disabled"
875 test x"$YACC" = x"false" && skip_all_ "yacc not found or disabled"
880 echo "$me: running flex --version"
881 flex --version || skip_all_ "required program 'flex' not available"
884 YACC='bison -y'; export YACC
885 echo "$me: running bison --version"
886 bison --version || skip_all_ "required program 'bison' not available"
889 # Generic case: the tool must support --version.
890 echo "$me: running $tool --version"
891 # It is not likely but possible that $tool is a special builtin,
892 # in which case the shell is allowed to exit after an error. So
893 # we need the subshell here. Also, some tools, like Sun cscope,
894 # can be interactive without redirection.
895 ($tool --version) </dev/null \
896 || skip_all_ "required program '$tool' not available"
901 # Using just $am_top_builddir for the check here is ok, since the
902 # further temporary subdirectory where the test will be run is
903 # ensured not to contain any whitespace character.
904 case $am_top_builddir in
906 case " $required " in
907 *' libtool '* | *' libtoolize '* )
908 skip_all_ "libtool has problems with spaces in builddir name";;
913 # This test is necessary, although Automake's configure script bails out
914 # when $srcdir contains spaces. This is because $am_top_srcdir is in not
915 # configure-time $srcdir, but is instead configure-time $abs_srcdir, and
916 # that is allowed to contain spaces.
917 case $am_top_srcdir in
919 case " $required " in
920 *' libtool '* | *' libtoolize '* | *' gettext '* )
921 skip_all_ "spaces in srcdir name: libtool/gettext tests won't work";;
926 # We might need extra macros, e.g., from Libtool or Gettext.
927 case " $required " in *\ libtool*) . ./t/libtool-macros.dir/get.sh;; esac
928 case " $required " in *\ gettext*) . ./t/gettext-macros.dir/get.sh;; esac
931 ## ---------------------------------------------------------------- ##
932 ## Create and set up of the temporary directory used by the test. ##
933 ## Set up of the exit trap for cleanup of said directory. ##
934 ## ---------------------------------------------------------------- ##
936 # This might be used in testcases checking distribution-related features.
937 # Test scripts are free to override this if they need to.
940 # Set up the exit trap.
943 cd "$am_top_builddir"
944 if test $am_using_tap = yes; then
945 if test "$planned_" = later && test $exit_status -eq 0; then
948 test $exit_status -eq 0 && test $tap_pass_count_ -eq $tap_count_ \
951 # This is to ensure that a test script does give a SKIP outcome just
952 # because a command in it happens to exit with status 77. This
953 # behaviour, while from time to time useful to developers, is not
954 # meant to be enabled by default, as it could cause spurious failures
955 # in the wild. Thus it will be enabled only when the variable
956 # "am_explicit_skips" is set to a "true" value.
957 case $am_explicit_skips in
959 if test $exit_status -eq 77 && test $am__test_skipped != yes; then
960 echo "$me: implicit skip turned into failure"
964 test $exit_status -eq 0 || keep_testdirs=yes
966 am_keeping_testdirs || rm_rf_ $testSubDir
968 echo "$me: exit $exit_status"
971 trap "fatal_ 'caught signal SIGHUP'" 1
972 trap "fatal_ 'caught signal SIGINT'" 2
973 trap "fatal_ 'caught signal SIGTERM'" 15
974 # Various shells seems to just ignore SIGQUIT under some circumstances,
975 # even if the signal is not blocked; however, if the signal it trapped,
976 # the trap gets correctly executed. So we also trap SIGQUIT.
977 # Here is a list of some shells that have been verified to exhibit the
978 # problematic behavior with SIGQUIT:
979 # - zsh 4.3.12 on Debian GNU/Linux
980 # - /bin/ksh and /usr/xpg4/bin/sh on Solaris 10
981 # - Bash 3.2.51 on Solaris 10 and bash 4.1.5 on Debian GNU/Linux
982 # - AT&T ksh on Debian Gnu/Linux (deb package ksh, version 93u-1)
983 # OTOH, at least these shells that do *not* exhibit that behaviour:
984 # - modern version of the Almquist Shell (at least 0.5.5.1), on
985 # both Solaris and GNU/Linux
986 # - Solaris 10 /bin/sh
987 # - public domain Korn Shell, version 5.2.14, on Debian GNU/Linux
988 trap "fatal_ 'caught signal SIGQUIT'" 3
989 # Ignore further SIGPIPE in the trap code. This is required to avoid
990 # a very weird issue with some shells, at least when the execution of
991 # the automake testsuite is driven by the 'prove' utility: if prove
992 # (or the make process that has spawned it) gets interrupted with
993 # Ctrl-C, the shell might go in a loop, continually getting a SIGPIPE,
994 # sometimes finally dumping core, other times hanging indefinitely.
995 # See also Test::Harness bug [rt.cpan.org #70855], archived at
996 # <https://rt.cpan.org/Ticket/Display.html?id=70855>
997 trap "trap '' 13; fatal_ 'caught signal SIGPIPE'" 13
999 # Create and populate the temporary directory, if and as required.
1000 if test x"$am_create_testdir" = x"no"; then
1003 # The subdirectory where the current test script will run and write its
1004 # temporary/data files. This will be created shortly, and will be removed
1005 # by the cleanup trap below if the test passes. If the test doesn't pass,
1006 # this directory will be kept, to facilitate debugging.
1007 testSubDir=t/$me.dir
1008 test ! -d $testSubDir || rm_rf_ $testSubDir \
1009 || framework_failure_ "removing old test subdirectory"
1010 test -d t || mkdir t
1012 || framework_failure_ "creating test subdirectory"
1013 # The trailing './'ris to avoid CDPATH issues.
1015 || framework_failure_ "cannot chdir into test subdirectory"
1016 if test x"$am_create_testdir" != x"empty"; then
1017 cp "$am_scriptdir"/install-sh "$am_scriptdir"/missing \
1018 "$am_scriptdir"/depcomp . \
1019 || framework_failure_ "fetching common files from $am_scriptdir"
1020 # Build appropriate environment in test directory. E.g., create
1021 # configure.ac, touch all necessary files, etc. Don't use AC_OUTPUT,
1022 # but AC_CONFIG_FILES so that appending still produces a valid
1023 # configure.ac. But then, tests running config.status really need
1024 # to append AC_OUTPUT.
1026 echo "AC_INIT([$me], [1.0])"
1027 if test x"$am_serial_tests" = x"yes"; then
1028 echo "AM_INIT_AUTOMAKE([serial-tests])"
1030 echo "AM_INIT_AUTOMAKE"
1032 echo "AC_CONFIG_FILES([Makefile])"
1033 } >configure.ac || framework_failure_ "creating configure.ac skeleton"
1038 ## ---------------- ##
1039 ## Ready to go... ##
1040 ## ---------------- ##