Skip to content
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

Add --coverage option to configure to produce C based coverage reports #9463

Closed
wants to merge 1 commit into from
Closed
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
10 changes: 10 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ parser.add_option('--prefix',
default='/usr/local',
help='select the install prefix [default: %default]')

parser.add_option('--coverage',
action='store_true',
dest='coverage',
help='Build node with code coverage enabled')

parser.add_option('--debug',
action='store_true',
dest='debug',
Expand Down Expand Up @@ -858,6 +863,11 @@ def configure_node(o):
if options.use_xcode and options.use_ninja:
raise Exception('--xcode and --ninja cannot be used together.')

if options.coverage:
o['variables']['coverage'] = 'true'
else:
o['variables']['coverage'] = 'false'

def configure_library(lib, output):
shared_lib = 'shared_' + lib
output['variables']['node_' + shared_lib] = b(getattr(options, shared_lib))
Expand Down
13 changes: 12 additions & 1 deletion node.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -550,11 +550,22 @@
'NODE_PLATFORM="sunos"',
],
}],
[ '(OS=="freebsd" or OS=="linux") and node_shared=="false"', {
[ '(OS=="freebsd" or OS=="linux") and node_shared=="false" and coverage=="false"', {
'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"', {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does generating coverage on macOS work? Does it need any changes like this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@evanlucas I can run coverage on mac, but as the basis of running the CI job is to restrict it to running on Linux-x86, I haven't made any additional changes to support it.

'ldflags': [ '-Wl,-z,noexecstack',
'-Wl,--whole-archive <(V8_BASE)',
'-Wl,--no-whole-archive',
'--coverage',
'-g',
'-O0' ],
'cflags': [ '--coverage',
'-g',
'-O0' ]
}],
[ 'OS=="sunos"', {
'ldflags': [ '-Wl,-M,/usr/lib/ld/map.noexstk' ],
}],
Expand Down