diff options
author | Stanislav Ochotnicky <sochotnicky@redhat.com> | 2013-04-16 11:51:56 +0400 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2013-04-16 19:05:51 +0400 |
commit | 7592615aaa1eb7a18dca1b9ab70865bbfd99a80d (patch) | |
tree | 36ed5fb90e221b29a26c6c0d2aeecaca36c1806c /test | |
parent | 47198af55a384788cda34c430531d928e24ae261 (diff) |
test: preserve process.env after test-init exec
When LD_LIBRARY_PATH is overriden for custom builds we need to preserve
it for child processes. To be sure we preserve whole environment of
parent process and just add TEST_INIT variable to it.
Diffstat (limited to 'test')
-rw-r--r-- | test/simple/test-init.js | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/test/simple/test-init.js b/test/simple/test-init.js index da059846d15..139df7f58b3 100644 --- a/test/simple/test-init.js +++ b/test/simple/test-init.js @@ -34,12 +34,16 @@ // being in the test folder process.chdir(__dirname); - child.exec(process.execPath + ' test-init', {env: {'TEST_INIT': 1}}, + // slow but simple + var envCopy = JSON.parse(JSON.stringify(process.env)); + envCopy.TEST_INIT = 1; + + child.exec(process.execPath + ' test-init', {env: envCopy}, function(err, stdout, stderr) { assert.equal(stdout, 'Loaded successfully!', '`node test-init` failed!'); }); - child.exec(process.execPath + ' test-init.js', {env: {'TEST_INIT': 1}}, + child.exec(process.execPath + ' test-init.js', {env: envCopy}, function(err, stdout, stderr) { assert.equal(stdout, 'Loaded successfully!', '`node test-init.js` failed!'); @@ -48,7 +52,7 @@ // test-init-index is in fixtures dir as requested by ry, so go there process.chdir(common.fixturesDir); - child.exec(process.execPath + ' test-init-index', {env: {'TEST_INIT': 1}}, + child.exec(process.execPath + ' test-init-index', {env: envCopy}, function(err, stdout, stderr) { assert.equal(stdout, 'Loaded successfully!', '`node test-init-index failed!'); @@ -59,7 +63,7 @@ // expected in node process.chdir(common.fixturesDir + '/test-init-native/'); - child.exec(process.execPath + ' fs', {env: {'TEST_INIT': 1}}, + child.exec(process.execPath + ' fs', {env: envCopy}, function(err, stdout, stderr) { assert.equal(stdout, 'fs loaded successfully', '`node fs` failed!'); |