summaryrefslogtreecommitdiffstats
path: root/run-tests.sh
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2015-02-08 11:11:00 +0100
committerFlorian Pritz <bluewind@xinu.at>2015-02-08 11:11:00 +0100
commit0d2a97c67e361c41434f1cf855f4bd26a891340b (patch)
treed304f9bb1ca4615e3163d11c069dbd2e23e81caa /run-tests.sh
parent16e3e00a8020815cc0a7f6bdb9807900721ef22a (diff)
run-tests.sh: use trap to clean up
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'run-tests.sh')
-rwxr-xr-xrun-tests.sh13
1 files changed, 8 insertions, 5 deletions
diff --git a/run-tests.sh b/run-tests.sh
index e54d08b4b..38f21f3c3 100755
--- a/run-tests.sh
+++ b/run-tests.sh
@@ -26,6 +26,14 @@ test -d application || exit 1
test -f run-tests.sh || exit 1
# prepare
+trap cleanup EXIT INT
+cleanup() {
+ if ((use_php_dev_server)); then
+ kill $server_pid
+ fi
+ rm -f $startdir/application/config/database-testsuite.php
+}
+
cat <<EOF >application/config/database-testsuite.php || exit 1
<?php
\$db['default']['dbprefix'] = "testsuite-prefix-";
@@ -51,8 +59,3 @@ php index.php tools update_database
prove --state=hot,slow,save --timer -ve "php index.php tools test $url" "${tests[@]}"
php index.php tools drop_all_tables_using_prefix
-# cleanup
-if ((use_php_dev_server)); then
- kill $server_pid
-fi
-rm -f $startdir/application/config/database-testsuite.php