Uh oh!
There was an error while loading. Please reload this page.
test: allow passing args to executable - #5376
Conversation
Add --node-args option that will pass arguments.
stefanmb
commented
Feb 23, 2016
bnoordhuis
commented
Feb 23, 2016
LGTM. Maybe break up the long line. CI: https://ci.nodejs.org/job/node-test-pull-request/1731/ |
Fishrock123
commented
Feb 23, 2016
Can't you already pass arguments to node by having a comment at the top of the file ala https://github.com/nodejs/node/blob/master/test/parallel/test-repl-persistent-history.js#L3 ? Am I missing something? |
stefanmb
commented
Feb 23, 2016
@Fishrock123 That facility is provided in test/testpy/init.py by statically scanning the source of each file, which is similar to what I'm proposing here, but not identical. The requirement here is to be able to dynamically choose whether to pass a flag to every test, or not, at runtime. Specifically, for FIPS builds (which now default to FIPS off) the test suites have to be run twice, once with FIPS off, and once with FIPS on. This can be achieved by passing --enable-fips to the Node executable under test, using the "additional_flags" variable already present in test/testpy/init.py Further details are included in #5181. |
Fishrock123
commented
Feb 23, 2016
Ah, makes sense. 👌 |
stefanmb
commented
Feb 23, 2016
@bnoordhuis I split the function signature as indicated, thanks. |
Trott
commented
Feb 23, 2016
As much as I dislike adding more stuff to |
mhdawson
commented
Feb 25, 2016
LGTM. going to land |
mhdawson
commented
Feb 25, 2016
mhdawson
commented
Feb 25, 2016
Only one failure in CI which is unrelated to this change - reopened #5184 and added link to failure |
Add --node-args option that will pass arguments. PR-URL: #5376 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
mhdawson
commented
Feb 25, 2016
Landed as 23a584d |
stefanmb
commented
Feb 26, 2016
This PR introduced a regression that is fixed in #5446. |
Add --node-args option that will pass arguments. PR-URL: #5376 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Add --node-args option that will pass arguments. PR-URL: #5376 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
To set up CI jobs for #5181 there has to be a way to pass an argument to the Node executable at test time. The makefile supports the TEST_CI_ARGS environment variable, but the test harness (test.py) provides no facility to further pass the argument to the executable under test.
There is a "--special-command" argument, but it is only able to suffix or prefix the existing command line in the format [node, test] so it is insufficient to produce commands in the form [node, node_args, test]. In this PR I've introduced an extra argument to the test harness called --node-args which can be used to pass commands verbatim.
Some support for this feature already existed in test/init.py in the form of the "additional" argument, however none of the individual test modules' testcfg.py make use of it, so in the interest of minimal footprint I've opted to directly set this value form test.py, instead of passing it through as a constructor argument.
There is an additional complication in "test-cluster-debug-port.js" which for reasons that are unclear refuses to run if any arguments are passed to the process. I've simply relaxed this requirement.