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:
authorThomas Müller <thomas.mueller@tmit.eu>2015-10-27 18:09:13 +0300
committerThomas Müller <thomas.mueller@tmit.eu>2015-10-28 01:00:04 +0300
commitb753e7631bd318a1f428d8925dec64693879fd0d (patch)
treef02f3ace2f9958f7068cd2a37ed52a8697e0d1f0 /tests/travis
parent4d87276f4be55419189fb23d3c3c13f00c19f006 (diff)
Enable DAV app testing on travis
Diffstat (limited to 'tests/travis')
-rw-r--r--tests/travis/before_install.sh40
-rw-r--r--tests/travis/custom.ini4
-rwxr-xr-xtests/travis/install.sh180
3 files changed, 224 insertions, 0 deletions
diff --git a/tests/travis/before_install.sh b/tests/travis/before_install.sh
new file mode 100644
index 00000000000..ee8c3a9862a
--- /dev/null
+++ b/tests/travis/before_install.sh
@@ -0,0 +1,40 @@
+#!/bin/bash
+#
+# ownCloud
+#
+# @author Thomas Müller
+# @copyright 2014 Thomas Müller thomas.mueller@tmit.eu
+#
+
+set -e
+
+WORKDIR=$PWD
+DB=$1
+echo "Work directory: $WORKDIR"
+echo "Database: $DB"
+
+if [ "$DB" == "mysql" ] ; then
+ echo "Setting up mysql ..."
+ mysql -e 'create database oc_autotest;'
+ mysql -u root -e "CREATE USER 'oc_autotest'@'localhost' IDENTIFIED BY 'owncloud'";
+ mysql -u root -e "grant all on oc_autotest.* to 'oc_autotest'@'localhost'";
+ mysql -e "SELECT User FROM mysql.user;"
+fi
+
+if [ "$DB" == "pgsql" ] ; then
+ createuser -U travis -s oc_autotest
+fi
+
+#if [ "$DB" == "oracle" ] ; then
+# if [ ! -f before_install_oracle.sh ]; then
+# wget https://raw.githubusercontent.com/owncloud/administration/master/travis-ci/before_install_oracle.sh
+# fi
+# bash ./before_install_oracle.sh
+#fi
+
+#
+# copy custom php.ini settings
+#
+if [ $(phpenv version-name) != 'hhvm' ]; then
+ phpenv config-add tests/travis/custom.ini
+fi
diff --git a/tests/travis/custom.ini b/tests/travis/custom.ini
new file mode 100644
index 00000000000..7a2c0aab426
--- /dev/null
+++ b/tests/travis/custom.ini
@@ -0,0 +1,4 @@
+always_populate_raw_post_data = -1
+mbstring.func_overload = 0
+default_charset = 'UTF-8'
+output_buffering = off
diff --git a/tests/travis/install.sh b/tests/travis/install.sh
new file mode 100755
index 00000000000..fe7907f798c
--- /dev/null
+++ b/tests/travis/install.sh
@@ -0,0 +1,180 @@
+#!/bin/bash
+#
+# ownCloud
+#
+# @author Thomas Müller
+# @copyright 2014 Thomas Müller thomas.mueller@tmit.eu
+#
+
+set -e
+
+DATABASENAME=oc_autotest
+DATABASEUSER=oc_autotest
+ADMINLOGIN=admin
+BASEDIR=$PWD
+
+DBCONFIGS="sqlite mysql pgsql oracle"
+PHPUNIT=$(which phpunit)
+
+# set oracle home if it is not set
+TRAVIS_ORACLE_HOME="/usr/lib/oracle/xe/app/oracle/product/10.2.0/server"
+[ -z "$ORACLE_HOME" ] && ORACLE_HOME=$TRAVIS_ORACLE_HOME
+
+if [ $1 ]; then
+ 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
+ print_syntax
+ exit 2
+ fi
+fi
+
+# use tmpfs for datadir - should speedup unit test execution
+DATADIR=$BASEDIR/data-autotest
+
+echo "Using database $DATABASENAME"
+
+# create autoconfig for sqlite, mysql and postgresql
+cat > ./tests/autoconfig-sqlite.php <<DELIM
+<?php
+\$AUTOCONFIG = array (
+ 'installed' => false,
+ 'dbtype' => 'sqlite',
+ 'dbtableprefix' => 'oc_',
+ 'adminlogin' => '$ADMINLOGIN',
+ 'adminpass' => 'admin',
+ 'directory' => '$DATADIR',
+);
+DELIM
+
+cat > ./tests/autoconfig-mysql.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
+
+cat > ./tests/autoconfig-pgsql.php <<DELIM
+<?php
+\$AUTOCONFIG = array (
+ 'installed' => false,
+ 'dbtype' => 'pgsql',
+ 'dbtableprefix' => 'oc_',
+ 'adminlogin' => '$ADMINLOGIN',
+ 'adminpass' => 'admin',
+ 'directory' => '$DATADIR',
+ 'dbuser' => '$DATABASEUSER',
+ 'dbname' => '$DATABASENAME',
+ 'dbhost' => 'localhost',
+ 'dbpass' => '',
+);
+DELIM
+
+cat > ./tests/autoconfig-oracle.php <<DELIM
+<?php
+\$AUTOCONFIG = array (
+ 'installed' => false,
+ 'dbtype' => 'oci',
+ 'dbtableprefix' => 'oc_',
+ 'adminlogin' => '$ADMINLOGIN',
+ 'adminpass' => 'admin',
+ 'directory' => '$DATADIR',
+ 'dbuser' => '$DATABASENAME',
+ 'dbname' => 'XE',
+ 'dbhost' => 'localhost',
+ 'dbpass' => 'owncloud',
+ 'loglevel' => 0,
+);
+DELIM
+
+function execute_tests {
+ echo "Setup environment for $1 testing ..."
+ # back to root folder
+ cd $BASEDIR
+
+ # 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
+
+ if [ "$1" == "oracle" ] ; then
+ echo "Load Oracle environment variables so that we can run 'sqlplus'."
+ . $ORACLE_HOME/bin/oracle_env.sh
+
+ echo "create the database"
+ sqlplus -s -l / as sysdba <<EOF
+ create user $DATABASENAME identified by owncloud;
+ alter user $DATABASENAME default tablespace users
+ temporary tablespace temp
+ quota unlimited on users;
+ grant create session
+ , create table
+ , create procedure
+ , create sequence
+ , create trigger
+ , create view
+ , create synonym
+ , alter session
+ to $DATABASENAME;
+ exit;
+EOF
+ fi
+
+ # copy autoconfig
+ cp $BASEDIR/tests/autoconfig-$1.php $BASEDIR/config/autoconfig.php
+
+ # trigger installation
+ echo "INDEX"
+ php -f index.php
+ echo "END INDEX"
+
+ #test execution
+ cd tests
+ #php -f enable_all.php
+}
+
+#
+# start test execution
+#
+if [ -z "$1" ]
+ then
+ # run all known database configs
+ for DBCONFIG in $DBCONFIGS; do
+ execute_tests $DBCONFIG
+ done
+else
+ execute_tests $1 $2 $3
+fi
+
+# show environment
+echo "owncloud configuration:"
+cat $BASEDIR/config/config.php
+
+
+echo "data directory:"
+ls -ll $DATADIR
+
+echo "owncloud.log:"
+[ -f "$DATADIR/owncloud.log" ] && cat $DATADIR/owncloud.log
+[ -f "$BASEDIR/data/owncloud.log" ] && cat $BASEDIR/data/owncloud.log
+
+cd $BASEDIR