Skip to content

Commit

Permalink
build: do not build with code cache for core coverage collection
Browse files Browse the repository at this point in the history
Disable code cache for built-ins when are building Node.js to
collect test coverage of built-ins, as code caching makes the
V8 coverage collection less precises (specifically, all the
functions deserialized from the code cache will not have
block-level coverage data).

Data from local testing:

Before:

---------|----------|---------|---------
 % Stmts | % Branch | % Funcs | % Lines
---------|----------|---------|---------
   95.58 |    94.43 |   95.19 |   95.58
---------|----------|---------|---------

After:

---------|----------|---------|---------
 % Stmts | % Branch | % Funcs | % Lines
---------|----------|---------|---------
   95.93 |    94.77 |   96.03 |   95.93
---------|----------|---------|---------

PR-URL: #54633
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
  • Loading branch information
joyeecheung authored and aduh95 committed Sep 12, 2024
1 parent 97cbcfb commit 948bba3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -1436,7 +1436,9 @@ def configure_node(o):
o['variables']['node_use_node_snapshot'] = b(
not cross_compiling and not options.shared)

if options.without_node_code_cache or options.without_node_snapshot or options.node_builtin_modules_path:
# Do not use code cache when Node.js is built for collecting coverage of itself, this allows more
# precise coverage for the JS built-ins.
if options.without_node_code_cache or options.without_node_snapshot or options.node_builtin_modules_path or options.coverage:
o['variables']['node_use_node_code_cache'] = 'false'
else:
# TODO(refack): fix this when implementing embedded code-cache when cross-compiling.
Expand Down

0 comments on commit 948bba3

Please sign in to comment.