test: reland changes from 11c1bae

Reland the changes from commit 11c1bae ("lib: make --debug-port work
with cluster") that were temporarily backed out to cherry-pick commits
from joyent/node.

PR-URL: https://github.com/iojs/io.js/pull/501
Reviewed-By: Bert Belder <bertbelder@gmail.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
pull/501/head
Ben Noordhuis 2015-01-19 01:14:02 +01:00
parent 992a1e7f5f
commit 6b91c78e20
1 changed files with 9 additions and 7 deletions

View File

@ -2,10 +2,12 @@ var common = require('../common');
var assert = require('assert'); var assert = require('assert');
var spawn = require('child_process').spawn; var spawn = require('child_process').spawn;
var args = [ common.fixturesDir + '/clustered-server/app.js' ]; var port = common.PORT + 42;
var child = spawn(process.execPath, args, { var args = ['--debug-port=' + port,
stdio: [ 'pipe', 'pipe', 'pipe', 'ipc' ] common.fixturesDir + '/clustered-server/app.js'];
}); var options = { stdio: ['inherit', 'inherit', 'pipe', 'ipc'] };
var child = spawn(process.execPath, args, options);
var outputLines = []; var outputLines = [];
var outputTimerId; var outputTimerId;
var waitingForDebuggers = false; var waitingForDebuggers = false;
@ -61,11 +63,11 @@ process.on('exit', function onExit() {
var expectedLines = [ var expectedLines = [
'Starting debugger agent.', 'Starting debugger agent.',
'Debugger listening on port ' + 5858, 'Debugger listening on port ' + (port + 0),
'Starting debugger agent.', 'Starting debugger agent.',
'Debugger listening on port ' + 5859, 'Debugger listening on port ' + (port + 1),
'Starting debugger agent.', 'Starting debugger agent.',
'Debugger listening on port ' + 5860, 'Debugger listening on port ' + (port + 2),
]; ];
function assertOutputLines() { function assertOutputLines() {