Browse Source

- Moved gen_php_cov functionality into the Makefile. Doing 'make lcov'

will run the test suite and create the code coverage HTML files.
# no need for some hairy checks whether PHP has the support
# since the lcov target will not exist if it doesn't :)
migration/RELEASE_1_0_0
foobar 21 years ago
parent
commit
cf69b66c13
  1. 23
      Makefile.gcov
  2. 70
      gen_php_cov

23
Makefile.gcov

@ -3,9 +3,28 @@
# LCOV
#
lcov: php_lcov.info
lcov: lcov-html
php_lcov.info:
lcov-test: all
@echo "Running test suite"
@find . -name \*.gcda | xargs rm -f
-@if test ! -z "$(PHP_EXECUTABLE)" && test -x "$(PHP_EXECUTABLE)"; then \
NO_INTERACTION=1 \
TEST_PHP_EXECUTABLE=$(PHP_EXECUTABLE) \
TEST_PHP_SRCDIR=$(top_srcdir) \
CC="$(CC)" \
$(PHP_EXECUTABLE) -d 'open_basedir=' -d 'safe_mode=0' -d 'output_buffering=0' -d 'memory_limit=-1' $(top_srcdir)/run-tests.php -d 'extension_dir=modules/' -d `( . $(PHP_MODULES) ; echo extension=$$dlname)` tests/; \
elif test ! -z "$(SAPI_CLI_PATH)" && test -x "$(SAPI_CLI_PATH)"; then \
NO_INTERACTION=1 \
TEST_PHP_EXECUTABLE=$(top_builddir)/$(SAPI_CLI_PATH) \
TEST_PHP_SRCDIR=$(top_srcdir) \
CC="$(CC)" \
$(top_builddir)/$(SAPI_CLI_PATH) -d 'open_basedir=' -d 'safe_mode=0' -d 'output_buffering=0' -d 'memory_limit=-1' $(top_srcdir)/run-tests.php $(TESTS); \
else \
echo "ERROR: Cannot run tests without CLI sapi."; \
fi
php_lcov.info: lcov-test
@echo "Generating data for $@"
@rm -rf lcov_data/
@$(mkinstalldirs) lcov_data/

70
gen_php_cov

@ -1,70 +0,0 @@
#!/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
Loading…
Cancel
Save