Skip to content

Commit 92b0bc2

Browse files
committed
[WIP] Azure: Publish code coverage results
See: https://externals.io/message/107113 Re: #4739 (comment)
1 parent d71f859 commit 92b0bc2

File tree

6 files changed

+115
-82
lines changed

6 files changed

+115
-82
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,10 @@ tmp-php.ini
249249
# ------------------------------------------------------------------------------
250250
*.gcda
251251
*.gcno
252+
/gcovr_html/
252253
/lcov_html/
253254
/php_lcov.info
255+
/coverage.xml
254256

255257
# ------------------------------------------------------------------------------
256258
# Archives generated during the PHP release process

azure-pipelines.yml

Lines changed: 62 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -20,65 +20,65 @@ jobs:
2020
parameters:
2121
configurationName: RELEASE_ZTS
2222
configurationParameters: '--disable-debug --enable-maintainer-zts'
23-
- template: azure/i386/job.yml
24-
parameters:
25-
configurationName: I386_DEBUG_ZTS
26-
configurationParameters: '--enable-debug --enable-maintainer-zts'
27-
- template: azure/macos/job.yml
28-
parameters:
29-
configurationName: MACOS_DEBUG_NTS
30-
configurationParameters: '--enable-debug --disable-maintainer-zts'
31-
- ${{ if eq(variables['Build.Reason'], 'Schedule') }}:
32-
- template: azure/job.yml
33-
parameters:
34-
configurationName: DEBUG_ZTS
35-
configurationParameters: '--enable-debug --enable-maintainer-zts'
36-
- template: azure/job.yml
37-
parameters:
38-
configurationName: RELEASE_NTS
39-
configurationParameters: '--disable-debug --disable-maintainer-zts'
40-
- template: azure/i386/job.yml
41-
parameters:
42-
configurationName: I386_DEBUG_NTS
43-
configurationParameters: '--enable-debug --disable-maintainer-zts'
44-
- template: azure/i386/job.yml
45-
parameters:
46-
configurationName: I386_RELEASE_NTS
47-
configurationParameters: '--disable-debug --disable-maintainer-zts'
48-
- template: azure/i386/job.yml
49-
parameters:
50-
configurationName: I386_RELEASE_ZTS
51-
configurationParameters: '--disable-debug --enable-maintainer-zts'
52-
- template: azure/macos/job.yml
53-
parameters:
54-
configurationName: MACOS_DEBUG_ZTS
55-
configurationParameters: '--enable-debug --enable-maintainer-zts'
56-
- template: azure/macos/job.yml
57-
parameters:
58-
configurationName: MACOS_RELEASE_NTS
59-
configurationParameters: '--disable-debug --disable-maintainer-zts'
60-
- template: azure/macos/job.yml
61-
parameters:
62-
configurationName: MACOS_RELEASE_ZTS
63-
configurationParameters: '--disable-debug --enable-maintainer-zts'
64-
- template: azure/job.yml
65-
parameters:
66-
configurationName: DEBUG_ZTS_ASAN_UBSAN
67-
configurationParameters: >-
68-
--enable-debug --enable-maintainer-zts
69-
CFLAGS='-fsanitize=undefined,address -DZEND_TRACK_ARENA_ALLOC'
70-
LDFLAGS='-fsanitize=undefined,address'
71-
runTestsParameters: --asan
72-
timeoutInMinutes: 120
73-
- template: azure/msan_job.yml
74-
parameters:
75-
configurationName: DEBUG_ZTS_MSAN
76-
configurationParameters: '--enable-debug --enable-maintainer-zts'
77-
runTestsParameters: --asan
78-
- template: azure/community_job.yml
79-
parameters:
80-
configurationName: COMMUNITY
81-
configurationParameters: >-
82-
--enable-debug --enable-maintainer-zts
83-
CFLAGS='-fsanitize=undefined,address -fno-sanitize-recover -DZEND_TRACK_ARENA_ALLOC'
84-
LDFLAGS='-fsanitize=undefined,address'
23+
# - template: azure/i386/job.yml
24+
# parameters:
25+
# configurationName: I386_DEBUG_ZTS
26+
# configurationParameters: '--enable-debug --enable-maintainer-zts'
27+
# - template: azure/macos/job.yml
28+
# parameters:
29+
# configurationName: MACOS_DEBUG_NTS
30+
# configurationParameters: '--enable-debug --disable-maintainer-zts'
31+
# - ${{ if eq(variables['Build.Reason'], 'Schedule') }}:
32+
# - template: azure/job.yml
33+
# parameters:
34+
# configurationName: DEBUG_ZTS
35+
# configurationParameters: '--enable-debug --enable-maintainer-zts'
36+
# - template: azure/job.yml
37+
# parameters:
38+
# configurationName: RELEASE_NTS
39+
# configurationParameters: '--disable-debug --disable-maintainer-zts'
40+
# - template: azure/i386/job.yml
41+
# parameters:
42+
# configurationName: I386_DEBUG_NTS
43+
# configurationParameters: '--enable-debug --disable-maintainer-zts'
44+
# - template: azure/i386/job.yml
45+
# parameters:
46+
# configurationName: I386_RELEASE_NTS
47+
# configurationParameters: '--disable-debug --disable-maintainer-zts'
48+
# - template: azure/i386/job.yml
49+
# parameters:
50+
# configurationName: I386_RELEASE_ZTS
51+
# configurationParameters: '--disable-debug --enable-maintainer-zts'
52+
# - template: azure/macos/job.yml
53+
# parameters:
54+
# configurationName: MACOS_DEBUG_ZTS
55+
# configurationParameters: '--enable-debug --enable-maintainer-zts'
56+
# - template: azure/macos/job.yml
57+
# parameters:
58+
# configurationName: MACOS_RELEASE_NTS
59+
# configurationParameters: '--disable-debug --disable-maintainer-zts'
60+
# - template: azure/macos/job.yml
61+
# parameters:
62+
# configurationName: MACOS_RELEASE_ZTS
63+
# configurationParameters: '--disable-debug --enable-maintainer-zts'
64+
# - template: azure/job.yml
65+
# parameters:
66+
# configurationName: DEBUG_ZTS_ASAN_UBSAN
67+
# configurationParameters: >-
68+
# --enable-debug --enable-maintainer-zts
69+
# CFLAGS='-fsanitize=undefined,address -DZEND_TRACK_ARENA_ALLOC'
70+
# LDFLAGS='-fsanitize=undefined,address'
71+
# runTestsParameters: --asan
72+
# timeoutInMinutes: 120
73+
# - template: azure/msan_job.yml
74+
# parameters:
75+
# configurationName: DEBUG_ZTS_MSAN
76+
# configurationParameters: '--enable-debug --enable-maintainer-zts'
77+
# runTestsParameters: --asan
78+
# - template: azure/community_job.yml
79+
# parameters:
80+
# configurationName: COMMUNITY
81+
# configurationParameters: >-
82+
# --enable-debug --enable-maintainer-zts
83+
# CFLAGS='-fsanitize=undefined,address -fno-sanitize-recover -DZEND_TRACK_ARENA_ALLOC'
84+
# LDFLAGS='-fsanitize=undefined,address'

