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 # NOTE: This file should execute correctly with any system's /bin/sh
23 # shell, and not only with configure-time detected $AM_TEST_RUNNER_SHELL,
24 # *until differently and explicitly specified*.
26 ## -------------------------------------------------------- ##
27 ## Source static setup and definitions for the testsuite. ##
28 ## -------------------------------------------------------- ##
30 # Ensure we are running from the right directory.
31 test -f ./defs-static || {
32 echo "$0: ./defs-static: not found in current directory" >&2
36 # Source the shell sanitization and variables' definitions.
37 . ./defs-static || exit 99
39 # Enable the errexit shell flag early.
42 # The name of the current test (without the '.sh' or '.tap' suffix).
43 # Test scripts can override it if they need to (but this should
44 # be done carefully, and *before* including ./defs).
45 if test -z "$me"; then
46 # Guard against failure to spawn sed (seen on MSYS), or empty $argv0.
47 me=`echo "$argv0" | sed -e 's,.*[\\/],,;s/\.sh$//;s/\.tap$//'` \
49 || { echo "$argv0: failed to define \$me" >&2; exit 99; }
52 ## ---------------------- ##
53 ## Early sanity checks. ##
54 ## ---------------------- ##
56 # A single whitespace character.
58 # A tabulation character.
60 # A newline character.
64 # As autoconf-generated configure scripts do, ensure that IFS
65 # is defined initially, so that saving and restoring $IFS works.
68 # Ensure $am_top_srcdir is set correctly.
69 test -f "$am_top_srcdir/defs-static.in" || {
70 echo "$me: $am_top_srcdir/defs-static.in not found," \
71 "check \$am_top_srcdir" >&2
75 # Ensure $am_top_builddir is set correctly.
76 test -f "$am_top_builddir/defs-static" || {
77 echo "$me: $am_top_builddir/defs-static not found," \
78 "check \$am_top_builddir" >&2
83 ## ------------------------------------ ##
84 ## Ensure we run with a proper shell. ##
85 ## ------------------------------------ ##
87 # Make sure we run with the shell detected at configure time (unless
88 # the user forbids it).
89 case ${AM_TESTS_REEXEC-yes} in
93 # Ensure we can find ourselves.
94 if test ! -f "$0"; then
95 echo "$me: unable to find myself: $0" >&2
98 AM_TESTS_REEXEC=no; export AM_TESTS_REEXEC
99 # Cannot simply do "opts=$-", since the content of $- is not
100 # portable among different shells. So try to propagate only
101 # the portable and interesting options.
103 *x*v*|*v*x) opts=-vx;;
108 echo $me: exec $AM_TEST_RUNNER_SHELL $opts "$0" "$*"
109 exec $AM_TEST_RUNNER_SHELL $opts "$0" ${1+"$@"} || {
110 echo "$me: failed to re-execute with $AM_TEST_RUNNER_SHELL" >&2
116 # NOTE: From this point on, we can assume this file is being executed
117 # by the configure-time detected $AM_TEST_RUNNER_SHELL.
120 ## ----------------------- ##
121 ## Early debugging info. ##
122 ## ----------------------- ##
124 echo "Running from installcheck: $am_running_installcheck"
125 echo "Using TAP: $am_using_tap"
129 ## ---------------------- ##
130 ## Environment cleanup. ##
131 ## ---------------------- ##
133 # Temporarily disable this, since some shells (e.g., older version
134 # of Bash) can return a non-zero exit status upon the when a non-set
138 # Unset some make-related variables that may cause $MAKE to act like
139 # a recursively invoked sub-make. Any $MAKE invocation in a test is
140 # conceptually an independent invocation, not part of the main
142 unset MFLAGS MAKEFLAGS AM_MAKEFLAGS MAKELEVEL
143 unset __MKLVL__ MAKE_JOBS_FIFO # For BSD make.
144 unset DMAKE_CHILD DMAKE_DEF_PRINTED DMAKE_MAX_JOBS # For Solaris dmake.
145 # Unset verbosity flag.
147 # Also unset variables that will let "make -e install" divert
148 # files into unwanted directories.
150 unset prefix exec_prefix bindir datarootdir datadir docdir dvidir
151 unset htmldir includedir infodir libdir libexecdir localedir mandir
152 unset oldincludedir pdfdir psdir sbindir sharedstatedir sysconfdir
153 # Unset variables that might change the "make distcheck" behaviour.
154 unset DISTCHECK_CONFIGURE_FLAGS AM_DISTCHECK_CONFIGURE_FLAGS
155 # Used by install rules for info files.
156 unset AM_UPDATE_INFO_DIR
157 # The tests call "make -e" but we do not want $srcdir from the environment
158 # to override the definition from the Makefile.
160 # Also unset variables that control our test driver. While not
161 # conceptually independent, they cause some changed semantics we
162 # need to control (and test for) in some of the tests to ensure
163 # backward-compatible behavior.
164 unset TESTS_ENVIRONMENT AM_TESTS_ENVIRONMENT
165 unset DISABLE_HARD_ERRORS
173 for pfx in TEST_ SH_ TAP_ ''; do
174 unset ${pfx}LOG_COMPILER
175 unset ${pfx}LOG_COMPILE # Not a typo!
176 unset ${pfx}LOG_FLAGS
177 unset AM_${pfx}LOG_FLAGS
178 unset ${pfx}LOG_DRIVER
179 unset ${pfx}LOG_DRIVER_FLAGS
180 unset AM_${pfx}LOG_DRIVER_FLAGS
184 # Re-enable, it had been temporarily disabled above.
187 ## ---------------------------- ##
188 ## Auxiliary shell functions. ##
189 ## ---------------------------- ##
191 # Tell whether we should keep the test directories around, even in
192 # case of success. By default, we don't.
193 am_keeping_testdirs ()
195 case $keep_testdirs in
196 ""|n|no|NO) return 1;;
201 # This is used in 'Exit' and in the exit trap. See comments in the latter
202 # for more information,
205 # We use a trap below for cleanup. This requires us to go through
206 # hoops to get the right exit status transported through the signal.
207 # So use "Exit STATUS" instead of "exit STATUS" inside of the tests.
208 # Turn off errexit here so that we don't trip the bug with OSF1/Tru64
209 # sh inside this function.
213 # See comments in the exit trap for the reason we do this.
214 test 77 = $1 && am__test_skipped=yes
218 if test $am_using_tap = yes; then
219 am_funcs_file=tap-functions.sh
221 am_funcs_file=plain-functions.sh
224 if test -f "$am_testauxdir/$am_funcs_file"; then
225 . "$am_testauxdir/$am_funcs_file" || {
226 echo "$me: error sourcing $am_testauxdir/$am_funcs_file" >&2
230 echo "$me: $am_testauxdir/$am_funcs_file not found" >&2
237 # Tell whether we are cross-compiling. This is especially useful to skip
238 # tests (or portions of them) that requires a native compiler.
241 # Quoting from the autoconf manual:
242 # ... [$host_alias and $build both] default to the result of running
243 # config.guess, unless you specify either --build or --host. In
244 # this case, the default becomes the system type you specified.
245 # If you specify both, *and they're different*, configure enters
246 # cross compilation mode (so it doesn't run any tests that require
248 test x"$host_alias" != x && test x"$build_alias" != x"$host_alias"
251 # is_newest FILE FILES
252 # --------------------
253 # Return false if any file in FILES is newer than FILE.
254 # Resolve ties in favor of FILE.
257 is_newest_files=$(find "$@" -prune -newer "$1")
258 test -z "$is_newest_files"
261 # is_blocked_signal SIGNAL-NUMBER
262 # --------------------------------
263 # Return success if the given signal number is blocked in the shell,
264 # return a non-zero exit status and print a proper diagnostic otherwise.
267 # Use perl, since trying to do this portably in the shell can be
268 # very tricky, if not downright impossible. For reference, see:
269 # <http://lists.gnu.org/archive/html/bug-autoconf/2011-09/msg00004.html>
272 use warnings FATAL => "all";
274 my %oldsigaction = ();
275 sigaction('"$1"', 0, \%oldsigaction);
276 exit ($oldsigaction{"HANDLER"} eq "IGNORE" ? 0 : 77);
279 elif test $? -eq 77; then
282 fatal_ "couldn't determine whether signal $1 is blocked"
286 # AUTOMAKE_run [-e STATUS] [-d DESCRIPTION] [--] [AUTOMAKE-ARGS...]
287 # -----------------------------------------------------------------
288 # Run automake with AUTOMAKE-ARGS, and fail if it doesn't exit with
289 # STATUS. Should be polymorphic for TAP and "plain" tests. The
290 # DESCRIPTION, when provided, is used for console reporting, only if
291 # the TAP protocol is in use in the current test script.
296 while test $# -gt 0; do
298 -d) am__desc=$2; shift;;
299 -e) am__exp_rc=$2; shift;;
301 # Don't fail on unknown option: assume they (and the rest of the
302 # command line) are to be passed verbatim to automake (so stop our
303 # own option parsing).
309 $AUTOMAKE ${1+"$@"} >stdout 2>stderr || am__got_rc=$?
312 if test $am_using_tap != yes; then
313 test $am__got_rc -eq $am__exp_rc || Exit 1
316 if test -z "$am__desc"; then
317 if test $am__got_rc -eq $am__exp_rc; then
318 am__desc="automake exited $am__got_rc"
320 am__desc="automake exited $am__got_rc, expecting $am__exp_rc"
323 command_ok_ "$am__desc" test $am__got_rc -eq $am__exp_rc
326 # AUTOMAKE_fails [-d DESCRIPTION] [OPTIONS...]
327 # --------------------------------------------
328 # Run automake with OPTIONS, and fail if doesn't exit with status 1.
329 # Should be polymorphic for TAP and "plain" tests. The DESCRIPTION,
330 # when provided, is used for console reporting, only if the TAP
331 # protocol is in use in the current test script.
334 AUTOMAKE_run -e 1 ${1+"$@"}
337 # extract_configure_help { --OPTION | VARIABLE-NAME } [FILES]
338 # -----------------------------------------------------------
339 # Use this to extract from the output of "./configure --help" (or similar)
340 # the description or help message associated to the given --OPTION or
342 extract_configure_help ()
344 am__opt_re='' am__var_re=''
346 --*'=') am__opt_re="^ $1";;
347 --*'[=]') am__opt_re='^ '$(printf '%s\n' "$1" | sed 's/...$//')'\[=';;
348 --*) am__opt_re="^ $1( .*|$)";;
349 *) am__var_re="^ $1( .*|$)";;
352 if test x"$am__opt_re" != x; then
354 /'"$am__opt_re"'/ { print; do_print = 1; next; }
355 /^$/ { do_print = 0; next }
356 /^ --/ { do_print = 0; next }
357 (do_print == 1) { print }
361 /'"$am__var_re"'/ { print; do_print = 1; next; }
362 /^$/ { do_print = 0; next }
363 /^ [A-Z][A-Z0-9_]* / { do_print = 0; next }
364 /^ [A-Z][A-Z0-9_]*$/ { do_print = 0; next }
365 (do_print == 1) { print }
370 # grep_configure_help { --OPTION | VARIABLE-NAME } REGEXP
371 # -------------------------------------------------------
372 # Grep the section of "./configure --help" output associated with either
373 # --OPTION or VARIABLE-NAME for the given *extended* regular expression.
374 grep_configure_help ()
376 ./configure --help > am--all-help \
377 || { cat am--all-help; Exit 1; }
379 extract_configure_help "$1" am--all-help > am--our-help \
380 || { cat am--our-help; Exit 1; }
382 $EGREP "$2" am--our-help || Exit 1
387 # Return success if $MAKE is GNU make, return failure otherwise.
388 # Caches the result for speed reasons.
391 case $am__using_gmake in
397 # Use --version AND -v, because SGI Make doesn't fail on --version.
398 # Also grep for GNU because newer versions of FreeBSD make do
399 # not complain about --version (they seem to silently ignore it).
400 if $MAKE --version -v | grep GNU; then
408 fatal_ "invalid value for \$am__using_gmake: '$am__using_gmake'";;
411 am__using_gmake="" # Avoid interferences from the environment.
413 # make_can_chain_suffix_rules
414 # ---------------------------
415 # Return 0 if $MAKE is a make implementation that can chain suffix rules
416 # automatically, return 1 otherwise. Caches the result for speed reasons.
417 make_can_chain_suffix_rules ()
419 if test -z "$am__can_chain_suffix_rules"; then
421 am__can_chain_suffix_rules=yes
424 mkdir am__chain.dir$$
426 unindent > Makefile << 'END'
431 echo make can chain suffix rules > foo.u
432 if $MAKE foo.w && diff foo.u foo.w; then
433 am__can_chain_suffix_rules=yes
435 am__can_chain_suffix_rules=no
438 rm -rf am__chain.dir$$
441 case $am__can_chain_suffix_rules in
444 *) fatal_ "make_can_chain_suffix_rules: internal error";;
447 am__can_chain_suffix_rules="" # Avoid interferences from the environment.
449 # useless_vpath_rebuild
450 # ---------------------
451 # Tell whether $MAKE suffers of the bug triggering automake bug#7884.
452 # For example, this happens with FreeBSD make, since in a VPATH build
453 # it tends to rebuilt files for which there is an explicit or even just
454 # a suffix rule, even if said files are already available in the VPATH
456 useless_vpath_rebuild ()
458 if test -z "$am__useless_vpath_rebuild"; then
460 am__useless_vpath_rebuild=no
463 mkdir am__vpath.dir$$
465 touch foo.a foo.b bar baz
468 unindent > Makefile << 'END'
474 baz: bar ; cp ../baz bar
476 if $MAKE all && test ! -f foo.b && test ! -f bar; then
477 am__useless_vpath_rebuild=no
479 am__useless_vpath_rebuild=yes
482 rm -rf am__vpath.dir$$
484 case $am__useless_vpath_rebuild in
488 *) fatal_ "no_useless_builddir_remake: internal error";;
491 am__useless_vpath_rebuild=""
493 yl_distcheck () { useless_vpath_rebuild || $MAKE distcheck ${1+"$@"}; }
495 # seq_ - print a sequence of numbers
496 # ----------------------------------
497 # This function simulates GNU seq(1) portably. Valid usages:
500 # - seq FIRST INCREMENT LAST
504 0) fatal_ "seq_: missing argument";;
505 1) seq_first=1 seq_incr=1 seq_last=$1;;
506 2) seq_first=$1 seq_incr=1 seq_last=$2;;
507 3) seq_first=$1 seq_incr=$2 seq_last=$3;;
508 *) fatal_ "seq_: too many arguments";;
511 while test $i -le $seq_last; do
513 i=$(($i + $seq_incr))
517 # rm_rf_ [FILES OR DIRECTORIES ...]
518 # ---------------------------------
519 # Recursively remove the given files or directory, also handling the case
520 # of non-writable subdirectories.
523 test $# -gt 0 || return 0
524 # Ignore failures in find, we are only interested in failures of the
526 find "$@" -type d ! -perm -700 -exec chmod u+rwx {} \; || :
530 # count_test_results total=N pass=N fail=N xpass=N xfail=N skip=N error=N
531 # -----------------------------------------------------------------------
532 # Check that a testsuite run driven by the parallel-tests harness has
533 # had the specified numbers of test results (specified by kind).
534 # This function assumes that the output of "make check" or "make recheck"
535 # has been saved in the 'stdout' file in the current directory, and its
536 # log in the 'test-suite.log' file.
537 count_test_results ()
539 # Use a subshell so that we won't pollute the script namespace.
541 # TODO: Do proper checks on the arguments?
542 total=ERR pass=ERR fail=ERR xpass=ERR xfail=ERR skip=ERR error=ERR
545 $EGREP -i '(total|x?pass|x?fail|skip|error)' stdout || :
547 # Avoid spurious failures with shells with "overly sensible"
548 # errexit shell flag, such as e.g., Solaris /bin/sh.
550 test $(grep -c '^PASS:' stdout) -eq $pass || rc=1
551 test $(grep -c '^XFAIL:' stdout) -eq $xfail || rc=1
552 test $(grep -c '^SKIP:' stdout) -eq $skip || rc=1
553 test $(grep -c '^FAIL:' stdout) -eq $fail || rc=1
554 test $(grep -c '^XPASS:' stdout) -eq $xpass || rc=1
555 test $(grep -c '^ERROR:' stdout) -eq $error || rc=1
556 grep "^# TOTAL: *$total$" stdout || rc=1
557 grep "^# PASS: *$pass$" stdout || rc=1
558 grep "^# XFAIL: *$xfail$" stdout || rc=1
559 grep "^# SKIP: *$skip$" stdout || rc=1
560 grep "^# FAIL: *$fail$" stdout || rc=1
561 grep "^# XPASS: *$xpass$" stdout || rc=1
562 grep "^# ERROR: *$error$" stdout || rc=1
567 commented_sed_unindent_prog='
568 /^$/b # Nothing to do for empty lines.
569 x # Get x<indent> into pattern space.
570 /^$/{ # No prior x<indent>, go prepare it.
571 g # Copy this 1st non-blank line into pattern space.
572 s/^\(['"$tab"' ]*\).*/x\1/ # Prepare x<indent> in pattern space.
573 } # Now: x<indent> in pattern and <line> in hold.
574 G # Build x<indent>\n<line> in pattern space, and
575 h # duplicate it into hold space.
576 s/\n.*$// # Restore x<indent> in pattern space, and
577 x # exchange with the above duplicate in hold space.
578 s/^x\(.*\)\n\1// # Remove leading <indent> from <line>.
579 s/^x.*\n// # Restore <line> when there is no leading <indent>.
582 # unindent [input files...]
583 # -------------------------
584 # Remove the "proper" amount of leading whitespace from the given files,
585 # and output the result on stdout. That amount is determined by looking
586 # at the leading whitespace of the first non-blank line in the input
587 # files. If no input file is specified, standard input is implied.
590 if test x"$sed_unindent_prog" = x; then
591 sed_unindent_prog=$(printf '%s\n' "$commented_sed_unindent_prog" \
592 | sed -e "s/ *# .*//")
594 sed "$sed_unindent_prog" ${1+"$@"}
596 sed_unindent_prog="" # Avoid interferences from the environment.
598 # get_shell_script SCRIPT-NAME
599 # -----------------------------
600 # Fetch an Automake-provided shell script from the 'lib/' directory into
601 # the current directory, and, if the '$am_test_prefer_config_shell'
602 # variable is set to "yes", modify its shebang line to use $SHELL instead
606 test ! -f "$1" || rm -f "$1" || return 99
607 if test x"$am_test_prefer_config_shell" = x"yes"; then
608 sed "1s|#!.*|#! $SHELL|" "$am_scriptdir/$1" > "$1" \
612 cp -f "$am_scriptdir/$1" . || return 99
614 sed 10q "$1" # For debugging.
619 # Skip the test if the given shell fails to support common XSI constructs.
622 test $# -eq 1 || fatal_ "require_xsi needs exactly one argument"
623 echo "$me: trying some XSI constructs with $1"
624 $1 -c "$xsi_shell_code" || skip_all_ "$1 lacks XSI features"
626 # Shell code supposed to work only with XSI shells. Keep this in sync
627 # with libtool.m4:_LT_CHECK_SHELL_FEATURES.
630 test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
632 && eval '\''test $(( 1 + 1 )) -eq 2 \
633 && test "${#_lt_dummy}" -eq 5'\'
637 # Fetch the Automake-provided TAP driver from the 'lib/' directory into
638 # the current directory, and edit its shebang line so that it will be
639 # run with the perl interpreter determined at configure time.
642 # TODO: we should devise a way to make the shell TAP driver tested also
643 # TODO: with /bin/sh, for better coverage.
644 case $am_tap_implementation in
646 $PERL -MTAP::Parser -e 1 \
647 || skip_all_ "cannot import TAP::Parser perl module"
648 sed "1s|#!.*|#! $PERL -w|" "$am_scriptdir"/tap-driver.pl >tap-driver
651 AM_TAP_AWK=$AWK; export AM_TAP_AWK
652 sed "1s|#!.*|#! $SHELL|" "$am_scriptdir"/tap-driver.sh >tap-driver
655 fatal_ "invalid \$am_tap_implementation '$am_tap_implementation'" ;;
657 && chmod a+x tap-driver \
658 || framework_failure_ "couldn't fetch $am_tap_implementation TAP driver"
659 sed 10q tap-driver # For debugging.
661 # The shell/awk implementation of the TAP driver is still mostly dummy, so
662 # use the perl implementation by default for the moment.
663 am_tap_implementation=${am_tap_implementation-shell}
665 # Usage: require_compiler_ {cc|c++|fortran|fortran77}
669 0) fatal_ "require_compiler_: missing argument";;
671 *) fatal_ "require_compiler_: too many arguments";;
677 am__comp_flag_vars='CFLAGS CPPFLAGS'
682 am__comp_flag_vars='CXXFLAGS CPPFLAGS'
685 am__comp_lang="Fortran"
687 am__comp_flag_vars='FCFLAGS'
690 am__comp_lang="Fortran 77"
692 am__comp_flag_vars='FFLAGS'
696 eval "am__comp_prog=\${$am__comp_var}" \
697 || fatal_ "expanding \${$am__comp_var} in require_compiler_"
698 case $am__comp_prog in
700 fatal_ "botched configuration: \$$am__comp_var is empty";;
702 skip_all_ "no $am__comp_lang compiler available";;
703 autodetect|autodetected)
704 # Let the ./configure commands in the test script try to determine
705 # these automatically.
706 unset $am__comp_var $am__comp_flag_vars;;
708 # Pre-set these for the ./configure commands in the test script.
709 export $am__comp_var $am__comp_flag_vars;;
711 # Delete private variables.
712 unset am__comp_lang am__comp_prog am__comp_var am__comp_flag_vars
715 ## ----------------------------------------------------------- ##
716 ## Checks for required tools, and additional setups (if any) ##
717 ## required by them. ##
718 ## ----------------------------------------------------------- ##
720 # Performance tests must be enabled explicitly.
723 case $AM_TESTSUITE_PERF in
725 *) skip_ "performance tests not explicitly enabled" ;;
730 # Look for (and maybe set up) required tools and/or system features; skip
731 # the current test if they are not found.
732 for tool in : $required
734 # Check that each required tool is present.
737 cc|c++|fortran|fortran77)
738 require_compiler_ $tool;;
740 if test x"$am_test_prefer_config_shell" = x"yes"; then
743 require_xsi "/bin/sh"
747 # Do not use --version, older versions bzip2 still tries to compress
749 echo "$me: running bzip2 --help"
751 || skip_all_ "required program 'bzip2' not available"
755 # Don't export CFLAGS, as that could have been initialized to only
756 # work with the C compiler detected at configure time. If the user
757 # wants CFLAGS to also influence 'cl', he can still export CFLAGS
758 # in the environment "by hand" before calling the testsuite.
760 echo "$me: running $CC -?"
761 $CC -? || skip_all_ "Microsoft C compiler '$CC' not available"
764 # Exuberant Ctags will create a TAGS file even
765 # when asked for --help or --version. (Emacs's etags
766 # does not have such problem.) Use -o /dev/null
767 # to make sure we do not pollute the build directory.
768 echo "$me: running etags --version -o /dev/null"
769 etags --version -o /dev/null \
770 || skip_all_ "required program 'etags' not available"
773 for make_ in "$MAKE" gmake gnumake :; do
774 MAKE=$make_ am__using_gmake=''
775 test "$MAKE" = : && break
776 echo "$me: determine whether $MAKE is GNU make"
778 : For shells with busted 'set -e'.
780 test "$MAKE" = : && skip_all_ "this test requires GNU make"
785 GCJ=$GNU_GCJ GCJFLAGS=$GNU_GCJFLAGS; export GCJ GCJFLAGS
786 test "$GCJ" = false && skip_all_ "GNU Java compiler unavailable"
787 : For shells with busted 'set -e'.
790 CC=$GNU_CC CFLAGS=$GNU_CFLAGS; export CC CFLAGS CPPFLAGS
791 test "$CC" = false && skip_all_ "GNU C compiler unavailable"
792 : For shells with busted 'set -e'.
795 CXX=$GNU_CXX CXXFLAGS=$GNU_CXXFLAGS; export CXX CXXFLAGS CPPFLAGS
796 test "$CXX" = false && skip_all_ "GNU C++ compiler unavailable"
797 : For shells with busted 'set -e'.
800 FC=$GNU_FC FCFLAGS=$GNU_FCFLAGS; export FC FCFLAGS
801 test "$FC" = false && skip_all_ "GNU Fortran compiler unavailable"
802 case " $required " in
804 *) F77=$FC FFLAGS=$FCFLAGS; export F77 FFLAGS;;
808 F77=$GNU_F77 FFLAGS=$GNU_FFLAGS; export F77 FFLAGS
809 test "$F77" = false && skip_all_ "GNU Fortran 77 compiler unavailable"
810 case " $required " in
812 *) FC=$F77 FCFLAGS=$FFLAGS; export FC FCFLAGS;;
816 # The Java compiler from JDK 1.5 (and presumably earlier versions)
817 # cannot handle the '-version' option by itself: it bails out
818 # telling that source files are missing. Adding also the '-help'
819 # option seems to solve the problem.
820 echo "$me: running javac -version -help"
821 javac -version -help || skip_all_ "Sun Java compiler not available"
824 # See the comments above about 'javac' for why we use also '-help'.
825 echo "$me: running java -version -help"
826 java -version -help || skip_all_ "Sun Java interpreter not found"
831 # Attempting to create an empty archive will actually not
832 # create the archive, but lib will output its version.
833 echo "$me: running $AR -out:defstest.lib"
834 $AR -out:defstest.lib \
835 || skip_all_ "Microsoft 'lib' utility not available"
838 echo "$me: running makedepend -f-"
840 || skip_all_ "required program 'makedepend' not available"
843 # Make sure we have makeinfo, and it understands '--html'.
844 echo "$me: running makeinfo --html --version"
845 makeinfo --html --version \
846 || skip_all_ "cannot find a makeinfo program that groks" \
847 "the '--html' option"
850 uname_s=$(uname -s || echo UNKNOWN)
851 echo "$me: system name: $uname_s"
854 *) skip_all_ "this test requires MSYS in MinGW mode" ;;
859 # Skip this test case if the user is root.
860 # We try to append to a read-only file to detect this.
861 priv_check_temp=priv-check.$$
862 touch $priv_check_temp && chmod a-w $priv_check_temp \
863 || framework_failure_ "creating unwritable file $priv_check_temp"
864 # Not a useless use of subshell: lesser shells like Solaris /bin/sh
865 # can exit if a builtin fails.
867 (echo foo >> $priv_check_temp) || overwrite_status=$?
868 rm -f $priv_check_temp
869 if test $overwrite_status -eq 0; then
870 skip_all_ "cannot drop file write permissions"
872 unset priv_check_temp overwrite_status
875 if test "$WANT_NO_THREADS" = "yes"; then
876 skip_all_ "Devel::Cover cannot cope with threads"
880 # Don't use "&&" here, to avoid a bug of 'set -e' present in
881 # some (even relatively recent) versions of the BSD shell.
882 # We add the dummy "else" branch for extra safety.
883 ! cross_compiling || skip_all_ "doesn't work in cross-compile mode"
886 # Python doesn't support --version, it has -V
887 echo "$me: running python -V"
888 python -V || skip_all_ "python interpreter not available"
891 # Skip this test case if read-only directories aren't supported
893 ro_dir_temp=ro_dir.$$
894 mkdir $ro_dir_temp && chmod a-w $ro_dir_temp \
895 || framework_failure_ "creating unwritable directory $ro_dir_temp"
896 # Not a useless use of subshell: lesser shells like Solaris /bin/sh
897 # can exit if a builtin fails.
899 (: > $ro_dir_temp/probe) || create_status=$?
901 if test $create_status -eq 0; then
902 skip_all_ "cannot drop directory write permissions"
904 unset ro_dir_temp create_status
907 # DejaGnu's runtest program. We rely on being able to specify
908 # the program on the runtest command-line. This requires
909 # DejaGnu 1.4.3 or later.
910 echo "$me: running runtest SOMEPROGRAM=someprogram --version"
911 runtest SOMEPROGRAM=someprogram --version \
912 || skip_all_ "DejaGnu is not available"
915 # No all versions of Tex support '--version', so we use
917 if test -z "$TEX"; then
918 skip_all_ "TeX is required, but it wasn't found by configure"
922 # Texi2dvi supports '-o' since Texinfo 4.1.
923 echo "$me: running texi2dvi -o /dev/null --version"
924 texi2dvi -o /dev/null --version \
925 || skip_all_ "required program 'texi2dvi' not available"
928 test x"$LEX" = x"false" && skip_all_ "lex not found or disabled"
932 test x"$YACC" = x"false" && skip_all_ "yacc not found or disabled"
937 echo "$me: running flex --version"
938 flex --version || skip_all_ "required program 'flex' not available"
941 YACC='bison -y'; export YACC
942 echo "$me: running bison --version"
943 bison --version || skip_all_ "required program 'bison' not available"
946 # Generic case: the tool must support --version.
947 echo "$me: running $tool --version"
948 # It is not likely but possible that $tool is a special builtin,
949 # in which case the shell is allowed to exit after an error. So
950 # we need the subshell here. Also, some tools, like Sun cscope,
951 # can be interactive without redirection.
952 ($tool --version) </dev/null \
953 || skip_all_ "required program '$tool' not available"
958 # Using just $am_top_builddir for the check here is ok, since the
959 # further temporary subdirectory where the test will be run is
960 # ensured not to contain any whitespace character.
961 case $am_top_builddir in
963 case " $required " in
964 *' libtool '* | *' libtoolize '* )
965 skip_all_ "libtool has problems with spaces in builddir name";;
970 # This test is necessary, although Automake's configure script bails out
971 # when $srcdir contains spaces. This is because $am_top_srcdir is in not
972 # configure-time $srcdir, but is instead configure-time $abs_srcdir, and
973 # that is allowed to contain spaces.
974 case $am_top_srcdir in
976 case " $required " in
977 *' libtool '* | *' libtoolize '* | *' gettext '* )
978 skip_all_ "spaces in srcdir name: libtool/gettext tests won't work";;
983 # We might need extra macros, e.g., from Libtool or Gettext.
984 case " $required " in *\ libtool*) . ./t/libtool-macros.dir/get.sh;; esac
985 case " $required " in *\ gettext*) . ./t/gettext-macros.dir/get.sh;; esac
988 ## ---------------------------------------------------------------- ##
989 ## Create and set up of the temporary directory used by the test. ##
990 ## Set up of the exit trap for cleanup of said directory. ##
991 ## ---------------------------------------------------------------- ##
993 # This might be used in testcases checking distribution-related features.
994 # Test scripts are free to override this if they need to.
997 # Set up the exit trap.
1000 cd "$am_top_builddir"
1001 if test $am_using_tap = yes; then
1002 if test "$planned_" = later && test $exit_status -eq 0; then
1005 test $exit_status -eq 0 && test $tap_pass_count_ -eq $tap_count_ \
1006 || keep_testdirs=yes
1008 # This is to ensure that a test script does give a SKIP outcome just
1009 # because a command in it happens to exit with status 77. This
1010 # behaviour, while from time to time useful to developers, is not
1011 # meant to be enabled by default, as it could cause spurious failures
1012 # in the wild. Thus it will be enabled only when the variable
1013 # "am_explicit_skips" is set to a "true" value.
1014 case $am_explicit_skips in
1016 if test $exit_status -eq 77 && test $am__test_skipped != yes; then
1017 echo "$me: implicit skip turned into failure"
1021 test $exit_status -eq 0 || keep_testdirs=yes
1023 am_keeping_testdirs || rm_rf_ $testSubDir
1025 echo "$me: exit $exit_status"
1028 trap "fatal_ 'caught signal SIGHUP'" 1
1029 trap "fatal_ 'caught signal SIGINT'" 2
1030 trap "fatal_ 'caught signal SIGTERM'" 15
1031 # Various shells seems to just ignore SIGQUIT under some circumstances,
1032 # even if the signal is not blocked; however, if the signal it trapped,
1033 # the trap gets correctly executed. So we also trap SIGQUIT.
1034 # Here is a list of some shells that have been verified to exhibit the
1035 # problematic behavior with SIGQUIT:
1036 # - zsh 4.3.12 on Debian GNU/Linux
1037 # - /bin/ksh and /usr/xpg4/bin/sh on Solaris 10
1038 # - Bash 3.2.51 on Solaris 10 and bash 4.1.5 on Debian GNU/Linux
1039 # - AT&T ksh on Debian Gnu/Linux (deb package ksh, version 93u-1)
1040 # OTOH, at least these shells that do *not* exhibit that behaviour:
1041 # - modern version of the Almquist Shell (at least 0.5.5.1), on
1042 # both Solaris and GNU/Linux
1043 # - Solaris 10 /bin/sh
1044 # - public domain Korn Shell, version 5.2.14, on Debian GNU/Linux
1045 trap "fatal_ 'caught signal SIGQUIT'" 3
1046 # Ignore further SIGPIPE in the trap code. This is required to avoid
1047 # a very weird issue with some shells, at least when the execution of
1048 # the automake testsuite is driven by the 'prove' utility: if prove
1049 # (or the make process that has spawned it) gets interrupted with
1050 # Ctrl-C, the shell might go in a loop, continually getting a SIGPIPE,
1051 # sometimes finally dumping core, other times hanging indefinitely.
1052 # See also Test::Harness bug [rt.cpan.org #70855], archived at
1053 # <https://rt.cpan.org/Ticket/Display.html?id=70855>
1054 trap "trap '' 13; fatal_ 'caught signal SIGPIPE'" 13
1056 # Create and populate the temporary directory, if and as required.
1057 if test x"$am_create_testdir" = x"no"; then
1060 # The subdirectory where the current test script will run and write its
1061 # temporary/data files. This will be created shortly, and will be removed
1062 # by the cleanup trap below if the test passes. If the test doesn't pass,
1063 # this directory will be kept, to facilitate debugging.
1064 testSubDir=t/$me.dir
1065 test ! -d $testSubDir || rm_rf_ $testSubDir \
1066 || framework_failure_ "removing old test subdirectory"
1067 test -d t || mkdir t
1069 || framework_failure_ "creating test subdirectory"
1070 # The trailing './'ris to avoid CDPATH issues.
1072 || framework_failure_ "cannot chdir into test subdirectory"
1073 if test x"$am_create_testdir" != x"empty"; then
1074 cp "$am_scriptdir"/install-sh "$am_scriptdir"/missing \
1075 "$am_scriptdir"/depcomp . \
1076 || framework_failure_ "fetching common files from $am_scriptdir"
1077 # Build appropriate environment in test directory. E.g., create
1078 # configure.ac, touch all necessary files, etc. Don't use AC_OUTPUT,
1079 # but AC_CONFIG_FILES so that appending still produces a valid
1080 # configure.ac. But then, tests running config.status really need
1081 # to append AC_OUTPUT.
1083 echo "AC_INIT([$me], [1.0])"
1084 if test x"$am_serial_tests" = x"yes"; then
1085 echo "AM_INIT_AUTOMAKE"
1087 echo "AM_INIT_AUTOMAKE([parallel-tests])"
1089 echo "AC_CONFIG_FILES([Makefile])"
1090 } >configure.ac || framework_failure_ "creating configure.ac skeleton"
1095 ## ---------------- ##
1096 ## Ready to go... ##
1097 ## ---------------- ##