summaryrefslogtreecommitdiffstats
path: root/build/prepareTests.sh
diff options
context:
space:
mode:
authorMorris Jobke <morris.jobke@gmail.com>2014-06-06 09:29:01 +0200
committerMorris Jobke <hey@morrisjobke.de>2014-08-05 16:53:27 +0200
commit472d896ce9aad4d526126a7aefa96127920585e6 (patch)
tree2d2ba785bfbf43f4de2db732593622322ed4229a /build/prepareTests.sh
parent892d82480430b3c8d8e47feaa4f903922deec27e (diff)
downloadnextcloud-server-472d896ce9aad4d526126a7aefa96127920585e6.tar.gz
nextcloud-server-472d896ce9aad4d526126a7aefa96127920585e6.zip
Travis support
* use PHPUnit 4.x * force php memory limit on travis to 1024MB * create script for travis * whitelist branches master, stable5 and stable6 on travis (and PRs) * sqlplus64 * conditional JS tests and ocular temporal removal * enable scrutinizer code coverage * move oracle to top to decrease overall test duration
Diffstat (limited to 'build/prepareTests.sh')
-rwxr-xr-xbuild/prepareTests.sh141
1 files changed, 141 insertions, 0 deletions
diff --git a/build/prepareTests.sh b/build/prepareTests.sh
new file mode 100755
index 00000000000..84bbfd40f6d
--- /dev/null
+++ b/build/prepareTests.sh
@@ -0,0 +1,141 @@
+#!/bin/bash
+#
+# ownCloud
+#
+# @author Thomas Müller
+# @author Morris Jobke
+# @copyright 2012, 2013 Thomas Müller thomas.mueller@tmit.eu
+# @copyright 2014 Morris Jobke hey@morrisjobke.de
+#
+
+DATABASENAME=oc_autotest
+DATABASEUSER=oc_autotest
+ADMINLOGIN=admin
+BASEDIR=$PWD
+
+# check for database parameter
+if [ $1 ]; then
+ DBCONFIGS="sqlite mysql pgsql oracle"
+ FOUND=0
+ for DBCONFIG in $DBCONFIGS; do
+ if [ $1 = $DBCONFIG ]; then
+ FOUND=1
+ break
+ fi
+ done
+ if [ $FOUND = 0 ]; then
+ echo -e "Unknown database config name \"$1\"\n" >&2
+ exit 2
+ fi
+else
+ echo "Please pass in a database to use as first parameter" >&2
+ exit 1
+fi
+
+# check if config dir and file is writable
+if ! [[ -w config && ( !( -e config/config.php ) || -w config/config.php ) ]]; then
+ echo "Please enable write permissions on config and config/config.php" >&2
+ exit 1
+fi
+
+# use tmpfs for datadir - should speedup unit test execution
+if [ -d /dev/shm ]; then
+ DATADIR=/dev/shm/data-autotest
+else
+ DATADIR=$BASEDIR/data-autotest
+fi
+
+echo "Setup environment for $1 testing ..."
+# revert changes to tests/data
+git checkout tests/data/*
+
+# reset data directory
+rm -rf $DATADIR
+mkdir $DATADIR
+
+cp tests/preseed-config.php config/config.php
+
+# # # # # #
+# SQLite #
+# # # # # #
+if [ "$1" == "sqlite" ] ; then
+ cat > ./config/autoconfig.php <<DELIM
+<?php
+\$AUTOCONFIG = array (
+ 'installed' => false,
+ 'dbtype' => 'sqlite',
+ 'dbtableprefix' => 'oc_',
+ 'adminlogin' => '$ADMINLOGIN',
+ 'adminpass' => 'admin',
+ 'directory' => '$DATADIR',
+);
+DELIM
+fi
+
+# # # # #
+# MySQL #
+# # # # #
+if [ "$1" == "mysql" ] ; then
+ cat > ./config/autoconfig.php <<DELIM
+<?php
+\$AUTOCONFIG = array (
+ 'installed' => false,
+ 'dbtype' => 'mysql',
+ 'dbtableprefix' => 'oc_',
+ 'adminlogin' => '$ADMINLOGIN',
+ 'adminpass' => 'admin',
+ 'directory' => '$DATADIR',
+ 'dbuser' => '$DATABASEUSER',
+ 'dbname' => '$DATABASENAME',
+ 'dbhost' => 'localhost',
+ 'dbpass' => 'owncloud',
+);
+DELIM
+fi
+
+# # # # # # # #
+# PostgreSQL #
+# # # # # # # #
+if [ "$1" == "pgsql" ] ; then
+ cat > ./config/autoconfig.php <<DELIM
+<?php
+\$AUTOCONFIG = array (
+ 'installed' => false,
+ 'dbtype' => 'pgsql',
+ 'dbtableprefix' => 'oc_',
+ 'adminlogin' => '$ADMINLOGIN',
+ 'adminpass' => 'admin',
+ 'directory' => '$DATADIR',
+ 'dbuser' => '$DATABASEUSER',
+ 'dbname' => '$DATABASENAME',
+ 'dbhost' => 'localhost',
+ 'dbpass' => 'owncloud',
+);
+DELIM
+
+fi
+
+# # # # # #
+# Oracle #
+# # # # # #
+if [ "$1" == "oracle" ] ; then
+ build/prepareTestsOracle.sh $DATABASENAME $DATABASEUSER $ADMINLOGIN $DATADIR
+fi
+
+echo "Trigger ownCloud installation"
+php -f index.php | grep -i -C9999 error && echo "Error during setup" && exit 101
+
+echo "Enable apps ..."
+cd tests
+php -f enable_all.php | grep -i -C9999 error && echo "Error during setup" && exit 101
+cd $BASEDIR
+
+# show environment
+echo "ownCloud configuration:"
+cat $BASEDIR/config/config.php
+
+echo "ownCloud data directory:"
+ls -ll $DATADIR
+
+echo "owncloud.log:"
+cat $DATADIR/owncloud.log