2015-05-14 19:46:54 +02:00
|
|
|
'use strict';
|
|
|
|
|
2015-09-28 00:31:36 +02:00
|
|
|
require('../common');
|
2015-05-14 19:46:54 +02:00
|
|
|
const assert = require('assert');
|
2015-05-29 22:08:16 +02:00
|
|
|
const execFile = require('child_process').execFile;
|
2015-05-14 19:46:54 +02:00
|
|
|
|
|
|
|
if (process.argv[2] === 'child') {
|
|
|
|
setImmediate(function() {
|
|
|
|
require('fs').readFileSync(__filename);
|
|
|
|
process.exit();
|
|
|
|
});
|
|
|
|
|
|
|
|
} else {
|
|
|
|
(function runTest(flags) {
|
2017-01-08 14:19:00 +01:00
|
|
|
const execArgv = [flags.pop()];
|
|
|
|
let args = [__filename, 'child'];
|
|
|
|
let cntr = 0;
|
2015-05-29 22:08:16 +02:00
|
|
|
args = execArgv.concat(args);
|
|
|
|
if (!args[0]) args.shift();
|
|
|
|
execFile(process.execPath, args, function(err, stdout, stderr) {
|
2017-01-08 16:36:25 +01:00
|
|
|
assert.strictEqual(err, null);
|
|
|
|
assert.strictEqual(stdout, '');
|
2015-11-17 09:59:30 +01:00
|
|
|
if (/WARNING[\s\S]*fs\.readFileSync/.test(stderr))
|
2015-05-29 22:08:16 +02:00
|
|
|
cntr++;
|
|
|
|
if (args[0] === '--trace-sync-io') {
|
2017-01-08 16:36:25 +01:00
|
|
|
assert.strictEqual(cntr, 1);
|
2015-05-29 22:08:16 +02:00
|
|
|
} else if (args[0] === __filename) {
|
2017-01-08 16:36:25 +01:00
|
|
|
assert.strictEqual(cntr, 0);
|
2015-05-20 11:29:08 +02:00
|
|
|
} else {
|
2015-05-14 19:46:54 +02:00
|
|
|
throw new Error('UNREACHABLE');
|
2015-05-20 11:29:08 +02:00
|
|
|
}
|
2015-05-14 19:46:54 +02:00
|
|
|
if (flags.length > 0)
|
|
|
|
setImmediate(runTest, flags);
|
|
|
|
});
|
2015-05-29 22:08:16 +02:00
|
|
|
}(['--trace-sync-io', '']));
|
2015-05-14 19:46:54 +02:00
|
|
|
}
|