Skip to content

Commit

Permalink
tools: allow running test.py without configuring
Browse files Browse the repository at this point in the history
If config.gypi isn't defined, assume Node was build the default way,
i.e. with the inspector.

PR-URL: #16621
Refs: #16436 (comment)
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>
  • Loading branch information
gibfahn committed Dec 19, 2017
1 parent 56afb7f commit 92e0e2e
Showing 1 changed file with 9 additions and 19 deletions.
28 changes: 9 additions & 19 deletions tools/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -902,7 +901,7 @@ def __init__(self, workspace, buildspace, verbose, vm, args, expect_fail,
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':
Expand Down Expand Up @@ -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 ---
# -------------------------------------------
Expand Down Expand Up @@ -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 = [ ]
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 92e0e2e

Please sign in to comment.