Skip to content

Commit

Permalink
test: allow passing args to executable
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
stefanmb authored and rvagg committed Feb 27, 2016
1 parent 3fb48ba commit 1082bce
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 0 additions & 1 deletion test/parallel/test-cluster-debug-port.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const assert = require('assert');
const cluster = require('cluster');

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

function checkExitCode(code, signal) {
assert.strictEqual(code, 0);
Expand Down
8 changes: 7 additions & 1 deletion tools/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,7 @@ def GetConfiguration(self, context):
(file, pathname, description) = imp.find_module('testcfg', [ self.path ])
module = imp.load_module('testcfg', file, pathname, description)
self.config = module.GetConfiguration(context, self.path)
self.config.additional_flags = context.node_args
finally:
if file:
file.close()
Expand Down Expand Up @@ -774,11 +775,13 @@ def GetTestStatus(self, context, sections, defs):

class Context(object):

def __init__(self, workspace, buildspace, verbose, vm, timeout, processor, suppress_dialogs, store_unexpected_output):
def __init__(self, workspace, buildspace, verbose, vm, args, timeout,
processor, suppress_dialogs, store_unexpected_output):
self.workspace = workspace
self.buildspace = buildspace
self.verbose = verbose
self.vm_root = vm
self.node_args = args
self.timeout = timeout
self.processor = processor
self.suppress_dialogs = suppress_dialogs
Expand Down Expand Up @@ -1281,6 +1284,8 @@ def BuildOptions():
result.add_option("--snapshot", help="Run the tests with snapshot turned on",
default=False, action="store_true")
result.add_option("--special-command", default=None)
result.add_option("--node-args", dest="node_args", help="Args to pass through to Node",
default=[], action="append")
result.add_option("--valgrind", help="Run tests through valgrind",
default=False, action="store_true")
result.add_option("--cat", help="Print the source of the tests",
Expand Down Expand Up @@ -1471,6 +1476,7 @@ def Main():
buildspace,
VERBOSE,
shell,
options.node_args,
options.timeout,
processor,
options.suppress_dialogs,
Expand Down

0 comments on commit 1082bce

Please sign in to comment.