From 35348a38c82789e12eda4aa19a5b7debd06da2f8 Mon Sep 17 00:00:00 2001 From: Stefan Budeanu Date: Mon, 22 Feb 2016 21:55:35 -0500 Subject: [PATCH 1/2] test: allow passing args to executable Add --node-args option that will pass arguments. --- test/parallel/test-cluster-debug-port.js | 1 - tools/test.py | 7 ++++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-cluster-debug-port.js b/test/parallel/test-cluster-debug-port.js index 076a59108b09de..e8f3f58b9534db 100644 --- a/test/parallel/test-cluster-debug-port.js +++ b/test/parallel/test-cluster-debug-port.js @@ -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); diff --git a/tools/test.py b/tools/test.py index 217e72b870a6f8..07a2f62ab3e137 100755 --- a/tools/test.py +++ b/tools/test.py @@ -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() @@ -774,11 +775,12 @@ 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 @@ -1281,6 +1283,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", @@ -1471,6 +1475,7 @@ def Main(): buildspace, VERBOSE, shell, + options.node_args, options.timeout, processor, options.suppress_dialogs, From e33136094efddb77150c294be028f1782bdecb2b Mon Sep 17 00:00:00 2001 From: Stefan Budeanu Date: Tue, 23 Feb 2016 13:59:41 -0500 Subject: [PATCH 2/2] WIP: Split line at 80 chars --- tools/test.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/test.py b/tools/test.py index 07a2f62ab3e137..a1401589c9bf14 100755 --- a/tools/test.py +++ b/tools/test.py @@ -775,7 +775,8 @@ def GetTestStatus(self, context, sections, defs): class Context(object): - def __init__(self, workspace, buildspace, verbose, vm, args, 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