Skip to content

Commit

Permalink
build: fix coverage build
Browse files Browse the repository at this point in the history
After adding the node_lib target in node.gyp, most of the node source
files are moved to that target. When coverage option is enabled,
corresponding cflags and ldflags are needed in that target as well.
gcovr also needs to check .gcda data for both node and node_lib.

PR-URL: #18409
Fixes: #18402
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
  • Loading branch information
yhwang authored and addaleax committed Feb 27, 2018
1 parent dd917eb commit 4012ae8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,9 @@ coverage-test: coverage-build
$(RM) out/$(BUILDTYPE)/obj.target/node/gen/*.gcda
$(RM) out/$(BUILDTYPE)/obj.target/node/src/*.gcda
$(RM) out/$(BUILDTYPE)/obj.target/node/src/tracing/*.gcda
$(RM) out/$(BUILDTYPE)/obj.target/node_lib/gen/*.gcda
$(RM) out/$(BUILDTYPE)/obj.target/node_lib/src/*.gcda
$(RM) out/$(BUILDTYPE)/obj.target/node_lib/src/tracing/*.gcda
-$(MAKE) $(COVTESTS)
mv lib lib__
mv lib_ lib
Expand All @@ -201,7 +204,7 @@ coverage-test: coverage-build
--temp-directory "$(CURDIR)/.cov_tmp" \
--report-dir "../coverage")
-(cd out && "../gcovr/scripts/gcovr" --gcov-exclude='.*deps' \
--gcov-exclude='.*usr' -v -r Release/obj.target/node \
--gcov-exclude='.*usr' -v -r Release/obj.target \
--html --html-detail -o ../coverage/cxxcoverage.html \
--gcov-executable="$(GCOV)")
mv lib lib_
Expand Down
17 changes: 6 additions & 11 deletions node.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -236,25 +236,20 @@
],
}],
[ '(OS=="freebsd" or OS=="linux") and node_shared=="false"'
' and coverage=="false" and force_load=="true"', {
' and force_load=="true"', {
'ldflags': [ '-Wl,-z,noexecstack',
'-Wl,--whole-archive <(v8_base)',
'-Wl,--no-whole-archive' ]
}],
[ '(OS=="freebsd" or OS=="linux") and node_shared=="false"'
' and coverage=="true" and force_load=="true"', {
'ldflags': [ '-Wl,-z,noexecstack',
'-Wl,--whole-archive <(v8_base)',
'-Wl,--no-whole-archive',
'--coverage',
[ 'OS in "mac freebsd linux" and node_shared=="false"'
' and coverage=="true"', {
'ldflags': [ '--coverage',
'-g',
'-O0' ],
'cflags': [ '--coverage',
'cflags': [ '--coverage',
'-g',
'-O0' ],
'cflags!': [ '-O3' ]
}],
[ 'OS=="mac" and node_shared=="false" and coverage=="true"', {
'cflags!': [ '-O3' ],
'xcode_settings': {
'OTHER_LDFLAGS': [
'--coverage',
Expand Down

0 comments on commit 4012ae8

Please sign in to comment.