forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgen_php_cov
executable file
·70 lines (62 loc) · 1.57 KB
/
gen_php_cov
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
#!/bin/sh
cov_gen_clean()
{
echo "Cleaning up stale gcov data"
find . -name \*.gcda -o -name \*.gcno | xargs rm -f
make cov-clean > /dev/null
}
cov_gen_check_cli()
{
if test -x $php_version; then
check_gcov=`nm $php_version | grep '__gcov_open' | wc -l`
if test "$check_gcov" != "1"; then
echo "PHP CLI Found ($php_version) does not appear to have GCOV enabled"
echo "Please recompile with --enable-gcov or set PHP_EXEC"
exit 1
fi
echo "GCOV support in PHP confirmed"
else
echo "Could not find PHP binary (using $php_version)"
echo "Please compile the CLI version of PHP using the --enable-gcov flag"
exit 1
fi
}
cov_gen_usage()
{
echo "$0 --[help] <cli executable>";
}
cov_gen_generate()
{
echo "Confirming GCOV is available in PHP"
cov_gen_check_cli
cov_gen_clean
export NO_INTERACTION=1
export TEST_PHP_EXECUTABLE="$php_version"
echo "Running Test Suite (this is going to take awhile)"
$php_version -c ./php.ini-test run-tests.php > /dev/null
echo "Performing Code Coverage Analysis"
make cov > /dev/null
echo "Generating HTML report of Analysis"
make cov-html > /dev/null
}
while test $# != 0; do
case "$1" in
--help)
cov_gen_usage
exit 0
;;
*)
if test -x $1; then
echo "Using PHP executable $1"
php_version="$1"
cov_gen_generate
exit 0
fi
;;
esac
shift
done
echo "Using Default Location for PHP executable"
php_version="sapi/cli/php"
cov_gen_generate
exit 0