build: Add option to compile for coverage reports
Add --coverage option to configure to support compiling for generation of C based coverage reports PR-URL: https://github.com/nodejs/node/pull/9463 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
This commit is contained in:
parent
a41b41a540
commit
5d9d415972
10
configure
vendored
10
configure
vendored
@ -59,6 +59,11 @@ parser.add_option('--prefix',
|
|||||||
default='/usr/local',
|
default='/usr/local',
|
||||||
help='select the install prefix [default: %default]')
|
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',
|
parser.add_option('--debug',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
dest='debug',
|
dest='debug',
|
||||||
@ -857,6 +862,11 @@ def configure_node(o):
|
|||||||
if options.use_xcode and options.use_ninja:
|
if options.use_xcode and options.use_ninja:
|
||||||
raise Exception('--xcode and --ninja cannot be used together.')
|
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):
|
def configure_library(lib, output):
|
||||||
shared_lib = 'shared_' + lib
|
shared_lib = 'shared_' + lib
|
||||||
output['variables']['node_' + shared_lib] = b(getattr(options, shared_lib))
|
output['variables']['node_' + shared_lib] = b(getattr(options, shared_lib))
|
||||||
|
13
node.gyp
13
node.gyp
@ -549,11 +549,22 @@
|
|||||||
'NODE_PLATFORM="sunos"',
|
'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',
|
'ldflags': [ '-Wl,-z,noexecstack',
|
||||||
'-Wl,--whole-archive <(V8_BASE)',
|
'-Wl,--whole-archive <(V8_BASE)',
|
||||||
'-Wl,--no-whole-archive' ]
|
'-Wl,--no-whole-archive' ]
|
||||||
}],
|
}],
|
||||||
|
[ '(OS=="freebsd" or OS=="linux") and node_shared=="false" and coverage=="true"', {
|
||||||
|
'ldflags': [ '-Wl,-z,noexecstack',
|
||||||
|
'-Wl,--whole-archive <(V8_BASE)',
|
||||||
|
'-Wl,--no-whole-archive',
|
||||||
|
'--coverage',
|
||||||
|
'-g',
|
||||||
|
'-O0' ],
|
||||||
|
'cflags': [ '--coverage',
|
||||||
|
'-g',
|
||||||
|
'-O0' ]
|
||||||
|
}],
|
||||||
[ 'OS=="sunos"', {
|
[ 'OS=="sunos"', {
|
||||||
'ldflags': [ '-Wl,-M,/usr/lib/ld/map.noexstk' ],
|
'ldflags': [ '-Wl,-M,/usr/lib/ld/map.noexstk' ],
|
||||||
}],
|
}],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user