aboutsummaryrefslogtreecommitdiff
path: root/paludis
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-03-27 16:45:54 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-03-27 16:45:54 +0100
commit6b1f92a04fd2b6cfae9fd6a7df4204e4a21d7966 (patch)
tree7ebcd7235b7daf406d7b7cf0e2e6a7fa0a168e42 /paludis
parent58b0c87ae639014fdb70ed6d8b9c4af2f83b92ae (diff)
downloadpaludis-6b1f92a04fd2b6cfae9fd6a7df4204e4a21d7966.tar.gz
paludis-6b1f92a04fd2b6cfae9fd6a7df4204e4a21d7966.tar.xz
Kill old test framework
Diffstat (limited to 'paludis')
-rw-r--r--paludis/util/run_test.sh60
1 files changed, 60 insertions, 0 deletions
diff --git a/paludis/util/run_test.sh b/paludis/util/run_test.sh
new file mode 100644
index 000000000..4a428add2
--- /dev/null
+++ b/paludis/util/run_test.sh
@@ -0,0 +1,60 @@
+#!/usr/bin/env bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+testname=${2:-${1}}
+interp=
+[[ ${testname%.py} != ${testname} ]] && interp="${PYTHON}"
+[[ ${testname%.rb} != ${testname} ]] && interp="${RUBY} -I ./.libs/"
+
+testname=${testname%.rb}
+testname=${testname%.py}
+testname=${testname%.bash}
+
+export PALUDIS_TEST_PROGRAM=$testname
+
+if test -f "$TEST_SCRIPT_DIR""${testname}"_"cleanup.sh" ; then
+ echo ">>> cleanup for test ${testname}"
+ if ! "$TEST_SCRIPT_DIR""${testname}"_"cleanup.sh" ; then
+ echo ">>> exiting with error for test ${testname}"
+ exit 255
+ fi
+else
+ echo ">>> No $TEST_SCRIPT_DIR${testname}_cleanup.sh to run"
+fi
+
+if test -f "$TEST_SCRIPT_DIR""${testname}"_"setup.sh" ; then
+ echo ">>> setup for test ${testname}"
+ if ! "$TEST_SCRIPT_DIR""${testname}"_"setup.sh" ; then
+ echo ">>> exiting with error for test ${testname}"
+ exit 255
+ fi
+else
+ echo ">>> No $TEST_SCRIPT_DIR${testname}_setup.sh to run"
+fi
+
+now=$(date +'%s' )
+echo ">>> test ${testname}"
+$interp ${@}
+code=$?
+duration=$(( $(date +'%s' ) - ${now} ))
+
+if [[ 0 != ${code} ]] ; then
+ echo ">>> test ${testname} returned ${code} [${duration}s]"
+ echo ">>> exiting with error for test ${testname}"
+ exit 255
+fi
+
+if test -f "$TEST_SCRIPT_DIR""${testname}"_"cleanup.sh" ; then
+ echo ">>> cleanup for test ${testname}"
+ if ! "$TEST_SCRIPT_DIR""${testname}"_"cleanup.sh" ; then
+ echo ">>> exiting with error for test ${testname}"
+ exit 255
+ fi
+else
+ echo ">>> No $TEST_SCRIPT_DIR${testname}_cleanup.sh to run"
+fi
+
+echo ">>> exiting with success for test ${testname} [${duration}s]"
+exit 0
+
+