tools: allow running test.py without configuring
If config.gypi isn't defined, assume Node was build the default way, i.e. with the inspector. PR-URL: https://github.com/nodejs/node/pull/16621 Refs: https://github.com/nodejs/node/pull/16436#issuecomment-340115175 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
This commit is contained in:
parent
5c7b1ecbce
commit
ad1967d656
@ -889,8 +889,7 @@ class Context(object):
|
||||
|
||||
def __init__(self, workspace, buildspace, verbose, vm, args, expect_fail,
|
||||
timeout, processor, suppress_dialogs,
|
||||
store_unexpected_output, repeat, abort_on_timeout,
|
||||
v8_enable_inspector):
|
||||
store_unexpected_output, repeat, abort_on_timeout):
|
||||
self.workspace = workspace
|
||||
self.buildspace = buildspace
|
||||
self.verbose = verbose
|
||||
@ -902,7 +901,7 @@ class Context(object):
|
||||
self.store_unexpected_output = store_unexpected_output
|
||||
self.repeat = repeat
|
||||
self.abort_on_timeout = abort_on_timeout
|
||||
self.v8_enable_inspector = v8_enable_inspector
|
||||
self.v8_enable_inspector = True
|
||||
|
||||
def GetVm(self, arch, mode):
|
||||
if arch == 'none':
|
||||
@ -930,20 +929,6 @@ def RunTestCases(cases_to_run, progress, tasks, flaky_tests_mode):
|
||||
progress = PROGRESS_INDICATORS[progress](cases_to_run, flaky_tests_mode)
|
||||
return progress.Run(tasks)
|
||||
|
||||
def GetV8InspectorEnabledFlag():
|
||||
# The following block reads config.gypi to extract the v8_enable_inspector
|
||||
# value. This is done to check if the inspector is disabled in which case
|
||||
# the '--inspect' flag cannot be passed to the node process as it will
|
||||
# cause node to exit and report the test as failed. The use case
|
||||
# is currently when Node is configured --without-ssl and the tests should
|
||||
# still be runnable but skip any tests that require ssl (which includes the
|
||||
# inspector related tests).
|
||||
with open('config.gypi', 'r') as f:
|
||||
s = f.read()
|
||||
config_gypi = ast.literal_eval(s)
|
||||
return config_gypi['variables']['v8_enable_inspector']
|
||||
|
||||
|
||||
# -------------------------------------------
|
||||
# --- T e s t C o n f i g u r a t i o n ---
|
||||
# -------------------------------------------
|
||||
@ -1626,8 +1611,7 @@ def Main():
|
||||
options.suppress_dialogs,
|
||||
options.store_unexpected_output,
|
||||
options.repeat,
|
||||
options.abort_on_timeout,
|
||||
GetV8InspectorEnabledFlag())
|
||||
options.abort_on_timeout)
|
||||
|
||||
# Get status for tests
|
||||
sections = [ ]
|
||||
@ -1670,6 +1654,12 @@ def Main():
|
||||
all_cases += cases
|
||||
all_unused.append(unused_rules)
|
||||
|
||||
# We want to skip the inspector tests if node was built without the inspector.
|
||||
has_inspector = Execute([vm,
|
||||
"-p", "process.config.variables.v8_enable_inspector"], context)
|
||||
if has_inspector.stdout.rstrip() == "0":
|
||||
context.v8_enable_inspector = False
|
||||
|
||||
if options.cat:
|
||||
visited = set()
|
||||
for test in unclassified_tests:
|
||||
|
Loading…
x
Reference in New Issue
Block a user