Add isolate version of test-child-process-fork
This commit is contained in:
parent
649dbbbd83
commit
4428b70cba
@ -153,6 +153,12 @@ exports.fork = function(modulePath, args, options) {
|
||||
args = args ? args.slice(0) : [];
|
||||
args.unshift(modulePath);
|
||||
|
||||
if (options.thread) {
|
||||
if (!process.features.isolates) {
|
||||
throw new Error('node compiled without isolate support');
|
||||
}
|
||||
}
|
||||
|
||||
if (options.stdinStream) {
|
||||
throw new Error('stdinStream not allowed for fork()');
|
||||
}
|
||||
|
@ -24,7 +24,13 @@ var common = require('../common');
|
||||
var fork = require('child_process').fork;
|
||||
var args = ['foo', 'bar'];
|
||||
|
||||
var n = fork(common.fixturesDir + '/child-process-spawn-node.js', args);
|
||||
var options = {
|
||||
thread: process.TEST_ISOLATE ? true : false
|
||||
};
|
||||
|
||||
var n = fork(common.fixturesDir + '/child-process-spawn-node.js',
|
||||
args,
|
||||
options);
|
||||
assert.deepEqual(args, ['foo', 'bar']);
|
||||
|
||||
var messageCount = 0;
|
||||
|
13
test/simple/test-isolates2.js
Normal file
13
test/simple/test-isolates2.js
Normal file
@ -0,0 +1,13 @@
|
||||
// Skip this test if Node is not compiled with isolates support.
|
||||
if (!process.features.isolates) return;
|
||||
|
||||
var assert = require('assert');
|
||||
|
||||
// This is the same test as test-child-process-fork except it uses isolates
|
||||
// instead of processes. process.TEST_ISOLATE is a ghetto method of passing
|
||||
// some information into the other test.
|
||||
process.TEST_ISOLATE = true;
|
||||
require('./test-child-process-fork');
|
||||
|
||||
var numThreads = process.binding('isolates').count();
|
||||
assert.ok(numThreads > 1);
|
Loading…
x
Reference in New Issue
Block a user