summaryrefslogtreecommitdiff
path: root/Makefile.gcov
diff options
context:
space:
mode:
authorMark A. Hershberger <mah@debian.(none)>2009-03-25 00:35:13 -0400
committerMark A. Hershberger <mah@debian.(none)>2009-03-25 00:35:13 -0400
commit0a36161e13484a99ccf69bb38f206462d27cc6d6 (patch)
treed5107db4b7369603ac7c753829e8972ee74949f7 /Makefile.gcov
parentce7edc9b3c7370f32fec0bc7a8ec3e29ed9a5f61 (diff)
downloadphp-0a36161e13484a99ccf69bb38f206462d27cc6d6.tar.gz
Imported Upstream version 5.1.2upstream/5.1.2
Diffstat (limited to 'Makefile.gcov')
-rw-r--r--Makefile.gcov70
1 files changed, 70 insertions, 0 deletions
diff --git a/Makefile.gcov b/Makefile.gcov
new file mode 100644
index 000000000..85f93e9db
--- /dev/null
+++ b/Makefile.gcov
@@ -0,0 +1,70 @@
+
+#
+# LCOV
+#
+
+lcov: lcov-html
+
+lcov-test: all
+ @echo "Running test suite"
+ @find . -name \*.gcda -o -name \*.da -o -name \*.bbg? | 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/
+ @echo
+ -@find . -name \*.gcda -o -name \*.gcno -o -name \*.da | sed -e 's/^\.\///' | sed -e 's/\.gcda//g' -e 's/\.gcno//g' -e 's/\.da//g' | uniq | while read x; do \
+ echo -n . ;\
+ y=`echo $$x | sed -e 's!\.libs/!!'`; \
+ dir=lcov_data/`dirname $$x`; \
+ test -d "$$dir" || $(mkinstalldirs) "$$dir"; \
+ if test -f "$(top_srcdir)/$$y.c"; then \
+ ln -f -s $(top_srcdir)/$$y.c lcov_data/$$y.c; \
+ fi; \
+ if test -f "$(top_srcdir)/$$y.re"; then \
+ ln -f -s $(top_srcdir)/$$y.re lcov_data/$$y.re; \
+ fi; \
+ if test -f "$(top_srcdir)/$$y.y"; then \
+ ln -f -s $(top_srcdir)/$$y.y lcov_data/$$y.y; \
+ fi; \
+ if test -f "$(top_srcdir)/$$y.l"; then \
+ ln -f -s $(top_srcdir)/$$y.l lcov_data/$$y.l; \
+ fi; \
+ if test -f "$(top_builddir)/$$y.c"; then \
+ ln -f -s $(top_builddir)/$$y.c lcov_data/$$y.c; \
+ fi; \
+ test -f "$$x.gcno" && cp $$x.gcno lcov_data/$$y.gcno ; \
+ test -f "$$x.gcda" && cp $$x.gcda lcov_data/$$y.gcda ; \
+ test -f "$$x.da" && cp $$x.da lcov_data/$$y.da ; \
+ test -f "$$x.bb" && cp $$x.bb lcov_data/$$y.bb ; \
+ test -f "$$x.bbg" && cp $$x.bbg lcov_data/$$y.bbg ; \
+ done
+ @echo
+ @echo "Generating $@"
+ @$(LTP) --directory lcov_data/ --capture --base-directory=lcov_data --output-file $@
+
+lcov-html: php_lcov.info
+ @echo "Generating lcov HTML"
+ @$(LTP_GENHTML) --legend --no-prefix --output-directory lcov_html/ --title "PHP Code Coverage" --show-details php_lcov.info
+
+lcov-clean:
+ rm -f php_lcov.info
+ rm -rf lcov_data/
+ rm -rf lcov_html/
+