summaryrefslogtreecommitdiff
path: root/tests/tap/libtap.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/tap/libtap.sh')
-rw-r--r--tests/tap/libtap.sh32
1 files changed, 31 insertions, 1 deletions
diff --git a/tests/tap/libtap.sh b/tests/tap/libtap.sh
index 1846840..a9b46d4 100644
--- a/tests/tap/libtap.sh
+++ b/tests/tap/libtap.sh
@@ -1,7 +1,7 @@
# Shell function library for test cases.
#
# Written by Russ Allbery <rra@stanford.edu>
-# Copyright 2009 Russ Allbery <rra@stanford.edu>
+# Copyright 2009, 2010 Russ Allbery <rra@stanford.edu>
# Copyright 2006, 2007, 2008 Board of Trustees, Leland Stanford Jr. University
#
# See LICENSE for licensing terms.
@@ -15,10 +15,22 @@ plan () {
trap finish 0
}
+# Prepare for lazy planning.
+plan_lazy () {
+ count=1
+ planned=0
+ failed=0
+ trap finish 0
+}
+
# Report the test status on exit.
finish () {
local highest looks
highest=`expr "$count" - 1`
+ if [ "$planned" = 0 ] ; then
+ echo "1..$highest"
+ planned="$highest"
+ fi
looks='# Looks like you'
if [ "$planned" -gt 0 ] ; then
if [ "$planned" -gt "$highest" ] ; then
@@ -146,3 +158,21 @@ bail () {
echo 'Bail out!' "$@"
exit 1
}
+
+# Output a diagnostic on standard error, preceded by the required # mark.
+diag () {
+ echo '#' "$@"
+}
+
+# Search for the given file first in $BUILD and then in $SOURCE and echo the
+# path where the file was found, or the empty string if the file wasn't
+# found.
+test_file_path () {
+ if [ -f "$BUILD/$1" ] ; then
+ echo "$BUILD/$1"
+ elif [ -f "$SOURCE/$1" ] ; then
+ echo "$SOURCE/$1"
+ else
+ echo ''
+ fi
+}