Skip to content

Commit ad1967d

Browse files
committed
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: nodejs#16621 Refs: nodejs#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>
1 parent 5c7b1ec commit ad1967d

File tree

1 file changed

+9
-19
lines changed

1 file changed

+9
-19
lines changed

tools/test.py

+9-19
Original file line numberDiff line numberDiff line change
@@ -889,8 +889,7 @@ class Context(object):
889889

890890
def __init__(self, workspace, buildspace, verbose, vm, args, expect_fail,
891891
timeout, processor, suppress_dialogs,
892-
store_unexpected_output, repeat, abort_on_timeout,
893-
v8_enable_inspector):
892+
store_unexpected_output, repeat, abort_on_timeout):
894893
self.workspace = workspace
895894
self.buildspace = buildspace
896895
self.verbose = verbose
@@ -902,7 +901,7 @@ def __init__(self, workspace, buildspace, verbose, vm, args, expect_fail,
902901
self.store_unexpected_output = store_unexpected_output
903902
self.repeat = repeat
904903
self.abort_on_timeout = abort_on_timeout
905-
self.v8_enable_inspector = v8_enable_inspector
904+
self.v8_enable_inspector = True
906905

907906
def GetVm(self, arch, mode):
908907
if arch == 'none':
@@ -930,20 +929,6 @@ def RunTestCases(cases_to_run, progress, tasks, flaky_tests_mode):
930929
progress = PROGRESS_INDICATORS[progress](cases_to_run, flaky_tests_mode)
931930
return progress.Run(tasks)
932931

933-
def GetV8InspectorEnabledFlag():
934-
# The following block reads config.gypi to extract the v8_enable_inspector
935-
# value. This is done to check if the inspector is disabled in which case
936-
# the '--inspect' flag cannot be passed to the node process as it will
937-
# cause node to exit and report the test as failed. The use case
938-
# is currently when Node is configured --without-ssl and the tests should
939-
# still be runnable but skip any tests that require ssl (which includes the
940-
# inspector related tests).
941-
with open('config.gypi', 'r') as f:
942-
s = f.read()
943-
config_gypi = ast.literal_eval(s)
944-
return config_gypi['variables']['v8_enable_inspector']
945-
946-
947932
# -------------------------------------------
948933
# --- T e s t C o n f i g u r a t i o n ---
949934
# -------------------------------------------
@@ -1626,8 +1611,7 @@ def Main():
16261611
options.suppress_dialogs,
16271612
options.store_unexpected_output,
16281613
options.repeat,
1629-
options.abort_on_timeout,
1630-
GetV8InspectorEnabledFlag())
1614+
options.abort_on_timeout)
16311615

16321616
# Get status for tests
16331617
sections = [ ]
@@ -1670,6 +1654,12 @@ def Main():
16701654
all_cases += cases
16711655
all_unused.append(unused_rules)
16721656

1657+
# We want to skip the inspector tests if node was built without the inspector.
1658+
has_inspector = Execute([vm,
1659+
"-p", "process.config.variables.v8_enable_inspector"], context)
1660+
if has_inspector.stdout.rstrip() == "0":
1661+
context.v8_enable_inspector = False
1662+
16731663
if options.cat:
16741664
visited = set()
16751665
for test in unclassified_tests:

0 commit comments

Comments
 (0)