azure/apt.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,7 @@ steps:
3434
postgresql \
3535
postgresql-contrib \
3636
llvm \
37+
lcov \
38+
gcovr \
3739
${{ parameters.packages }}
3840
displayName: 'APT'

azure/configure.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,6 @@ steps:
5757
--with-mhash \
5858
--enable-werror \
5959
--with-config-file-path=/etc \
60-
--with-config-file-scan-dir=/etc/php.d
60+
--with-config-file-scan-dir=/etc/php.d \
61+
--enable-gcov
6162
displayName: 'Configure Build'

azure/test.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,24 @@ steps:
3131
failTaskOnFailedTests: true
3232
displayName: 'Export ${{ parameters.configurationName }} ${{ parameters.runTestsName }} Results'
3333
condition: or(succeeded(), failed())
34+
- script: |
35+
rm -krf coverage.xml | true
36+
gcovr -sr . -o coverage.xml --xml \
37+
-e '.*/ext/bcmath/libbcmath/.*' \
38+
-e '.*/ext/date/lib/.*' \
39+
-e '.*/ext/fileinfo/libmagic/.*' \
40+
-e '.*/ext/gd/libgd/.*' \
41+
-e '.*/ext/hash/sha3/.*' \
42+
-e '.*/ext/mbstring/libmbfl/.*' \
43+
-e '.*/ext/opcache/jit/libudis86/.*' \
44+
-e '.*/ext/pcre/pcre2lib/.*' \
45+
-e '.*/ext/xmlrpc/libxmlrpc/.*'
46+
displayName: 'Coverage ${{ parameters.configurationName }} ${{ parameters.runTestsName }}'
47+
condition: or(succeeded(), failed())
48+
- task: PublishCodeCoverageResults@1
49+
inputs:
50+
codeCoverageTool: 'Cobertura'
51+
summaryFileLocation: coverage.xml
52+
reportDirectory: coverage
53+
displayName: 'Export ${{ parameters.configurationName }} ${{ parameters.runTestsName }} Coverage'
54+
condition: or(succeeded(), failed())

