summaryrefslogtreecommitdiff
path: root/tests/libtest.sh
diff options
context:
space:
mode:
authorRuss Allbery <rra@stanford.edu>2010-02-21 17:45:55 -0800
committerRuss Allbery <rra@stanford.edu>2010-02-21 17:45:55 -0800
commit60210334fa3dbd5dd168199063c6ee850d750d0c (patch)
tree31e832ba6788076075d38e20ffd27ebf09430407 /tests/libtest.sh
parente571a8eb96f42de5a114cf11ff1c3d63e5a8d301 (diff)
Imported Upstream version 0.10
Diffstat (limited to 'tests/libtest.sh')
-rw-r--r--tests/libtest.sh82
1 files changed, 0 insertions, 82 deletions
diff --git a/tests/libtest.sh b/tests/libtest.sh
deleted file mode 100644
index ed46d0e..0000000
--- a/tests/libtest.sh
+++ /dev/null
@@ -1,82 +0,0 @@
-# $Id$
-#
-# Shell function library for test cases.
-#
-# Written by Russ Allbery <rra@stanford.edu>
-# Copyright 2006, 2007, 2008 Board of Trustees, Leland Stanford Jr. University
-#
-# See LICENSE for licensing terms.
-
-# The count starts at 1 and is updated each time ok is printed. printcount
-# takes "ok" or "not ok".
-count=1
-printcount () {
- echo "$1 $count $2"
- count=`expr $count + 1`
-}
-
-# Run a program expected to succeed, and print ok if it does and produces
-# the correct output. Takes the output as the first argument, the command to
-# run as the second argument, and then all subsequent arguments are arguments
-# to the command.
-runsuccess () {
- w_output="$1"
- shift
- output=`"$@" 2>&1`
- status=$?
- if [ $status = 0 ] && [ x"$output" = x"$w_output" ] ; then
- printcount 'ok'
- else
- printcount 'not ok'
- echo " saw: $output"
- echo " not: $w_output"
- fi
-}
-
-# Run a program expected to fail and make sure it fails with the correct exit
-# status and the correct failure message. Takes the expected status, the
-# expected output, and then everything else is the command and arguments.
-# Strip the second colon and everything after it off the error message since
-# it's system-specific.
-runfailure () {
- w_status="$1"
- shift
- w_output="$1"
- shift
- output=`"$@" 2>&1`
- status=$?
- output=`echo "$output" | sed 's/\(:[^:]*\):.*/\1/'`
- if [ $status = $w_status ] && [ x"$output" = x"$w_output" ] ; then
- printcount 'ok'
- else
- printcount 'not ok'
- echo " saw: ($status) $output"
- echo " not: ($w_status) $w_output"
- fi
-}
-
-# Skip tests from $1 to $2 inclusive with reason $3.
-skip () {
- n="$1"
- while [ "$n" -le "$2" ] ; do
- echo ok "$n # skip $3"
- n=`expr "$n" + 1`
- done
-}
-
-# Given a file name or relative file path, try to cd to the correct directory
-# so that the relative file path is valid. Exits with an error if that isn't
-# possible.
-chdir_data () {
- if [ -f "../$1" ] ; then
- cd ..
- else
- if [ -f "tests/$1" ] ; then
- cd tests
- fi
- fi
- if [ ! -f "$1" ] ; then
- echo "Cannot locate $1" >&2
- exit 1
- fi
-}