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 '_am_exit' and in the exit trap. See comments in
159 # the latter 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 # Turn off errexit here so that we don't trip the bug with OSF1/Tru64
165 # sh inside this function (FIXME: is this still relevant now that we
166 # require a POSIX shell?).
170 # See comments in the exit trap for the reason we do this.
171 test 77 = $1 && am__test_skipped=yes
172 # Spurious escaping to ensure we do not call our 'exit' alias.
177 if test $am_using_tap = yes; then
178 am_funcs_file=tap-functions.sh
180 am_funcs_file=plain-functions.sh
183 if test -f "$am_testauxdir/$am_funcs_file"; then
184 . "$am_testauxdir/$am_funcs_file" || {
185 echo "$me: error sourcing $am_testauxdir/$am_funcs_file" >&2
189 echo "$me: $am_testauxdir/$am_funcs_file not found" >&2
196 # Tell whether we are cross-compiling. This is especially useful to skip
197 # tests (or portions of them) that requires a native compiler.
200 # Quoting from the autoconf manual:
201 # ... [$host_alias and $build both] default to the result of running
202 # config.guess, unless you specify either --build or --host. In
203 # this case, the default becomes the system type you specified.
204 # If you specify both, *and they're different*, configure enters
205 # cross compilation mode (so it doesn't run any tests that require
207 test x"$host_alias" != x && test x"$build_alias" != x"$host_alias"
210 # is_blocked_signal SIGNAL-NUMBER
211 # --------------------------------
212 # Return success if the given signal number is blocked in the shell,
213 # return a non-zero exit status and print a proper diagnostic otherwise.
216 # Use perl, since trying to do this portably in the shell can be
217 # very tricky, if not downright impossible. For reference, see:
218 # <http://lists.gnu.org/archive/html/bug-autoconf/2011-09/msg00004.html>
221 use warnings FATAL => "all";
223 my %oldsigaction = ();
224 sigaction('"$1"', 0, \%oldsigaction);
225 exit ($oldsigaction{"HANDLER"} eq "IGNORE" ? 0 : 77);
228 elif test $? -eq 77; then
231 fatal_ "couldn't determine whether signal $1 is blocked"
235 # AUTOMAKE_run [-e STATUS] [-d DESCRIPTION] [--] [AUTOMAKE-ARGS...]
236 # -----------------------------------------------------------------
237 # Run automake with AUTOMAKE-ARGS, and fail if it doesn't exit with
238 # STATUS. Should be polymorphic for TAP and "plain" tests. The
239 # DESCRIPTION, when provided, is used for console reporting, only if
240 # the TAP protocol is in use in the current test script.
245 while test $# -gt 0; do
247 -d) am__desc=$2; shift;;
248 -e) am__exp_rc=$2; shift;;
250 # Don't fail on unknown option: assume they (and the rest of the
251 # command line) are to be passed verbatim to automake (so stop our
252 # own option parsing).
258 $AUTOMAKE ${1+"$@"} >stdout 2>stderr || am__got_rc=$?
261 if test $am_using_tap != yes; then
262 test $am__got_rc -eq $am__exp_rc || exit 1
265 if test -z "$am__desc"; then
266 if test $am__got_rc -eq $am__exp_rc; then
267 am__desc="automake exited $am__got_rc"
269 am__desc="automake exited $am__got_rc, expecting $am__exp_rc"
272 command_ok_ "$am__desc" test $am__got_rc -eq $am__exp_rc
275 # AUTOMAKE_fails [-d DESCRIPTION] [OPTIONS...]
276 # --------------------------------------------
277 # Run automake with OPTIONS, and fail if doesn't exit with status 1.
278 # Should be polymorphic for TAP and "plain" tests. The DESCRIPTION,
279 # when provided, is used for console reporting, only if the TAP
280 # protocol is in use in the current test script.
283 AUTOMAKE_run -e 1 ${1+"$@"}
286 # extract_configure_help { --OPTION | VARIABLE-NAME } [FILES]
287 # -----------------------------------------------------------
288 # Use this to extract from the output of "./configure --help" (or similar)
289 # the description or help message associated to the given --OPTION or
291 extract_configure_help ()
293 am__opt_re='' am__var_re=''
295 --*'=') am__opt_re="^ $1";;
296 --*'[=]') am__opt_re='^ '$(printf '%s\n' "$1" | sed 's/...$//')'\[=';;
297 --*) am__opt_re="^ $1( .*|$)";;
298 *) am__var_re="^ $1( .*|$)";;
301 if test x"$am__opt_re" != x; then
303 /'"$am__opt_re"'/ { print; do_print = 1; next; }
304 /^$/ { do_print = 0; next }
305 /^ --/ { do_print = 0; next }
306 (do_print == 1) { print }
310 /'"$am__var_re"'/ { print; do_print = 1; next; }
311 /^$/ { do_print = 0; next }
312 /^ [A-Z][A-Z0-9_]* / { do_print = 0; next }
313 /^ [A-Z][A-Z0-9_]*$/ { do_print = 0; next }
314 (do_print == 1) { print }
319 # grep_configure_help { --OPTION | VARIABLE-NAME } REGEXP
320 # -------------------------------------------------------
321 # Grep the section of "./configure --help" output associated with either
322 # --OPTION or VARIABLE-NAME for the given *extended* regular expression.
323 grep_configure_help ()
325 ./configure --help > am--all-help \
326 || { cat am--all-help; exit 1; }
328 extract_configure_help "$1" am--all-help > am--our-help \
329 || { cat am--our-help; exit 1; }
331 $EGREP "$2" am--our-help || exit 1
336 # Return success if $MAKE is GNU make, return failure otherwise.
337 # Caches the result for speed reasons.
340 case $am__using_gmake in
346 # Use --version AND -v, because SGI Make doesn't fail on --version.
347 # Also grep for GNU because newer versions of FreeBSD make do
348 # not complain about --version (they seem to silently ignore it).
349 if $MAKE --version -v | grep GNU; then
357 fatal_ "invalid value for \$am__using_gmake: '$am__using_gmake'";;
360 am__using_gmake="" # Avoid interferences from the environment.
362 # make_can_chain_suffix_rules
363 # ---------------------------
364 # Return 0 if $MAKE is a make implementation that can chain suffix rules
365 # automatically, return 1 otherwise. Caches the result for speed reasons.
366 make_can_chain_suffix_rules ()
368 if test -z "$am__can_chain_suffix_rules"; then
370 am__can_chain_suffix_rules=yes
373 mkdir am__chain.dir$$
375 unindent > Makefile << 'END'
380 echo make can chain suffix rules > foo.u
381 if $MAKE foo.w && diff foo.u foo.w; then
382 am__can_chain_suffix_rules=yes
384 am__can_chain_suffix_rules=no
387 rm -rf am__chain.dir$$
390 case $am__can_chain_suffix_rules in
393 *) fatal_ "make_can_chain_suffix_rules: internal error";;
396 am__can_chain_suffix_rules="" # Avoid interferences from the environment.
398 # useless_vpath_rebuild
399 # ---------------------
400 # Tell whether $MAKE suffers of the bug triggering automake bug#7884.
401 # For example, this happens with FreeBSD make, since in a VPATH build
402 # it tends to rebuilt files for which there is an explicit or even just
403 # a suffix rule, even if said files are already available in the VPATH
405 useless_vpath_rebuild ()
407 if test -z "$am__useless_vpath_rebuild"; then
409 am__useless_vpath_rebuild=no
412 mkdir am__vpath.dir$$
414 touch foo.a foo.b bar baz
417 unindent > Makefile << 'END'
423 baz: bar ; cp ../baz bar
425 if $MAKE all && test ! -f foo.b && test ! -f bar; then
426 am__useless_vpath_rebuild=no
428 am__useless_vpath_rebuild=yes
431 rm -rf am__vpath.dir$$
433 case $am__useless_vpath_rebuild in
437 *) fatal_ "no_useless_builddir_remake: internal error";;
440 am__useless_vpath_rebuild=""
442 yl_distcheck () { useless_vpath_rebuild || $MAKE distcheck ${1+"$@"}; }
444 # seq_ - print a sequence of numbers
445 # ----------------------------------
446 # This function simulates GNU seq(1) portably. Valid usages:
449 # - seq FIRST INCREMENT LAST
453 0) fatal_ "seq_: missing argument";;
454 1) seq_first=1 seq_incr=1 seq_last=$1;;
455 2) seq_first=$1 seq_incr=1 seq_last=$2;;
456 3) seq_first=$1 seq_incr=$2 seq_last=$3;;
457 *) fatal_ "seq_: too many arguments";;
460 while test $i -le $seq_last; do
462 i=$(($i + $seq_incr))
466 # rm_rf_ [FILES OR DIRECTORIES ...]
467 # ---------------------------------
468 # Recursively remove the given files or directory, also handling the case
469 # of non-writable subdirectories.
472 test $# -gt 0 || return 0
473 # Ignore failures in find, we are only interested in failures of the
475 find "$@" -type d ! -perm -700 -exec chmod u+rwx {} \; || :
479 # count_test_results total=N pass=N fail=N xpass=N xfail=N skip=N error=N
480 # -----------------------------------------------------------------------
481 # Check that a testsuite run driven by the parallel-tests harness has
482 # had the specified numbers of test results (specified by kind).
483 # This function assumes that the output of "make check" or "make recheck"
484 # has been saved in the 'stdout' file in the current directory, and its
485 # log in the 'test-suite.log' file.
486 count_test_results ()
488 # Use a subshell so that we won't pollute the script namespace.
490 # TODO: Do proper checks on the arguments?
491 total=ERR pass=ERR fail=ERR xpass=ERR xfail=ERR skip=ERR error=ERR
494 $EGREP -i '(total|x?pass|x?fail|skip|error)' stdout || :
496 # Avoid spurious failures with shells with "overly sensible"
497 # errexit shell flag, such as e.g., Solaris /bin/sh.
499 test $(grep -c '^PASS:' stdout) -eq $pass || rc=1
500 test $(grep -c '^XFAIL:' stdout) -eq $xfail || rc=1
501 test $(grep -c '^SKIP:' stdout) -eq $skip || rc=1
502 test $(grep -c '^FAIL:' stdout) -eq $fail || rc=1
503 test $(grep -c '^XPASS:' stdout) -eq $xpass || rc=1
504 test $(grep -c '^ERROR:' stdout) -eq $error || rc=1
505 grep "^# TOTAL: *$total$" stdout || rc=1
506 grep "^# PASS: *$pass$" stdout || rc=1
507 grep "^# XFAIL: *$xfail$" stdout || rc=1
508 grep "^# SKIP: *$skip$" stdout || rc=1
509 grep "^# FAIL: *$fail$" stdout || rc=1
510 grep "^# XPASS: *$xpass$" stdout || rc=1
511 grep "^# ERROR: *$error$" stdout || rc=1
516 commented_sed_unindent_prog='
517 /^$/b # Nothing to do for empty lines.
518 x # Get x<indent> into pattern space.
519 /^$/{ # No prior x<indent>, go prepare it.
520 g # Copy this 1st non-blank line into pattern space.
521 s/^\(['"$tab"' ]*\).*/x\1/ # Prepare x<indent> in pattern space.
522 } # Now: x<indent> in pattern and <line> in hold.
523 G # Build x<indent>\n<line> in pattern space, and
524 h # duplicate it into hold space.
525 s/\n.*$// # Restore x<indent> in pattern space, and
526 x # exchange with the above duplicate in hold space.
527 s/^x\(.*\)\n\1// # Remove leading <indent> from <line>.
528 s/^x.*\n// # Restore <line> when there is no leading <indent>.
531 # unindent [input files...]
532 # -------------------------
533 # Remove the "proper" amount of leading whitespace from the given files,
534 # and output the result on stdout. That amount is determined by looking
535 # at the leading whitespace of the first non-blank line in the input
536 # files. If no input file is specified, standard input is implied.
539 if test x"$sed_unindent_prog" = x; then
540 sed_unindent_prog=$(printf '%s\n' "$commented_sed_unindent_prog" \
541 | sed -e "s/ *# .*//")
543 sed "$sed_unindent_prog" ${1+"$@"}
545 sed_unindent_prog="" # Avoid interferences from the environment.
547 # get_shell_script SCRIPT-NAME
548 # -----------------------------
549 # Fetch an Automake-provided shell script from the 'lib/' directory into
550 # the current directory, and, if the '$am_test_prefer_config_shell'
551 # variable is set to "yes", modify its shebang line to use $SHELL instead
555 test ! -f "$1" || rm -f "$1" || return 99
556 if test x"$am_test_prefer_config_shell" = x"yes"; then
557 sed "1s|#!.*|#! $SHELL|" "$am_scriptdir/$1" > "$1" \
561 cp -f "$am_scriptdir/$1" . || return 99
563 sed 10q "$1" # For debugging.
568 # Skip the test if the given shell fails to support common XSI constructs.
571 test $# -eq 1 || fatal_ "require_xsi needs exactly one argument"
572 echo "$me: trying some XSI constructs with $1"
573 $1 -c "$xsi_shell_code" || skip_all_ "$1 lacks XSI features"
575 # Shell code supposed to work only with XSI shells. Keep this in sync
576 # with libtool.m4:_LT_CHECK_SHELL_FEATURES.
579 test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
581 && eval '\''test $(( 1 + 1 )) -eq 2 \
582 && test "${#_lt_dummy}" -eq 5'\'
586 # Fetch the Automake-provided TAP driver from the 'lib/' directory into
587 # the current directory, and edit its shebang line so that it will be
588 # run with the perl interpreter determined at configure time.
591 # TODO: we should devise a way to make the shell TAP driver tested also
592 # TODO: with /bin/sh, for better coverage.
593 case $am_tap_implementation in
594 # Extra quoting required to avoid maintainer-check spurious failures.
596 $PERL -MTAP::Parser -e 1 \
597 || skip_all_ "cannot import TAP::Parser perl module"
598 sed "1s|#!.*|#! $PERL -w|" "$am_scriptdir"/tap-driver.pl >tap-driver
601 AM_TAP_AWK=$AWK; export AM_TAP_AWK
602 sed "1s|#!.*|#! $SHELL|" "$am_scriptdir"/tap-driver.sh >tap-driver
605 fatal_ "invalid \$am_tap_implementation '$am_tap_implementation'" ;;
607 && chmod a+x tap-driver \
608 || framework_failure_ "couldn't fetch $am_tap_implementation TAP driver"
609 sed 10q tap-driver # For debugging.
611 # The shell/awk implementation of the TAP driver is still mostly dummy, so
612 # use the perl implementation by default for the moment.
613 am_tap_implementation=${am_tap_implementation-shell}
615 # Usage: require_compiler_ {cc|c++|fortran|fortran77}
619 0) fatal_ "require_compiler_: missing argument";;
621 *) fatal_ "require_compiler_: too many arguments";;
627 am__comp_flag_vars='CFLAGS CPPFLAGS'
632 am__comp_flag_vars='CXXFLAGS CPPFLAGS'
635 am__comp_lang="Fortran"
637 am__comp_flag_vars='FCFLAGS'
640 am__comp_lang="Fortran 77"
642 am__comp_flag_vars='FFLAGS'
646 eval "am__comp_prog=\${$am__comp_var}" \
647 || fatal_ "expanding \${$am__comp_var} in require_compiler_"
648 case $am__comp_prog in
650 fatal_ "botched configuration: \$$am__comp_var is empty";;
652 skip_all_ "no $am__comp_lang compiler available";;
653 autodetect|autodetected)
654 # Let the ./configure commands in the test script try to determine
655 # these automatically.
656 unset $am__comp_var $am__comp_flag_vars;;
658 # Pre-set these for the ./configure commands in the test script.
659 export $am__comp_var $am__comp_flag_vars;;
661 # Delete private variables.
662 unset am__comp_lang am__comp_prog am__comp_var am__comp_flag_vars
665 ## ----------------------------------------------------------- ##
666 ## Checks for required tools, and additional setups (if any) ##
667 ## required by them. ##
668 ## ----------------------------------------------------------- ##
670 # Performance tests must be enabled explicitly.
673 case $AM_TESTSUITE_PERF in
675 *) skip_ "performance tests not explicitly enabled" ;;
680 # Look for (and maybe set up) required tools and/or system features; skip
681 # the current test if they are not found.
682 for tool in : $required
684 # Check that each required tool is present.
687 cc|c++|fortran|fortran77)
688 require_compiler_ $tool;;
690 if test x"$am_test_prefer_config_shell" = x"yes"; then
693 require_xsi "/bin/sh"
697 # Do not use --version, older versions bzip2 still tries to compress
699 echo "$me: running bzip2 --help"
701 || skip_all_ "required program 'bzip2' not available"
705 # Don't export CFLAGS, as that could have been initialized to only
706 # work with the C compiler detected at configure time. If the user
707 # wants CFLAGS to also influence 'cl', he can still export CFLAGS
708 # in the environment "by hand" before calling the testsuite.
710 echo "$me: running $CC -?"
711 $CC -? || skip_all_ "Microsoft C compiler '$CC' not available"
714 # Exuberant Ctags will create a TAGS file even
715 # when asked for --help or --version. (Emacs's etags
716 # does not have such problem.) Use -o /dev/null
717 # to make sure we do not pollute the build directory.
718 echo "$me: running etags --version -o /dev/null"
719 etags --version -o /dev/null \
720 || skip_all_ "required program 'etags' not available"
723 for make_ in "$MAKE" gmake gnumake :; do
724 MAKE=$make_ am__using_gmake=''
725 test "$MAKE" = : && break
726 echo "$me: determine whether $MAKE is GNU make"
728 : For shells with busted 'set -e'.
730 test "$MAKE" = : && skip_all_ "this test requires GNU make"
735 GCJ=$GNU_GCJ GCJFLAGS=$GNU_GCJFLAGS; export GCJ GCJFLAGS
736 test "$GCJ" = false && skip_all_ "GNU Java compiler unavailable"
737 : For shells with busted 'set -e'.
740 CC=$GNU_CC CFLAGS=$GNU_CFLAGS; export CC CFLAGS CPPFLAGS
741 test "$CC" = false && skip_all_ "GNU C compiler unavailable"
742 : For shells with busted 'set -e'.
745 CXX=$GNU_CXX CXXFLAGS=$GNU_CXXFLAGS; export CXX CXXFLAGS CPPFLAGS
746 test "$CXX" = false && skip_all_ "GNU C++ compiler unavailable"
747 : For shells with busted 'set -e'.
750 FC=$GNU_FC FCFLAGS=$GNU_FCFLAGS; export FC FCFLAGS
751 test "$FC" = false && skip_all_ "GNU Fortran compiler unavailable"
752 case " $required " in
754 *) F77=$FC FFLAGS=$FCFLAGS; export F77 FFLAGS;;
758 F77=$GNU_F77 FFLAGS=$GNU_FFLAGS; export F77 FFLAGS
759 test "$F77" = false && skip_all_ "GNU Fortran 77 compiler unavailable"
760 case " $required " in
762 *) FC=$F77 FCFLAGS=$FFLAGS; export FC FCFLAGS;;
766 # Check that grep can parse nonprinting characters correctly.
767 # BSD 'grep' works from a pipe, but not a seekable file.
768 # GNU or BSD 'grep -a' works on files, but is not portable.
769 case $(echo "$esc" | grep .)$(echo "$esc" | grep "$esc") in
771 *) skip_ "grep can't handle nonprinting characters correctly";;
775 # The Java compiler from JDK 1.5 (and presumably earlier versions)
776 # cannot handle the '-version' option by itself: it bails out
777 # telling that source files are missing. Adding also the '-help'
778 # option seems to solve the problem.
779 echo "$me: running javac -version -help"
780 javac -version -help || skip_all_ "Sun Java compiler not available"
783 # See the comments above about 'javac' for why we use also '-help'.
784 echo "$me: running java -version -help"
785 java -version -help || skip_all_ "Sun Java interpreter not found"
790 # Attempting to create an empty archive will actually not
791 # create the archive, but lib will output its version.
792 echo "$me: running $AR -out:defstest.lib"
793 $AR -out:defstest.lib \
794 || skip_all_ "Microsoft 'lib' utility not available"
797 echo "$me: running makedepend -f-"
799 || skip_all_ "required program 'makedepend' not available"
802 # Make sure we have makeinfo, and it understands '--html'.
803 echo "$me: running makeinfo --html --version"
804 makeinfo --html --version \
805 || skip_all_ "cannot find a makeinfo program that groks" \
806 "the '--html' option"
809 uname_s=$(uname -s || echo UNKNOWN)
810 echo "$me: system name: $uname_s"
813 *) skip_all_ "this test requires MSYS in MinGW mode" ;;
818 # Skip this test case if the user is root.
819 # We try to append to a read-only file to detect this.
820 priv_check_temp=priv-check.$$
821 touch $priv_check_temp && chmod a-w $priv_check_temp \
822 || framework_failure_ "creating unwritable file $priv_check_temp"
823 # Not a useless use of subshell: lesser shells like Solaris /bin/sh
824 # can exit if a builtin fails.
826 (echo foo >> $priv_check_temp) || overwrite_status=$?
827 rm -f $priv_check_temp
828 if test $overwrite_status -eq 0; then
829 skip_all_ "cannot drop file write permissions"
831 unset priv_check_temp overwrite_status
833 # Extra quoting required to avoid maintainer-check spurious failures.
835 if test "$WANT_NO_THREADS" = "yes"; then
836 skip_all_ "Devel::Cover cannot cope with threads"
840 # Don't use "&&" here, to avoid a bug of 'set -e' present in
841 # some (even relatively recent) versions of the BSD shell.
842 # We add the dummy "else" branch for extra safety.
843 ! cross_compiling || skip_all_ "doesn't work in cross-compile mode"
846 # Python doesn't support --version, it has -V
847 echo "$me: running python -V"
848 python -V || skip_all_ "python interpreter not available"
851 # Skip this test case if read-only directories aren't supported
853 ro_dir_temp=ro_dir.$$
854 mkdir $ro_dir_temp && chmod a-w $ro_dir_temp \
855 || framework_failure_ "creating unwritable directory $ro_dir_temp"
856 # Not a useless use of subshell: lesser shells like Solaris /bin/sh
857 # can exit if a builtin fails.
859 (: > $ro_dir_temp/probe) || create_status=$?
861 if test $create_status -eq 0; then
862 skip_all_ "cannot drop directory write permissions"
864 unset ro_dir_temp create_status
867 # DejaGnu's runtest program. We rely on being able to specify
868 # the program on the runtest command-line. This requires
869 # DejaGnu 1.4.3 or later.
870 echo "$me: running runtest SOMEPROGRAM=someprogram --version"
871 runtest SOMEPROGRAM=someprogram --version \
872 || skip_all_ "DejaGnu is not available"
875 # No all versions of Tex support '--version', so we use
877 if test -z "$TEX"; then
878 skip_all_ "TeX is required, but it wasn't found by configure"
882 # Texi2dvi supports '-o' since Texinfo 4.1.
883 echo "$me: running texi2dvi -o /dev/null --version"
884 texi2dvi -o /dev/null --version \
885 || skip_all_ "required program 'texi2dvi' not available"
888 test x"$LEX" = x"false" && skip_all_ "lex not found or disabled"
892 test x"$YACC" = x"false" && skip_all_ "yacc not found or disabled"
897 echo "$me: running flex --version"
898 flex --version || skip_all_ "required program 'flex' not available"
901 YACC='bison -y'; export YACC
902 echo "$me: running bison --version"
903 bison --version || skip_all_ "required program 'bison' not available"
906 # Generic case: the tool must support --version.
907 echo "$me: running $tool --version"
908 # It is not likely but possible that $tool is a special builtin,
909 # in which case the shell is allowed to exit after an error. So
910 # we need the subshell here. Also, some tools, like Sun cscope,
911 # can be interactive without redirection.
912 ($tool --version) </dev/null \
913 || skip_all_ "required program '$tool' not available"
918 # We might need extra macros, e.g., from Libtool or Gettext.
919 case " $required " in *\ libtool*) . ./t/libtool-macros.dir/get.sh;; esac
920 case " $required " in *\ gettext*) . ./t/gettext-macros.dir/get.sh;; esac
923 ## ---------------------------------------------------------------- ##
924 ## Create and set up of the temporary directory used by the test. ##
925 ## Set up of the exit trap for cleanup of said directory. ##
926 ## ---------------------------------------------------------------- ##
928 # This might be used in testcases checking distribution-related features.
929 # Test scripts are free to override this if they need to.
932 # Set up the exit trap.
935 cd "$am_top_builddir"
936 if test $am_using_tap = yes; then
937 if test "$planned_" = later && test $exit_status -eq 0; then
940 test $exit_status -eq 0 && test $tap_pass_count_ -eq $tap_count_ \
943 # This is to ensure that a test script does give a SKIP outcome just
944 # because a command in it happens to exit with status 77. This
945 # behaviour, while from time to time useful to developers, is not
946 # meant to be enabled by default, as it could cause spurious failures
947 # in the wild. Thus it will be enabled only when the variable
948 # "am_explicit_skips" is set to a "true" value.
949 case $am_explicit_skips in
951 if test $exit_status -eq 77 && test $am__test_skipped != yes; then
952 echo "$me: implicit skip turned into failure"
956 test $exit_status -eq 0 || keep_testdirs=yes
958 am_keeping_testdirs || rm_rf_ $testSubDir
960 echo "$me: exit $exit_status"
961 # Spurious escaping to ensure we do not call our "exit" alias.
964 trap "fatal_ 'caught signal SIGHUP'" 1
965 trap "fatal_ 'caught signal SIGINT'" 2
966 trap "fatal_ 'caught signal SIGTERM'" 15
967 # Various shells seems to just ignore SIGQUIT under some circumstances,
968 # even if the signal is not blocked; however, if the signal it trapped,
969 # the trap gets correctly executed. So we also trap SIGQUIT.
970 # Here is a list of some shells that have been verified to exhibit the
971 # problematic behavior with SIGQUIT:
972 # - zsh 4.3.12 on Debian GNU/Linux
973 # - /bin/ksh and /usr/xpg4/bin/sh on Solaris 10
974 # - Bash 3.2.51 on Solaris 10 and bash 4.1.5 on Debian GNU/Linux
975 # - AT&T ksh on Debian Gnu/Linux (deb package ksh, version 93u-1)
976 # OTOH, at least these shells that do *not* exhibit that behaviour:
977 # - modern version of the Almquist Shell (at least 0.5.5.1), on
978 # both Solaris and GNU/Linux
979 # - Solaris 10 /bin/sh
980 # - public domain Korn Shell, version 5.2.14, on Debian GNU/Linux
981 trap "fatal_ 'caught signal SIGQUIT'" 3
982 # Ignore further SIGPIPE in the trap code. This is required to avoid
983 # a very weird issue with some shells, at least when the execution of
984 # the automake testsuite is driven by the 'prove' utility: if prove
985 # (or the make process that has spawned it) gets interrupted with
986 # Ctrl-C, the shell might go in a loop, continually getting a SIGPIPE,
987 # sometimes finally dumping core, other times hanging indefinitely.
988 # See also Test::Harness bug [rt.cpan.org #70855], archived at
989 # <https://rt.cpan.org/Ticket/Display.html?id=70855>
990 trap "trap '' 13; fatal_ 'caught signal SIGPIPE'" 13
992 # Create and populate the temporary directory, if and as required.
993 if test x"$am_create_testdir" = x"no"; then
996 # The subdirectory where the current test script will run and write its
997 # temporary/data files. This will be created shortly, and will be removed
998 # by the cleanup trap below if the test passes. If the test doesn't pass,
999 # this directory will be kept, to facilitate debugging.
1000 testSubDir=t/$me.dir
1001 test ! -d $testSubDir || rm_rf_ $testSubDir \
1002 || framework_failure_ "removing old test subdirectory"
1003 test -d t || mkdir t
1005 || framework_failure_ "creating test subdirectory"
1006 # The trailing './'ris to avoid CDPATH issues.
1008 || framework_failure_ "cannot chdir into test subdirectory"
1009 if test x"$am_create_testdir" != x"empty"; then
1010 cp "$am_scriptdir"/install-sh "$am_scriptdir"/missing \
1011 "$am_scriptdir"/depcomp . \
1012 || framework_failure_ "fetching common files from $am_scriptdir"
1013 # Build appropriate environment in test directory. E.g., create
1014 # configure.ac, touch all necessary files, etc. Don't use AC_OUTPUT,
1015 # but AC_CONFIG_FILES so that appending still produces a valid
1016 # configure.ac. But then, tests running config.status really need
1017 # to append AC_OUTPUT.
1019 echo "AC_INIT([$me], [1.0])"
1020 if test x"$am_serial_tests" = x"yes"; then
1021 echo "AM_INIT_AUTOMAKE"
1023 echo "AM_INIT_AUTOMAKE([parallel-tests])"
1025 echo "AC_CONFIG_FILES([Makefile])"
1026 } >configure.ac || framework_failure_ "creating configure.ac skeleton"
1031 ## ---------------- ##
1032 ## Ready to go... ##
1033 ## ---------------- ##