-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_test
More file actions
executable file
·99 lines (97 loc) · 2.07 KB
/
Copy pathrun_test
File metadata and controls
executable file
·99 lines (97 loc) · 2.07 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/usr/bin/env bash
function print_all_tests {
echo "Valid tests are below:" 1>&2
echo 1>&2
SCRIPT_PATH="${BASH_SOURCE[0]}"
SCRIPT_DIR="$( cd "$( dirname "$SCRIPT_PATH" )" && pwd )"
grep --only -E '^\s*\w+\)' < $SCRIPT_PATH| sed 's,\s*\|),,g' |sort 1>&2
grep --only -E '<testsuite name="\w+"' < "$SCRIPT_DIR/../phpunit.xml" | sed 's,.*name="\(\w\+\)".*,\1,g' | sort 1>&2
}
TEST_SUITE="$1"
if [ "$#" != 1 ]; then
if [[ "$#" == 2 && "$1" == "--print-test-suite" ]]; then
TEST_SUITE="$2"
echo "Running test suite: $TEST_SUITE"
else
echo "Usage: $0 [--print-test-suite] \$TEST_SUITE " 1>&2
print_all_tests
exit 1
fi
fi
if [ "x$TEST_SUITE" == "x" ]; then
echo "Provided TEST_SUITE param was empty" 1>&2
exit 1
fi
case "$TEST_SUITE" in
__FakeSelfTest)
./phan --memory-limit 1G
exit $?
;;
__FakeSelfFallbackTest)
PLUGIN_PATH=$HOME/.phan-ci/UnusedVariablePlugin-c20aea3e.php
ARGS=""
if [ -e "$PLUGIN_PATH" ]; then
ARGS="--plugin $PLUGIN_PATH"
fi
./phan --plugin PHPUnitNotDeadCodePlugin \
--plugin InvokePHPNativeSyntaxCheckPlugin \
$ARGS \
--dead-code-detection \
--polyfill-parse-all-element-doc-comments \
--force-polyfill-parser \
--memory-limit 1G
exit $?
;;
__FakePHP70Test)
# TODO: Can this use phpunit?
cd tests/php70_test
./test.sh
exit $?
;;
__FakeRewritingTest)
cd tests/misc/rewriting_test
./test.sh
exit $?
;;
__FakeFallbackTest)
cd tests/misc/fallback_test
./test.sh
exit $?
;;
__FakePluginTest)
cd tests/plugin_test
./test.sh
exit $?
;;
__FakeToolTest)
cd tests/tool_test
./test.sh
exit $?
;;
__FakeAllPHPUnitTests)
vendor/bin/phpunit
exit $?
;;
__FakeConfigOverrideTest)
cd tests/misc/config_override_test
./test.sh
exit $?
;;
__*)
echo "Unknown test '$TEST_SUITE' (Tests beginning with __ are not phpunit tests)" 1>&2
echo 1>&2
print_all_tests
exit 1
;;
-*)
echo "This script does not accept flags" 1>&2
echo "Usage: $0 \$TEST_SUITE" 1>&2
echo 1>&2
print_all_tests
exit 1
;;
*)
./vendor/bin/phpunit --colors --testsuite "$TEST_SUITE"
exit $?
;;
esac