-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun-tests.sh
executable file
·50 lines (42 loc) · 1.09 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
43
44
45
46
47
48
49
50
#!/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
# phpIni="$dir/php-unix.ini"
# Command line arguments processing
for i in `seq 1 $#`; do
if [ "$1" = "-j" ]; then
shift
if [ -z "$1" ]; then
echo "Missing argument for -j option." >&2
exit 2
fi
jobsNum="$1"
elif [ "$1" = "-c" ]; then
shift
if [ -z "$1" ]; then
echo "Missing argument for -c option." >&2
exit 2
fi
phpIni="$1"
else
set -- "$@" "$1"
fi
shift
done
# Run tests with script's arguments, doubled -c option intentionally
php -c "$phpIni" "$runnerScript" -j "$jobsNum" -c "$phpIni" "$@" "$dir/tests/"
error=$?
# Print *.actual content if tests failed
if [ "${VERBOSE-false}" != "false" -a $error -ne 0 ]; then
for i in $(find . -name \*.actual); do echo "--- $i"; cat $i; echo; echo; done
exit $error
fi