]> granicus.if.org Git - php/commitdiff
Fix GCOV not working for PHP-7.4 and master branches
authorGerard Roche <gerardroche@users.noreply.github.com>
Mon, 23 Sep 2019 16:09:00 +0000 (17:09 +0100)
committerNikita Popov <nikita.ppv@gmail.com>
Wed, 25 Sep 2019 08:19:19 +0000 (10:19 +0200)
Code coverage reports (`make lcov`), since commit eef8522 (7.4 branch),
generates incorrect coverage and emits warnings. Simplifying the
Makefile.gcov file has the side-effect of resolving the issue.

    Processing sapi/cli/php_http_parser.gcda
    php-src/lcov_data/sapi/cli/php_http_parser.gcda:stamp mismatch with notes file
    geninfo: WARNING: gcov did not create any files for php-src/lcov_data/sapi/cli/php_http_parser.gcda!
    ...
    Processing ext/mbstring/mb_gpc.gcda
    php-src/lcov_data/ext/mbstring/mb_gpc.gcda:stamp mismatch with notes file
    geninfo: WARNING: gcov did not create any files for php-src/lcov_data/ext/mbstring/mb_gpc.gcda!

Closes: https://bugs.php.net/bug.php?id=52718.
See also: https://bugs.php.net/bug.php?id=78288.

.gitignore
build/Makefile.gcov

index 250a23efa2654269daf6e2a1ee1ecf04b10aa9e3..20c97ef302f726c3e4a15a5714627097436de1ab 100644 (file)
@@ -249,7 +249,6 @@ tmp-php.ini
 # ------------------------------------------------------------------------------
 *.gcda
 *.gcno
-/lcov_data/
 /lcov_html/
 /php_lcov.info
 
index 640ac0a71022eff3fd2972f7975d37f87660acd1..c32ae3fe55ba9099ffa9c3d5eee9367d6766f185 100644 (file)
@@ -2,68 +2,26 @@
 # LCOV
 #
 
-LCOV_INCLUDE="."
-
 lcov: lcov-html
 
 lcov-test: lcov-clean-data test
 
 php_lcov.info: lcov-test
-       @echo "Generating data for $@"
-       @rm -rf lcov_data/
-       @$(mkinstalldirs) lcov_data/
-       @echo
-       -@files=`find . -name \*.gcda -o -name \*.gcno -o -name \*.da -o -name \*.c -o -name \*.h | sed -e 's/^\.\///' | sed -e 's/\.gcda//g' -e 's/\.gcno//g' -e 's/\.da//g' | $(EGREP) $(LCOV_INCLUDE) | sed -e 's/.libs/zzzz/g' | sort | sed -e 's/zzzz/.libs/g' | uniq` ;\
-       for x in $$files; 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.h"; then \
-                       ln -f -s $(top_srcdir)/$$y.h lcov_data/$$y.h; \
-               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_srcdir)/$$y"; then \
-                       ln -f -s $(top_srcdir)/$$y lcov_data/$$y; \
-               fi; \
-               if test -f "$(top_builddir)/$$y.c"; then \
-                       ln -f -s $(top_builddir)/$$y.c lcov_data/$$y.c; \
-               fi; \
-               if test -f "$$x.gcno"; then \
-                       cp $$x.gcno lcov_data/$$y.gcno ; \
-               fi; \
-               if test -f "$$x.gcda"; then \
-                       cp $$x.gcda lcov_data/$$y.gcda ; \
-               fi; \
-               if test -f "$$x.da"; then \
-                       cp $$x.da   lcov_data/$$y.da ; \
-               fi; \
-               if test -f "$$x.bb"; then \
-                       cp $$x.bb   lcov_data/$$y.bb ; \
-               fi; \
-               if test -f "$$x.bbg"; then \
-                       cp $$x.bbg  lcov_data/$$y.bbg ; \
-               fi; \
-       done; \
-       for dir in ext/date/lib ext/fileinfo/libmagic ext/gd/libgd ext/pcre/pcre2lib; do \
-               if test -d lcov_data/$$dir; then \
-                       rm -rf lcov_data/$$dir ; \
-               fi; \
-       done
-       @echo
-       @echo "Generating $@"
-       @$(LTP) --directory lcov_data/ --capture --base-directory=lcov_data --output-file $@
+       @echo "Generating lcov data for $@"
+       @$(LTP) --capture --no-external --directory . --output-file $@
+       @echo "Stripping bundled libraries from $@"
+       @$(LTP) --remove $@ \
+               '*/<stdout>' \
+               '$(top_srcdir)/ext/bcmath/libbcmath/*' \
+               '$(top_srcdir)/ext/date/lib/*' \
+               '$(top_srcdir)/ext/fileinfo/libmagic/*' \
+               '$(top_srcdir)/ext/gd/libgd/*' \
+               '$(top_srcdir)/ext/hash/sha3/*' \
+               '$(top_srcdir)/ext/mbstring/libmbfl/*' \
+               '$(top_srcdir)/ext/opcache/jit/libudis86/*' \
+               '$(top_srcdir)/ext/pcre/pcre2lib/*' \
+               '$(top_srcdir)/ext/xmlrpc/libxmlrpc/*' \
+               --output-file $@
 
 lcov-html: php_lcov.info
        @echo "Generating lcov HTML"
@@ -71,7 +29,6 @@ lcov-html: php_lcov.info
 
 lcov-clean:
        rm -f php_lcov.info
-       rm -rf lcov_data/
        rm -rf lcov_html/
 
 lcov-clean-data: