Skip to content

Commit 23a584d

Browse files
stefanmbmhdawson
authored andcommitted
test: allow passing args to executable
Add --node-args option that will pass arguments. PR-URL: #5376 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
1 parent 7e51966 commit 23a584d

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

test/parallel/test-cluster-debug-port.js

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ const assert = require('assert');
44
const cluster = require('cluster');
55

66
if (cluster.isMaster) {
7-
assert.strictEqual(process.execArgv.length, 0, 'run test with no args');
87

98
function checkExitCode(code, signal) {
109
assert.strictEqual(code, 0);

tools/test.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,7 @@ def GetConfiguration(self, context):
709709
(file, pathname, description) = imp.find_module('testcfg', [ self.path ])
710710
module = imp.load_module('testcfg', file, pathname, description)
711711
self.config = module.GetConfiguration(context, self.path)
712+
self.config.additional_flags = context.node_args
712713
finally:
713714
if file:
714715
file.close()
@@ -774,11 +775,13 @@ def GetTestStatus(self, context, sections, defs):
774775

775776
class Context(object):
776777

777-
def __init__(self, workspace, buildspace, verbose, vm, timeout, processor, suppress_dialogs, store_unexpected_output):
778+
def __init__(self, workspace, buildspace, verbose, vm, args, timeout,
779+
processor, suppress_dialogs, store_unexpected_output):
778780
self.workspace = workspace
779781
self.buildspace = buildspace
780782
self.verbose = verbose
781783
self.vm_root = vm
784+
self.node_args = args
782785
self.timeout = timeout
783786
self.processor = processor
784787
self.suppress_dialogs = suppress_dialogs
@@ -1281,6 +1284,8 @@ def BuildOptions():
12811284
result.add_option("--snapshot", help="Run the tests with snapshot turned on",
12821285
default=False, action="store_true")
12831286
result.add_option("--special-command", default=None)
1287+
result.add_option("--node-args", dest="node_args", help="Args to pass through to Node",
1288+
default=[], action="append")
12841289
result.add_option("--valgrind", help="Run tests through valgrind",
12851290
default=False, action="store_true")
12861291
result.add_option("--cat", help="Print the source of the tests",
@@ -1471,6 +1476,7 @@ def Main():
14711476
buildspace,
14721477
VERBOSE,
14731478
shell,
1479+
options.node_args,
14741480
options.timeout,
14751481
processor,
14761482
options.suppress_dialogs,

0 commit comments

Comments
 (0)