Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: pass env vars through to test-benchmark-http #13390

Merged
merged 1 commit into from
Jun 7, 2017

Conversation

gibfahn
Copy link
Member

@gibfahn gibfahn commented Jun 2, 2017

Allows NODE_TEST_DIR to be set (necessary to avoid path length issues
with common.PIPE).

Refs: #12708 (comment)

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

test

cc/ @nodejs/benchmarking

CI: https://ci.nodejs.org/job/node-test-commit/10311/

@gibfahn gibfahn added the test Issues and PRs related to the tests. label Jun 2, 2017
@gibfahn gibfahn requested review from Trott and joyeecheung June 2, 2017 09:58
@nodejs-github-bot nodejs-github-bot added the test Issues and PRs related to the tests. label Jun 2, 2017
@gibfahn
Copy link
Member Author

gibfahn commented Jun 2, 2017

If there are issues with this then I could just pass this variable through instead, but I don't think that including the whole environment is an issue, it's not as if we actually care about the benchmark's performance here.

diff --git a/test/sequential/test-benchmark-http.js b/test/sequential/test-benchmark-http.js
index cbeafcb8e6..a703d1b364 100644
--- a/test/sequential/test-benchmark-http.js
+++ b/test/sequential/test-benchmark-http.js
@@ -28,7 +28,8 @@ const child = fork(runjs, ['--set', 'benchmarker=test-double',
                            '--set', 'len=1',
                            '--set', 'n=1',
                            'http'],
-                   {env: {NODEJS_BENCHMARK_ZERO_ALLOWED: 1}});
+                   {env: {NODEJS_BENCHMARK_ZERO_ALLOWED: 1,
+                          NODE_TEST_DIR: process.env.NODE_TEST_DIR}});
 child.on('exit', (code, signal) => {
   assert.strictEqual(code, 0);
   assert.strictEqual(signal, null);

Copy link
Contributor

@refack refack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 nit

@@ -20,6 +20,9 @@ const path = require('path');

const runjs = path.join(__dirname, '..', '..', 'benchmark', 'run.js');

const env = process.env;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe
const env = Object.assign({}, process.env, { NODEJS_BENCHMARK_ZERO_ALLOWED: 1 })
For better hygiene

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find this less readable, so I'd be slightly -1 on this unless there's a benefit. Could you explain what you mean by code hygiene?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at least const env = Object.assign({}, process.env) makes it explicit that you are using a copy, and not mutating the current process's env

@@ -28,7 +31,7 @@ const child = fork(runjs, ['--set', 'benchmarker=test-double',
'--set', 'len=1',
'--set', 'n=1',
'http'],
{env: {NODEJS_BENCHMARK_ZERO_ALLOWED: 1}});
{env: env});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have a thumb-rule/eslint-rule for shorthand properties?

Copy link
Member Author

@gibfahn gibfahn Jun 2, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No (at least the linter passes without).

I didn't realise you could use the shorthand props on Node 4, I do think it's nicer, will update.

Done

@refack refack added the benchmark Issues and PRs related to the benchmark subsystem. label Jun 2, 2017
@gibfahn
Copy link
Member Author

gibfahn commented Jun 2, 2017

@mscdex mscdex added the http Issues or PRs related to the http subsystem. label Jun 2, 2017
Copy link
Member

@Trott Trott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM if CI is green. Thanks for improving this.

@gibfahn
Copy link
Member Author

gibfahn commented Jun 3, 2017

Copy link
Member

@mhdawson mhdawson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Allows NODE_TEST_DIR to be set (necessary to avoid path length issues
with common.PIPE).

PR-URL: nodejs#13390
Refs: nodejs#12708 (comment)
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
@gibfahn gibfahn merged commit eef94a8 into nodejs:master Jun 7, 2017
@gibfahn gibfahn deleted the bench-http-tmpdir branch June 7, 2017 16:00
jasnell pushed a commit that referenced this pull request Jun 7, 2017
Allows NODE_TEST_DIR to be set (necessary to avoid path length issues
with common.PIPE).

PR-URL: #13390
Refs: #12708 (comment)
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
BethGriggs added a commit to BethGriggs/node that referenced this pull request Aug 14, 2017
Allows env vars to be passed through to child processes. This is needed for
things like NODE_TEST_DIR or LD_LIBRARY_PATH if testing the shared library.

Refs: nodejs#13390
tniessen pushed a commit that referenced this pull request Aug 16, 2017
Allows env vars to be passed through to child processes. This is needed
for things like NODE_TEST_DIR or LD_LIBRARY_PATH if testing the shared
library.

PR-URL: #14822
Refs: #13390
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
MSLaguana pushed a commit to nodejs/node-chakracore that referenced this pull request Aug 21, 2017
Allows env vars to be passed through to child processes. This is needed
for things like NODE_TEST_DIR or LD_LIBRARY_PATH if testing the shared
library.

PR-URL: nodejs/node#14822
Refs: nodejs/node#13390
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
MylesBorins pushed a commit that referenced this pull request Sep 10, 2017
Allows env vars to be passed through to child processes. This is needed
for things like NODE_TEST_DIR or LD_LIBRARY_PATH if testing the shared
library.

PR-URL: #14822
Refs: #13390
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
MylesBorins pushed a commit that referenced this pull request Sep 11, 2017
Allows env vars to be passed through to child processes. This is needed
for things like NODE_TEST_DIR or LD_LIBRARY_PATH if testing the shared
library.

PR-URL: #14822
Refs: #13390
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
MylesBorins pushed a commit that referenced this pull request Sep 12, 2017
Allows env vars to be passed through to child processes. This is needed
for things like NODE_TEST_DIR or LD_LIBRARY_PATH if testing the shared
library.

PR-URL: #14822
Refs: #13390
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
BethGriggs added a commit to BethGriggs/node that referenced this pull request Feb 21, 2018
Allows env vars to be passed through to child processes. This is needed
for things like NODE_TEST_DIR or LD_LIBRARY_PATH if testing the shared
library.

PR-URL: nodejs#14822
Refs: nodejs#13390
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
MylesBorins pushed a commit that referenced this pull request Feb 27, 2018
Allows env vars to be passed through to child processes. This is needed
for things like NODE_TEST_DIR or LD_LIBRARY_PATH if testing the shared
library.

Backport-PR-URL: #18883
PR-URL: #14822
Refs: #13390
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
benchmark Issues and PRs related to the benchmark subsystem. http Issues or PRs related to the http subsystem. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants