aboutsummaryrefslogtreecommitdiffstats
path: root/autotest-external.sh
diff options
context:
space:
mode:
Diffstat (limited to 'autotest-external.sh')
-rwxr-xr-xautotest-external.sh51
1 files changed, 32 insertions, 19 deletions
diff --git a/autotest-external.sh b/autotest-external.sh
index 643153bb064..4111aeeca20 100755
--- a/autotest-external.sh
+++ b/autotest-external.sh
@@ -1,11 +1,8 @@
#!/usr/bin/env bash
#
-# ownCloud
-#
-# @author Thomas Müller
-# @author Morris Jobke
-# @copyright 2012-2015 Thomas Müller thomas.mueller@tmit.eu
-# @copyright 2014 Morris Jobke hey@morrisjobke.de
+# SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
+# SPDX-FileCopyrightText: 2014-2016 ownCloud, Inc.
+# SPDX-License-Identifier: AGPL-3.0-only
#
#$EXECUTOR_NUMBER is set by Jenkins and allows us to run autotest in parallel
@@ -31,16 +28,21 @@ function print_syntax {
}
if ! [ -x "$PHPUNIT" ]; then
- echo "phpunit executable not found, please install phpunit version >= 3.7" >&2
- exit 3
+ echo "phpunit executable not found, trying local one from build/integration" >&2
+ if [ -x "$PWD/build/integration/vendor/phpunit/phpunit/phpunit" ]; then
+ PHPUNIT="$PWD/build/integration/vendor/phpunit/phpunit/phpunit"
+ else
+ echo "phpunit executable not found, please install phpunit version >= 9.0" >&2
+ exit 3
+ fi
fi
PHPUNIT_VERSION=$("$PHPUNIT" --version | cut -d" " -f2)
PHPUNIT_MAJOR_VERSION=$(echo $PHPUNIT_VERSION | cut -d"." -f1)
PHPUNIT_MINOR_VERSION=$(echo $PHPUNIT_VERSION | cut -d"." -f2)
-if ! [ $PHPUNIT_MAJOR_VERSION -gt 4 -o \( $PHPUNIT_MAJOR_VERSION -eq 4 -a $PHPUNIT_MINOR_VERSION -ge 4 \) ]; then
- echo "phpunit version >= 4.4 required. Version found: $PHPUNIT_VERSION" >&2
+if ! [ $PHPUNIT_MAJOR_VERSION -gt 9 -o \( $PHPUNIT_MAJOR_VERSION -eq 9 -a $PHPUNIT_MINOR_VERSION -ge 0 \) ]; then
+ echo "phpunit version >= 9.0 required. Version found: $PHPUNIT_VERSION" >&2
exit 4
fi
@@ -148,7 +150,9 @@ EOF
# trigger installation
echo "Installing ...."
- ./occ maintenance:install -vvv --database=$1 --database-name=$DATABASENAME --database-host=localhost --database-user=$DATABASEUSER --database-pass=owncloud --database-table-prefix=oc_ --admin-user=$ADMINLOGIN --admin-pass=admin --data-dir=$DATADIR
+ ./occ maintenance:install -vvv --database=$1 --database-name=$DATABASENAME --database-host=localhost --database-user=$DATABASEUSER --database-pass=owncloud --admin-user=$ADMINLOGIN --admin-pass=admin --data-dir=$DATADIR
+
+ ./occ config:system:set --value true --type boolean allow_local_remote_servers
#test execution
echo "Testing with $1 ..."
@@ -167,18 +171,21 @@ EOF
fi
if [ -z "$NOCOVERAGE" ]; then
"$PHPUNIT" --configuration phpunit-autotest-external.xml --log-junit "autotest-external-results-$1.xml" --coverage-clover "autotest-external-clover-$1.xml" --coverage-html "coverage-external-html-$1"
- RESULT=$?
else
echo "No coverage"
"$PHPUNIT" --configuration phpunit-autotest-external.xml --log-junit "autotest-external-results-$1.xml"
- RESULT=$?
+ fi
+
+ if [[ $? -ne 0 ]]; then
+ echo "Error during phpunit execution ... terminating"
+ exit 1
fi
if [ -n "$2" -a "$2" == "common-tests" ]; then
return;
fi
- FILES_EXTERNAL_BACKEND_PATH=../apps/files_external/tests/backends
+ FILES_EXTERNAL_BACKEND_PATH=../apps/files_external/tests/Storage
FILES_EXTERNAL_BACKEND_ENV_PATH=../apps/files_external/tests/env
for startFile in `ls -1 $FILES_EXTERNAL_BACKEND_ENV_PATH | grep start`; do
@@ -198,27 +205,33 @@ EOF
# getting backend to test from filename
# it's the part between the dots startSomething.TestToRun.sh
testToRun=`echo $startFile | cut -d '-' -f 2`
+ # capitalize first letter
+ testToRun="${testToRun^}"
+ testToRun="${testToRun}Test.php"
# run the specific test
if [ -z "$NOCOVERAGE" ]; then
rm -rf "coverage-external-html-$1-$name"
mkdir "coverage-external-html-$1-$name"
- "$PHPUNIT" --configuration phpunit-autotest-external.xml --log-junit "autotest-external-results-$1-$name.xml" --coverage-clover "autotest-external-clover-$1-$name.xml" --coverage-html "coverage-external-html-$1-$name" "$FILES_EXTERNAL_BACKEND_PATH/$testToRun.php"
- RESULT=$?
+ "$PHPUNIT" --configuration phpunit-autotest-external.xml --log-junit "autotest-external-results-$1-$name.xml" --coverage-clover "autotest-external-clover-$1-$name.xml" --coverage-html "coverage-external-html-$1-$name" "$FILES_EXTERNAL_BACKEND_PATH/$testToRun"
else
echo "No coverage"
- "$PHPUNIT" --configuration phpunit-autotest-external.xml --log-junit "autotest-external-results-$1-$name.xml" "$FILES_EXTERNAL_BACKEND_PATH/$testToRun.php"
- RESULT=$?
+ "$PHPUNIT" --configuration phpunit-autotest-external.xml --log-junit "autotest-external-results-$1-$name.xml" "$FILES_EXTERNAL_BACKEND_PATH/$testToRun"
fi
else
DOEXIT=1
fi
+ if [[ $? -ne 0 ]]; then
+ echo "Error during phpunit execution ... terminating"
+ exit 1
+ fi
+
# calculate stop file
stopFile=`echo "$startFile" | sed 's/start/stop/'`
echo "stop: $stopFile"
if [ -f $FILES_EXTERNAL_BACKEND_ENV_PATH/$stopFile ]; then
- # execute stop file if existant
+ # execute stop file if existent
./$FILES_EXTERNAL_BACKEND_ENV_PATH/$stopFile
fi
if [ "$DOEXIT" ]; then