|
1 | 1 | # |
2 | | -# LCOV |
| 2 | +# GCOV |
3 | 3 | # |
4 | 4 |
|
5 | 5 | LTP = lcov |
6 | 6 | LTP_GENHTML = genhtml |
7 | 7 |
|
8 | | -lcov: lcov-html |
| 8 | +LCOV_EXCLUDES = \ |
| 9 | + '$(top_srcdir)/ext/bcmath/libbcmath/*' \ |
| 10 | + '$(top_srcdir)/ext/date/lib/*' \ |
| 11 | + '$(top_srcdir)/ext/fileinfo/libmagic/*' \ |
| 12 | + '$(top_srcdir)/ext/gd/libgd/*' \ |
| 13 | + '$(top_srcdir)/ext/hash/sha3/*' \ |
| 14 | + '$(top_srcdir)/ext/mbstring/libmbfl/*' \ |
| 15 | + '$(top_srcdir)/ext/opcache/jit/libudis86/*' \ |
| 16 | + '$(top_srcdir)/ext/pcre/pcre2lib/*' \ |
| 17 | + '$(top_srcdir)/ext/xmlrpc/libxmlrpc/*' |
| 18 | + |
| 19 | +GCOVR_EXCLUDES = \ |
| 20 | + 'ext/bcmath/libbcmath/.*' \ |
| 21 | + 'ext/date/lib/.*' \ |
| 22 | + 'ext/fileinfo/libmagic/.*' \ |
| 23 | + 'ext/gd/libgd/.*' \ |
| 24 | + 'ext/hash/sha3/.*' \ |
| 25 | + 'ext/mbstring/libmbfl/.*' \ |
| 26 | + 'ext/opcache/jit/libudis86/.*' \ |
| 27 | + 'ext/pcre/pcre2lib/.*' \ |
| 28 | + 'ext/xmlrpc/libxmlrpc/.*' |
9 | 29 |
|
10 | | -lcov-test: lcov-clean-data test |
| 30 | +lcov: lcov-html |
11 | 31 |
|
12 | | -php_lcov.info: lcov-test |
| 32 | +php_lcov.info: |
13 | 33 | @echo "Generating lcov data for $@" |
14 | | - @$(LTP) --capture --no-external --directory . --output-file $@ |
| 34 | + $(LTP) --capture --no-external --directory . --output-file $@ |
15 | 35 | @echo "Stripping bundled libraries from $@" |
16 | | - @$(LTP) --remove $@ \ |
17 | | - '*/<stdout>' \ |
18 | | - '$(top_srcdir)/ext/bcmath/libbcmath/*' \ |
19 | | - '$(top_srcdir)/ext/date/lib/*' \ |
20 | | - '$(top_srcdir)/ext/fileinfo/libmagic/*' \ |
21 | | - '$(top_srcdir)/ext/gd/libgd/*' \ |
22 | | - '$(top_srcdir)/ext/hash/sha3/*' \ |
23 | | - '$(top_srcdir)/ext/mbstring/libmbfl/*' \ |
24 | | - '$(top_srcdir)/ext/opcache/jit/libudis86/*' \ |
25 | | - '$(top_srcdir)/ext/pcre/pcre2lib/*' \ |
26 | | - '$(top_srcdir)/ext/xmlrpc/libxmlrpc/*' \ |
27 | | - --output-file $@ |
| 36 | + $(LTP) --output-file $@ --remove $@ '*/<stdout>' $(LCOV_EXCLUDES) |
28 | 37 |
|
29 | 38 | lcov-html: php_lcov.info |
30 | 39 | @echo "Generating lcov HTML" |
31 | | - @$(LTP_GENHTML) --legend --output-directory lcov_html/ --title "PHP Code Coverage" php_lcov.info |
| 40 | + $(LTP_GENHTML) --legend --output-directory lcov_html/ --title "PHP Code Coverage" php_lcov.info |
32 | 41 |
|
33 | 42 | lcov-clean: |
34 | 43 | rm -f php_lcov.info |
35 | 44 | rm -rf lcov_html/ |
36 | 45 |
|
37 | 46 | lcov-clean-data: |
38 | 47 | @find . -name \*.gcda -o -name \*.da -o -name \*.bbg? | xargs rm -f |
| 48 | + |
| 49 | +gcovr-html: |
| 50 | + @echo "Generating gcovr HTML" |
| 51 | + @rm -rf gcovr_html/ |
| 52 | + @mkdir gcovr_html |
| 53 | + gcovr -sr . -o gcovr_html/index.html --html --html-details \ |
| 54 | + --exclude-directories 'ext/date/lib$$' \ |
| 55 | + $(foreach lib, $(GCOVR_EXCLUDES), -e $(lib)) |
| 56 | + |
| 57 | +gcovr-xml: |
| 58 | + @echo "Generating gcovr XML" |
| 59 | + @rm -f gcovr.xml |
| 60 | + gcovr -sr . -o gcovr.xml --xml \ |
| 61 | + --exclude-directories 'ext/date/lib$$' \ |
| 62 | + $(foreach lib, $(GCOVR_EXCLUDES), -e $(lib)) |
| 63 | + |
| 64 | +.PHONY: gcovr-html lcov-html php_lcov.info |
0 commit comments