Skip to content

Commit

Permalink
Don't attempt to run tests unless start file is successful
Browse files Browse the repository at this point in the history
  • Loading branch information
Robin McCorkell authored and DeepDiver1975 committed Oct 20, 2015
1 parent 8467dbf commit ad028c5
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 41 deletions.
6 changes: 6 additions & 0 deletions apps/files_external/tests/env/start-smb-windows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ user=smb-test
password=!owncloud123
host=WIN-9GTFAS08C15

if ! (nc -c -w 1 ${host} 445 </dev/null >&/dev/null \
|| nc -w 1 ${host} 445 </dev/null >&/dev/null); then
echo "[ERROR] Server not reachable" >&2
exit 1
fi

cat > $thisFolder/config.smb.php <<DELIM
<?php
Expand Down
81 changes: 40 additions & 41 deletions autotest-external.sh
Original file line number Diff line number Diff line change
Expand Up @@ -175,57 +175,56 @@ EOF
fi

if [ -n "$2" -a "$2" == "common-tests" ]; then
return;
return;
fi

FILES_EXTERNAL_BACKEND_PATH=../apps/files_external/tests/backends
FILES_EXTERNAL_BACKEND_ENV_PATH=../apps/files_external/tests/env
FILES_EXTERNAL_BACKEND_PATH=../apps/files_external/tests/backends
FILES_EXTERNAL_BACKEND_ENV_PATH=../apps/files_external/tests/env

for startFile in `ls -1 $FILES_EXTERNAL_BACKEND_ENV_PATH | grep start`; do
name=`echo $startFile | sed 's/start-//' | sed 's/\.sh//'`

if [ -n "$2" -a "$2" != "$name" ]; then
echo "skip: $startFile"
continue;
fi

echo "start: $startFile"
echo "name: $name"

# execute start file
./$FILES_EXTERNAL_BACKEND_ENV_PATH/$startFile

# getting backend to test from filename
# it's the part between the dots startSomething.TestToRun.sh
testToRun=`echo $startFile | cut -d '-' -f 2`

# 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=$?
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=$?
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
./$FILES_EXTERNAL_BACKEND_ENV_PATH/$stopFile
fi
name=`echo $startFile | sed 's/start-//' | sed 's/\.sh//'`

if [ -n "$2" -a "$2" != "$name" ]; then
echo "skip: $startFile"
continue;
fi

echo "start: $startFile"
echo "name: $name"

# execute start file
if ./$FILES_EXTERNAL_BACKEND_ENV_PATH/$startFile; then
# getting backend to test from filename
# it's the part between the dots startSomething.TestToRun.sh
testToRun=`echo $startFile | cut -d '-' -f 2`

# 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=$?
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=$?
fi
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
./$FILES_EXTERNAL_BACKEND_ENV_PATH/$stopFile
fi
done;
}

#
# start test execution
#
if [ -z "$1" ]
then
if [ -z "$1" ]; then
# run all known database configs
for DBCONFIG in $DBCONFIGS; do
execute_tests $DBCONFIG "$2"
Expand Down

0 comments on commit ad028c5

Please sign in to comment.