Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-08-20 00:46:24 +0400
committerVincent Petry <pvince81@owncloud.com>2014-08-20 00:46:24 +0400
commit6ed174d0e41bc01d9f6b854e634ab6132788bf85 (patch)
treece5e65b4565a3d9cb29096651c3b4123ada5ca75 /autotest.sh
parent1b81cc1acd1686a4f6efb20f27f085997d99a429 (diff)
Restore autotest config on SIGINT or SIGTERM
When hitting Ctrl+C to interrupt unit test running, the old configuration was not restored properly. This fix traps the signal to properly restore the configuration after an interruption.
Diffstat (limited to 'autotest.sh')
-rwxr-xr-xautotest.sh16
1 files changed, 11 insertions, 5 deletions
diff --git a/autotest.sh b/autotest.sh
index 4030fc0250e..d359aed91e7 100755
--- a/autotest.sh
+++ b/autotest.sh
@@ -63,6 +63,16 @@ if [ -f config/config.php ]; then
mv config/config.php config/config-autotest-backup.php
fi
+function restore_config {
+ # Restore existing config
+ if [ -f config/config-autotest-backup.php ]; then
+ mv config/config-autotest-backup.php config/config.php
+ fi
+}
+
+# restore config on exit, even when killed
+trap restore_config SIGINT SIGTERM
+
# use tmpfs for datadir - should speedup unit test execution
if [ -d /dev/shm ]; then
DATADIR=/dev/shm/data-autotest$EXECUTOR_NUMBER
@@ -220,11 +230,7 @@ fi
cd $BASEDIR
-# Restore existing config
-if [ -f config/config-autotest-backup.php ]; then
- mv config/config-autotest-backup.php config/config.php
-fi
-
+restore_config
#
# NOTES on mysql:
# - CREATE DATABASE oc_autotest;