maint: update copyright year for 2013 (in branch maint)
[platform/upstream/automake.git] / t / ax / test-lib.sh
index 60ffd98..81f9170 100644 (file)
@@ -1,6 +1,6 @@
 # -*- shell-script -*-
 #
-# Copyright (C) 1996-2012 Free Software Foundation, Inc.
+# Copyright (C) 1996-2013 Free Software Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 ###  IMPORTANT NOTE: keep this file 'set -e' clean.  ###
 ########################################################
 
+# Do not source several times.
+test ${test_lib_sourced-no} = yes && return 0
+test_lib_sourced=yes
+
 # CDPATH is evil if used in non-interactive scripts (and even more
 # evil if exported in the environment).
 CDPATH=; unset CDPATH
@@ -47,9 +51,11 @@ if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
   }
 else
   argv0=$0
-  # Avoid command substitution failure, for it might cause problems with
-  # "set -e" on some shells.
-  case `(set -o) 2>/dev/null || :` in *posix*) set -o posix;; esac
+  # Ignore command substitution failure, for it might cause problems
+  # with "set -e" on some shells.
+  am_shell_opts=$(set -o) || :
+  case $am_shell_opts in *posix*) set -o posix;; esac
+  unset am_shell_opts
 fi
 
 # A single whitespace character.
@@ -121,7 +127,7 @@ framework_failure_ () { warn_ "$me: set-up failure: $@"; exit 99; }
 # For compatibility with TAP functions.
 skip_all_ () { skip_ "$@"; }
 
-if test $am_using_tap = yes; then
+if test $am_test_protocol = tap; then
   . tap-functions.sh
 fi
 
@@ -216,7 +222,7 @@ am_exit_trap ()
   exit_status=$1
   set +e
   cd "$am_top_builddir"
-  if test $am_using_tap = yes; then
+  if test $am_test_protocol = tap; then
     if test "$planned_" = later && test $exit_status -eq 0; then
       plan_ "now"
     fi