Skip to content

Commit ee7f3b4

Browse files
author
foobar
committed
- Fixed --enable-gcov to work with VPATH builds too
1 parent a2bd750 commit ee7f3b4

File tree

2 files changed

+39
-15
lines changed

2 files changed

+39
-15
lines changed

Makefile.gcov

Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,41 @@
11

2-
.php_cov_info.ltpdata:
3-
@mkdir -p .cov/; \
4-
find . -name \*.gcda -o -name \*.gcno | sed -e 's/^\.\/\.cov\/.*//' | xargs --replace cp {} .cov/; \
5-
find . -name \*.gcda -o -name \*.gcno | sed -e 's/^\.\/\.cov\/.*//' | sed -e 's/^\.\///' | xargs --max-args=1 dirname | sed -e 's/\/.*//' | xargs --replace ln -s `pwd`/{} `pwd`/.cov > /dev/null 2>&1; \
6-
$(LTP) --directory .cov --output-file=.php_cov_info.ltpdata --capture; \
2+
#
3+
# LCOV
4+
#
75

8-
cov: .php_cov_info.ltpdata
6+
lcov: php_lcov.info
97

10-
cov-html: cov
11-
@$(LTP_GENHTML) -o cov_html/ .php_cov_info.ltpdata -t "PHP Code Coverage" -s;
8+
php_lcov.info:
9+
@echo "Generating data for $@"
10+
@rm -rf lcov_data/
11+
@$(mkinstalldirs) lcov_data/
12+
@echo
13+
-@find . -name \*.gcda -o -name \*.gcno | sed -e 's/^\.\///' | sed -e 's/\.gcda//g' -e 's/\.gcno//g' | uniq | while read x; do \
14+
echo -n . ;\
15+
dir=lcov_data/`dirname $$x`; \
16+
test -d "$$dir" || $(mkinstalldirs) "$$dir"; \
17+
if test -f "$(top_srcdir)/$$x.c"; then \
18+
ln -f -s $(top_srcdir)/$$x.c lcov_data/$$x.c; \
19+
fi; \
20+
if test -f "$(top_srcdir)/$$x.re"; then \
21+
ln -f -s $(top_srcdir)/$$x.re lcov_data/$$x.re; \
22+
fi; \
23+
if test -f "$(top_builddir)/$$x.c"; then \
24+
ln -f -s $(top_builddir)/$$x.c lcov_data/$$x.c; \
25+
fi; \
26+
test -f "$$x.gcno" && cp $$x.gcno lcov_data/ ; \
27+
test -f "$$x.gcda" && cp $$x.gcda lcov_data/ ; \
28+
done
29+
@echo
30+
@echo "Generating $@"
31+
@$(LTP) --directory lcov_data/ --capture --output-file $@ --test-name PHP_LCOV
32+
33+
lcov-html: php_lcov.info
34+
@echo "Generating lcov HTML"
35+
@$(LTP_GENHTML) --no-prefix --output-directory lcov_html/ --title "PHP Code Coverage" --show-details php_lcov.info
36+
37+
lcov-clean:
38+
rm -f php_lcov.info
39+
rm -rf lcov_data/
40+
rm -rf lcov_html/
1241

13-
cov-clean:
14-
find . -name \*.gcda -o -name \*.gcno -exec rm -f {} \;
15-
rm -f .cov/* # This is done first, since we are symlinked inside..
16-
rm -Rf .cov # Now remove the directory
17-
rm -f .php_cov_info.ltpdata
18-
rm -Rf cov_html

NEWS

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ PHP NEWS
88
(Marcus, Dmitry)
99
- Changed "instanceof" and "catch" operators, is_a() and is_subclass_of()
1010
functions to not call __autoload(). (Dmitry)
11-
- Added configure option to enable C-level Code Coverage Instrumenting. (John)
11+
- Added --enable-gcov configure option to enable C-level code coverage.
12+
(John, Jani)
1213
- Added to cURL extension: (Ilia)
1314
. curl_setopt_array() which allows setting of multiple cURL options.
1415
. CURLINFO_HEADER_OUT constant to facilitate request retrieval.

0 commit comments

Comments
 (0)