aboutsummaryrefslogtreecommitdiff
path: root/contrib/shunit2-2.0.3/src/test/run-test-suite
diff options
context:
space:
mode:
authorPjotr Prins2017-08-20 09:22:43 +0000
committerPjotr Prins2017-08-20 09:22:43 +0000
commit2e76646998df0ca1b7d160329c0f3ac8cdda2fe0 (patch)
tree8a1ba0770e2344469c58290d4192db186d9439cb /contrib/shunit2-2.0.3/src/test/run-test-suite
parent7fc4e3c0a0d6e32ca6685647e107473f1d96c3e5 (diff)
downloadpangemma-2e76646998df0ca1b7d160329c0f3ac8cdda2fe0.tar.gz
Move shunit2 into ./contrib and add catch-1.8.7
Diffstat (limited to 'contrib/shunit2-2.0.3/src/test/run-test-suite')
-rwxr-xr-xcontrib/shunit2-2.0.3/src/test/run-test-suite116
1 files changed, 116 insertions, 0 deletions
diff --git a/contrib/shunit2-2.0.3/src/test/run-test-suite b/contrib/shunit2-2.0.3/src/test/run-test-suite
new file mode 100755
index 0000000..7791fa1
--- /dev/null
+++ b/contrib/shunit2-2.0.3/src/test/run-test-suite
@@ -0,0 +1,116 @@
+#! /bin/sh
+# $Id: run-test-suite 432 2007-01-05 14:58:37Z sfsetse $
+
+MY_NAME=`basename $0`
+MY_PATH=`dirname $0`
+
+SHELLS='/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh'
+for f in test[A-Z]*; do
+ [ -x "${f}" ] && TESTS="${TESTS:+${TESTS} }${f}"
+done
+
+# load common unit test functions
+. "${MY_PATH}/test-functions.inc"
+
+usage()
+{
+ echo "usage: ${MY_NAME} [-e key=val ...] [-s shell(s)] [-t test(s)]"
+}
+
+# process command line flags
+while getopts 'e:hs:t:' opt; do
+ case ${opt} in
+ e)
+ key=`expr "${OPTARG}" : '\([^=]*\)='`
+ val=`expr "${OPTARG}" : '[^=]*=\(.*\)'`
+ if [ -z "${key}" -o -z "${val}" ]; then
+ usage
+ exit 1
+ fi
+ eval "${key}='${val}'"
+ export ${key}
+ env="${env:+${env} }${key}"
+ ;;
+ h) usage; exit 0 ;;
+ s) shells=${OPTARG} ;;
+ t) tests=${OPTARG} ;;
+ *) usage; exit 1 ;;
+ esac
+done
+shift `expr ${OPTIND} - 1`
+
+# fill shells and/or tests
+shells=${shells:-${SHELLS}}
+tests=${tests:-${TESTS}}
+
+# error checking
+if [ -z "${tests}" ]; then
+ tf_error 'no tests found to run; exiting'
+ exit 1
+fi
+
+cat <<EOF
+#------------------------------------------------------------------------------
+# System data
+#
+
+# test run info
+shells="${shells}"
+tests="${tests}"
+EOF
+for key in ${env}; do
+ eval "echo \"${key}=\$${key}\""
+done
+echo
+
+# output system data
+echo "# system info"
+echo "$ date"
+date
+
+echo "$ uname -mprsv"
+uname -mprsv
+
+#
+# run tests
+#
+
+for shell in ${shells}; do
+ echo
+
+ # check for existence of shell
+ if [ ! -x ${shell} ]; then
+ tf_warn "unable to run tests with the ${shell} shell"
+ continue
+ fi
+
+ cat <<EOF
+
+#------------------------------------------------------------------------------
+# Running the test suite with ${shell}
+#
+EOF
+
+ case `basename ${shell}` in
+ bash) echo; ${shell} --version; ;;
+ dash) ;;
+ ksh)
+ version=`${shell} --version exit 2>&1`
+ exitVal=$?
+ if [ ${exitVal} -eq 2 ]; then
+ echo
+ echo "${version}"
+ fi
+ ;;
+ pdksh) ;;
+ zsh) ;;
+ esac
+
+ # execute the tests
+ for suite in ${tests}; do
+ suiteName=`expr "${suite}" : 'test\(.*\)'`
+ echo
+ echo "--- Executing the '${suiteName}' test suite ---" >&2
+ ( exec ${shell} ./${suite}; )
+ done
+done