mirror of https://github.com/nodejs/node.git
test: pass process.env to child processes
For variables such as LD_LIBRARY_PATH and DYLD_LIBRARY_PATH that are needed for dynamically linked binaries PR-URL: https://github.com/nodejs/node/pull/16405 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>pull/16876/head
parent
5e1e460ac1
commit
3b3ceafaf9
|
@ -91,11 +91,9 @@ class TestDoubleBenchmarker {
|
||||||
create(options) {
|
create(options) {
|
||||||
const child = child_process.fork(this.executable, {
|
const child = child_process.fork(this.executable, {
|
||||||
silent: true,
|
silent: true,
|
||||||
env: {
|
env: Object.assign({}, process.env, {
|
||||||
duration: options.duration,
|
test_url: `http://127.0.0.1:${options.port}${options.path}`
|
||||||
connections: options.connections,
|
})
|
||||||
path: `http://127.0.0.1:${options.port}${options.path}`
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
return child;
|
return child;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
|
|
||||||
const http = require('http');
|
const http = require('http');
|
||||||
|
|
||||||
http.get(process.env.path, function() {
|
http.get(process.env.test_url, function() {
|
||||||
console.log(JSON.stringify({ throughput: 1 }));
|
console.log(JSON.stringify({ throughput: 1 }));
|
||||||
});
|
});
|
||||||
|
|
|
@ -8,7 +8,7 @@ const expected = common.isWindows ? '%foo%' : '$foo';
|
||||||
if (process.argv[2] === undefined) {
|
if (process.argv[2] === undefined) {
|
||||||
const child = cp.fork(__filename, [expected], {
|
const child = cp.fork(__filename, [expected], {
|
||||||
shell: true,
|
shell: true,
|
||||||
env: { foo: 'bar' }
|
env: Object.assign({}, process.env, { foo: 'bar' })
|
||||||
});
|
});
|
||||||
|
|
||||||
child.on('exit', common.mustCall((code, signal) => {
|
child.on('exit', common.mustCall((code, signal) => {
|
||||||
|
|
|
@ -311,11 +311,11 @@ function workerProcessMain() {
|
||||||
function spawnMaster({ execArgv, workers, clusterSettings = {} }) {
|
function spawnMaster({ execArgv, workers, clusterSettings = {} }) {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
childProcess.fork(__filename, {
|
childProcess.fork(__filename, {
|
||||||
env: {
|
env: Object.assign({}, process.env, {
|
||||||
workers: JSON.stringify(workers),
|
workers: JSON.stringify(workers),
|
||||||
clusterSettings: JSON.stringify(clusterSettings),
|
clusterSettings: JSON.stringify(clusterSettings),
|
||||||
testProcess: true
|
testProcess: true
|
||||||
},
|
}),
|
||||||
execArgv
|
execArgv
|
||||||
}).on('exit', common.mustCall((code, signal) => {
|
}).on('exit', common.mustCall((code, signal) => {
|
||||||
checkExitCode(code, signal);
|
checkExitCode(code, signal);
|
||||||
|
|
Loading…
Reference in New Issue