summaryrefslogtreecommitdiffstats
path: root/autotest.sh
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2013-10-03 12:53:13 +0200
committerVincent Petry <pvince81@owncloud.com>2013-10-03 12:53:13 +0200
commit9cf25c8048c56050594d39b9a37be60e2e37bb54 (patch)
tree1da282d9967f644551d6e0c685e224406e6f9372 /autotest.sh
parentde175a4b0f0971c9cbbf912bbc3fd8cbc190b53d (diff)
downloadnextcloud-server-9cf25c8048c56050594d39b9a37be60e2e37bb54.tar.gz
nextcloud-server-9cf25c8048c56050594d39b9a37be60e2e37bb54.zip
Added backup for config.php in autotest.sh script
The script now checks for config.php existance and backs it up before running the test, then restores it back at the end. This avoids the situation where devs lose their manually edited config if they forgot to back it up before running the unit tests. The script now also checks for config.php permissions beforehand to avoid displaying an annoying HTML page output in the console with an error message.
Diffstat (limited to 'autotest.sh')
-rwxr-xr-xautotest.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/autotest.sh b/autotest.sh
index 83f184fa9c0..3831e181245 100755
--- a/autotest.sh
+++ b/autotest.sh
@@ -12,6 +12,16 @@ DATABASEUSER=oc_autotest$EXECUTOR_NUMBER
ADMINLOGIN=admin$EXECUTOR_NUMBER
BASEDIR=$PWD
+if ! [ -w config -a -w config/config.php ]; then
+ echo "Please enable write permissions on config and config/config.php" >&2
+ exit 1
+fi
+
+# Back up existing (dev) config if one exists
+if [ -f config/config.php ]; then
+ mv config/config.php config/config-autotest-backup.php
+fi
+
# use tmpfs for datadir - should speedup unit test execution
if [ -d /dev/shm ]; then
DATADIR=/dev/shm/data-autotest$EXECUTOR_NUMBER
@@ -158,6 +168,13 @@ else
execute_tests $1 $2 $3
fi
+cd $BASEDIR
+
+# Restore existing config
+if [ -f config/config-autotest-backup.php ]; then
+ mv config/config-autotest-backup.php config/config.php
+fi
+
#
# NOTES on mysql:
# - CREATE DATABASE oc_autotest;