Skip to content

Test #4759

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed

Test #4759

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,10 @@ tmp-php.ini
# ------------------------------------------------------------------------------
*.gcda
*.gcno
/gcovr_html/
/lcov_html/
/php_lcov.info
/coverage.xml

# ------------------------------------------------------------------------------
# Archives generated during the PHP release process
Expand Down
2 changes: 2 additions & 0 deletions azure/apt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,7 @@ steps:
postgresql \
postgresql-contrib \
llvm \
lcov \
${{ parameters.packages }}
sudo -H pip install gcovr
displayName: 'APT'
3 changes: 2 additions & 1 deletion azure/configure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,6 @@ steps:
--with-mhash \
--enable-werror \
--with-config-file-path=/etc \
--with-config-file-scan-dir=/etc/php.d
--with-config-file-scan-dir=/etc/php.d \
--enable-gcov
displayName: 'Configure Build'
20 changes: 20 additions & 0 deletions azure/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,23 @@ steps:
failTaskOnFailedTests: true
displayName: 'Export ${{ parameters.configurationName }} ${{ parameters.runTestsName }} Results'
condition: or(succeeded(), failed())
- script: |
rm -rf coverage.xml | true
gcovr -sr . -o coverage.xml --xml \
-e '.*/ext/bcmath/libbcmath/.*' \
-e '.*/ext/date/lib/.*' \
-e '.*/ext/fileinfo/libmagic/.*' \
-e '.*/ext/gd/libgd/.*' \
-e '.*/ext/hash/sha3/.*' \
-e '.*/ext/mbstring/libmbfl/.*' \
-e '.*/ext/opcache/jit/libudis86/.*' \
-e '.*/ext/pcre/pcre2lib/.*' \
-e '.*/ext/xmlrpc/libxmlrpc/.*'
displayName: 'Coverage ${{ parameters.configurationName }} ${{ parameters.runTestsName }}'
condition: or(succeeded(), failed())
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: 'Cobertura'
summaryFileLocation: coverage.xml
displayName: 'Export ${{ parameters.configurationName }} ${{ parameters.runTestsName }} Coverage'
condition: or(succeeded(), failed())
45 changes: 26 additions & 19 deletions build/Makefile.gcov
Original file line number Diff line number Diff line change
@@ -1,35 +1,42 @@
#
# LCOV
# GCOV
#

lcov: lcov-html
GCOV_EXCLUDES = \
'$(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/*'

lcov-test: lcov-clean-data test

php_lcov.info: lcov-test
php_lcov.info: test
@echo "Generating lcov data for $@"
@$(LTP) --capture --no-external --directory . --output-file $@
$(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 $@
$(LTP) --output-file $@ --remove $@ '*/<stdout>' $(GCOV_EXCLUDES)

lcov-html: php_lcov.info
@echo "Generating lcov HTML"
@$(LTP_GENHTML) --legend --output-directory lcov_html/ --title "PHP Code Coverage" php_lcov.info
$(LTP_GENHTML) --legend --output-directory lcov_html/ --title "PHP Code Coverage" php_lcov.info

lcov-clean:
rm -f php_lcov.info
rm -rf lcov_html/

lcov-clean-data:
@find . -name \*.gcda -o -name \*.da -o -name \*.bbg? | xargs rm -f

gcovr-html: test
@echo "Generating gcovr HTML"
@rm -rf gcovr_html/
@mkdir gcovr_html
gcovr -sr . -o gcovr_html/index.html --html --html-details $(foreach lib, $(GCOV_EXCLUDES), -e $(lib))

gcovr-xml: test
@echo "Generating gcovr XML"
@rm -f coverage.xml
gcovr -sr . -o coverage.xml --xml $(foreach lib, $(GCOV_EXCLUDES), -e $(lib))