From 5acbeb9666ca0534cb1a46d9ed1c9d26521500f2 Mon Sep 17 00:00:00 2001 From: Robin McCorkell Date: Wed, 28 Jan 2015 15:06:18 +0000 Subject: Better cleanup in autotest.sh Configs correctly cleaned, even if phpunit fails or autotest interrupted --- autotest-hhvm.sh | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'autotest-hhvm.sh') diff --git a/autotest-hhvm.sh b/autotest-hhvm.sh index 4d8efa5a4b8..bf96a5133a6 100755 --- a/autotest-hhvm.sh +++ b/autotest-hhvm.sh @@ -66,20 +66,25 @@ if [ "$1" ]; then fi fi -# Back up existing (dev) config if one exists -if [ -f config/config.php ]; then +# Back up existing (dev) config if one exists and backup not already there +if [ -f config/config.php ] && [ ! -f config/config-autotest-backup.php ]; then mv config/config.php config/config-autotest-backup.php fi -function restore_config { +function cleanup_config { + cd "$BASEDIR" # Restore existing config if [ -f config/config-autotest-backup.php ]; then mv config/config-autotest-backup.php config/config.php fi + # Remove autotest config + if [ -f config/autoconfig.php ]; then + rm config/autoconfig.php + fi } -# restore config on exit, even when killed -trap restore_config SIGINT SIGTERM +# restore config on exit +trap cleanup_config EXIT # use tmpfs for datadir - should speedup unit test execution if [ -d /dev/shm ]; then @@ -236,9 +241,6 @@ else execute_tests "$1" "$2" "$3" fi -cd "$BASEDIR" - -restore_config # # NOTES on mysql: # - CREATE DATABASE oc_autotest; -- cgit v1.2.3