forked from VladaHejda/LiveTranslator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run-tests.sh
42 lines (35 loc) · 1.11 KB
/
run-tests.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/sh
# Path to this script's directory
dir=$(cd `dirname $0` && pwd)
# Path to test runner script
runnerScript="$dir/../vendor/nette/tester/Tester/tester.php"
if [ ! -f "$runnerScript" ]; then
echo "Nette Tester is missing. You can install it using Composer:" >&2
echo "php composer.phar update --dev." >&2
exit 2
fi
# Default runner arguments
jobsNum=20
# Command line arguments processing
i=$#
while [ $i -gt 0 ]; do
if [ "$1" = "-j" ]; then
shift && i=$(($i - 1))
if [ -z "$1" ]; then
echo "Missing argument for -j option." >&2
exit 2
fi
jobsNum="$1"
else
set -- "$@" "$1"
fi
shift && i=$(($i - 1))
done
# Run tests with script's arguments, doubled -c option intentionally
php -n "$runnerScript" -j "$jobsNum" "$@"
error=$?
# Print *.actual content if tests failed
if [ "${VERBOSE-false}" != "false" -a $error -ne 0 ]; then
for i in $(find "$dir" -name \*.actual); do echo "--- $i"; cat $i; echo; echo; done
exit $error
fi