Skip to content

Commit bc733f7

Browse files
committed
test: fix fs.readFile('/dev/stdin') tests
The tests were creating the temp fixture file in both the parent and the child process, leading to interesting race conditions on the slower buildbots. Rod notes that the tests started failing after putting the build directory on a NFS mount. Fixes: #2261 PR-URL: #2265 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]> Reviewed-By: Rod Vagg <[email protected]>
1 parent d168d01 commit bc733f7

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

test/parallel/test-fs-readfile-pipe-large.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@ if (process.platform === 'win32') {
1212

1313
var fs = require('fs');
1414

15-
var filename = path.join(common.tmpDir, '/readfile_pipe_large_test.txt');
16-
var dataExpected = new Array(1000000).join('a');
17-
common.refreshTmpDir();
18-
fs.writeFileSync(filename, dataExpected);
19-
2015
if (process.argv[2] === 'child') {
2116
fs.readFile('/dev/stdin', function(er, data) {
2217
if (er) throw er;
@@ -25,6 +20,11 @@ if (process.argv[2] === 'child') {
2520
return;
2621
}
2722

23+
var filename = path.join(common.tmpDir, '/readfile_pipe_large_test.txt');
24+
var dataExpected = new Array(1000000).join('a');
25+
common.refreshTmpDir();
26+
fs.writeFileSync(filename, dataExpected);
27+
2828
var exec = require('child_process').exec;
2929
var f = JSON.stringify(__filename);
3030
var node = JSON.stringify(process.execPath);

test/parallel/test-fs-readfilesync-pipe-large.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ if (process.platform === 'win32') {
1212

1313
var fs = require('fs');
1414

15-
var filename = path.join(common.tmpDir, '/readfilesync_pipe_large_test.txt');
16-
var dataExpected = new Array(1000000).join('a');
17-
common.refreshTmpDir();
18-
fs.writeFileSync(filename, dataExpected);
19-
2015
if (process.argv[2] === 'child') {
2116
process.stdout.write(fs.readFileSync('/dev/stdin', 'utf8'));
2217
return;
2318
}
2419

20+
var filename = path.join(common.tmpDir, '/readfilesync_pipe_large_test.txt');
21+
var dataExpected = new Array(1000000).join('a');
22+
common.refreshTmpDir();
23+
fs.writeFileSync(filename, dataExpected);
24+
2525
var exec = require('child_process').exec;
2626
var f = JSON.stringify(__filename);
2727
var node = JSON.stringify(process.execPath);

0 commit comments

Comments
 (0)