Skip to content

Commit ef59e8b

Browse files
committed
Ignore zpp in gcovr
The ZPP macros materialize into optimized code with many error branches that aren't useful to test for every function. Ignore these lines completely by using the gcovr --exclude-lines-by-pattern flag. For codecov to pick up on this change, we generate the xml file manually and point to it in the codecov action. Also move the ignore paths from codecov.yml to Makefile.gcov.
1 parent 50ad458 commit ef59e8b

3 files changed

Lines changed: 12 additions & 18 deletions

File tree

.github/workflows/test-suite.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,12 +413,17 @@ jobs:
413413
with:
414414
enableOpcache: true
415415
jitType: tracing
416+
- name: Generate coverage report
417+
if: ${{ !cancelled() }}
418+
run: make gcovr-xml
416419
- uses: codecov/codecov-action@v5
417420
if: ${{ !cancelled() }}
418421
with:
419422
fail_ci_if_error: true
420423
token: ${{ secrets.CODECOV_TOKEN }}
421424
verbose: true
425+
files: gcovr.xml
426+
disable_search: true
422427
COMMUNITY:
423428
if: ${{ fromJson(inputs.branch).jobs.COMMUNITY }}
424429
strategy:

build/Makefile.gcov

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,12 @@ GCOVR_EXCLUDES = \
2222
'ext/fileinfo/libmagic/.*' \
2323
'ext/gd/libgd/.*' \
2424
'ext/hash/sha3/.*' \
25+
'ext/lexbor/lexbor/.*' \
2526
'ext/mbstring/libmbfl/.*' \
26-
'ext/pcre/pcre2lib/.*'
27+
'ext/pcre/pcre2lib/.*' \
28+
'ext/uri/uriparser/.*'
29+
30+
GCOVR_EXCLUDE_LINES_BY_PATTERN = '.*(ZEND_PARSE_PARAMETERS_(START|END|NONE)|Z_PARAM_).*'
2731

2832
lcov: lcov-html
2933

@@ -49,14 +53,14 @@ gcovr-html:
4953
@rm -rf gcovr_html/
5054
@mkdir gcovr_html
5155
gcovr -sr . -o gcovr_html/index.html --html --html-details \
52-
--exclude-directories 'ext/date/lib$$' \
56+
--exclude-lines-by-pattern $(GCOVR_EXCLUDE_LINES_BY_PATTERN) \
5357
$(foreach lib, $(GCOVR_EXCLUDES), -e $(lib))
5458

5559
gcovr-xml:
5660
@echo "Generating gcovr XML"
5761
@rm -f gcovr.xml
5862
gcovr -sr . -o gcovr.xml --xml \
59-
--exclude-directories 'ext/date/lib$$' \
63+
--exclude-lines-by-pattern $(GCOVR_EXCLUDE_LINES_BY_PATTERN) \
6064
$(foreach lib, $(GCOVR_EXCLUDES), -e $(lib))
6165

6266
.PHONY: gcovr-html lcov-html php_lcov.info

codecov.yml

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)