build/Makefile.gcov

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,42 @@
11
#
2-
# LCOV
2+
# GCOV
33
#
44

5-
lcov: lcov-html
5+
GCOV_EXCLUDES = \
6+
'$(top_srcdir)/ext/bcmath/libbcmath/*' \
7+
'$(top_srcdir)/ext/date/lib/*' \
8+
'$(top_srcdir)/ext/fileinfo/libmagic/*' \
9+
'$(top_srcdir)/ext/gd/libgd/*' \
10+
'$(top_srcdir)/ext/hash/sha3/*' \
11+
'$(top_srcdir)/ext/mbstring/libmbfl/*' \
12+
'$(top_srcdir)/ext/opcache/jit/libudis86/*' \
13+
'$(top_srcdir)/ext/pcre/pcre2lib/*' \
14+
'$(top_srcdir)/ext/xmlrpc/libxmlrpc/*'
615

7-
lcov-test: lcov-clean-data test
8-
9-
php_lcov.info: lcov-test
16+
php_lcov.info: test
1017
@echo "Generating lcov data for $@"
11-
@$(LTP) --capture --no-external --directory . --output-file $@
18+
$(LTP) --capture --no-external --directory . --output-file $@
1219
@echo "Stripping bundled libraries from $@"
13-
@$(LTP) --remove $@ \
14-
'*/<stdout>' \
15-
'$(top_srcdir)/ext/bcmath/libbcmath/*' \
16-
'$(top_srcdir)/ext/date/lib/*' \
17-
'$(top_srcdir)/ext/fileinfo/libmagic/*' \
18-
'$(top_srcdir)/ext/gd/libgd/*' \
19-
'$(top_srcdir)/ext/hash/sha3/*' \
20-
'$(top_srcdir)/ext/mbstring/libmbfl/*' \
21-
'$(top_srcdir)/ext/opcache/jit/libudis86/*' \
22-
'$(top_srcdir)/ext/pcre/pcre2lib/*' \
23-
'$(top_srcdir)/ext/xmlrpc/libxmlrpc/*' \
24-
--output-file $@
20+
$(LTP) --output-file $@ --remove $@ '*/<stdout>' $(GCOV_EXCLUDES)
2521

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

3026
lcov-clean:
3127
rm -f php_lcov.info
3228
rm -rf lcov_html/
3329

3430
lcov-clean-data:
3531
@find . -name \*.gcda -o -name \*.da -o -name \*.bbg? | xargs rm -f
32+
33+
gcovr-html: test
34+
@echo "Generating gcovr HTML"
35+
@rm -rf gcovr_html/
36+
@mkdir gcovr_html
37+
gcovr -sr . -o gcovr_html/index.html --html --html-details $(foreach lib, $(GCOV_EXCLUDES), -e $(lib))
38+
39+
gcovr-xml: test
40+
@echo "Generating gcovr XML"
41+
@rm -f coverage.xml
42+
gcovr -sr . -o coverage.xml --xml $(foreach lib, $(GCOV_EXCLUDES), -e $(lib))

0 commit comments

Comments
 (0)