Commit 5bdfb1c5e64 for php.net
commit 5bdfb1c5e64269db8ffa8962d2c9fc0c0bc4ed60
Author: Ilija Tovilo <ilija.tovilo@me.com>
Date: Tue Apr 7 18:07:42 2026 +0200
[skip ci] Move gcovr options to config file (GH-21663)
Having these in the make file is very annoying, because it requires rebuilding
from scratch and rerunning tests just to see if some flag is effective.
diff --git a/build/Makefile.gcov b/build/Makefile.gcov
index 13985a93a10..5097bfaaa27 100644
--- a/build/Makefile.gcov
+++ b/build/Makefile.gcov
@@ -16,23 +16,6 @@ LCOV_EXCLUDES = \
'$(top_srcdir)/parse_date.re' \
'$(top_srcdir)/parse_iso_intervals.re'
-GCOVR_EXCLUDES = \
- 'ext/bcmath/libbcmath/.*' \
- 'ext/date/lib/.*' \
- 'ext/fileinfo/libmagic/.*' \
- 'ext/gd/libgd/.*' \
- 'ext/hash/sha3/.*' \
- 'ext/lexbor/lexbor/.*' \
- 'ext/mbstring/libmbfl/.*' \
- 'ext/opcache/jit/ir/.*' \
- 'ext/pcre/pcre2lib/.*' \
- 'ext/uri/uriparser/.*'
-
-# These patterns have implicit ^/$ anchors.
-GCOVR_EXCLUDE_LINES_BY_PATTERNS = \
- '.*\b(ZEND_PARSE_PARAMETERS_(START|END|NONE)|Z_PARAM_).*' \
- '\s*(default:\s*)?ZEND_UNREACHABLE\(\);\s*'
-
lcov: lcov-html
php_lcov.info:
@@ -56,15 +39,11 @@ gcovr-html:
@echo "Generating gcovr HTML"
@rm -rf gcovr_html/
@mkdir gcovr_html
- gcovr -sr . -o gcovr_html/index.html --html --html-details --exclude-unreachable-branches --exclude-throw-branches \
- $(foreach pattern, $(GCOVR_EXCLUDE_LINES_BY_PATTERNS), --exclude-lines-by-pattern $(pattern)) \
- $(foreach lib, $(GCOVR_EXCLUDES), -e $(lib))
+ gcovr -r . -o gcovr_html/index.html --html --html-details
gcovr-xml:
@echo "Generating gcovr XML"
@rm -f gcovr.xml
- gcovr -sr . -o gcovr.xml --xml --exclude-unreachable-branches --exclude-throw-branches \
- $(foreach pattern, $(GCOVR_EXCLUDE_LINES_BY_PATTERNS), --exclude-lines-by-pattern $(pattern)) \
- $(foreach lib, $(GCOVR_EXCLUDES), -e $(lib))
+ gcovr -r . -o gcovr.xml --xml
.PHONY: gcovr-html lcov-html php_lcov.info
diff --git a/gcovr.cfg b/gcovr.cfg
new file mode 100644
index 00000000000..a8267cd6e00
--- /dev/null
+++ b/gcovr.cfg
@@ -0,0 +1,19 @@
+print-summary = yes
+
+exclude-throw-branches = yes
+exclude-unreachable-branches = yes
+
+exclude = ext/bcmath/libbcmath/.*
+exclude = ext/date/lib/.*
+exclude = ext/fileinfo/libmagic/.*
+exclude = ext/gd/libgd/.*
+exclude = ext/hash/sha3/.*
+exclude = ext/lexbor/lexbor/.*
+exclude = ext/mbstring/libmbfl/.*
+exclude = ext/opcache/jit/ir/.*
+exclude = ext/pcre/pcre2lib/.*
+exclude = ext/uri/uriparser/.*
+
+# These patterns have implicit ^/$ anchors.
+exclude-lines-by-pattern = .*\b(ZEND_PARSE_PARAMETERS_(START|END|NONE)|Z_PARAM_).*
+exclude-lines-by-pattern = \s*(default:\s*)?ZEND_UNREACHABLE\(\);\s*