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);

@gibfahn gibfahn force-pushed the bench-http-tmpdir branch from 9345ff9 to e12f8b0 Compare June 2, 2017 12:17
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 gibfahn force-pushed the bench-http-tmpdir branch from e12f8b0 to f5c5410 Compare June 2, 2017 12:34
@gibfahn
Copy link
Member Author

gibfahn commented Jun 2, 2017

@gibfahn gibfahn force-pushed the bench-http-tmpdir branch from f5c5410 to b3b9253 Compare June 2, 2017 13:02
@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 <joyeec9h3@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
@gibfahn gibfahn force-pushed the bench-http-tmpdir branch from b3b9253 to eef94a8 Compare June 7, 2017 15:41
@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 <joyeec9h3@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
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 <cjihrig@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
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 <cjihrig@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
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 <cjihrig@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
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 <cjihrig@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
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 <cjihrig@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
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 <cjihrig@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
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 <cjihrig@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
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