diff options
author | Eugene Ostroukhov <eostroukhov@chromium.org> | 2017-02-17 01:45:56 +0300 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2017-03-06 01:25:17 +0300 |
commit | f972bd81c677782c0439b63cafa436f91eeffd78 (patch) | |
tree | 238a6762566c8805d86e9c34db8ac6027abeacaf /test | |
parent | 98d33282d92d09c4e535c3b81ee8e3caf20bd6ae (diff) |
inspector: libuv notification on incoming message
Currently Inspector posts a V8 "task" when a message is incoming. To
make sure messages are processed even when no JS is executed (e.g. while
waiting for I/O or timer), inspector will now post a libuv request.
Fixes: https://github.com/nodejs/node/issues/11589
PR-URL: https://github.com/nodejs/node/pull/11617
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'test')
-rw-r--r-- | test/inspector/inspector-helper.js | 21 | ||||
-rw-r--r-- | test/inspector/test-not-blocked-on-idle.js | 20 |
2 files changed, 38 insertions, 3 deletions
diff --git a/test/inspector/inspector-helper.js b/test/inspector/inspector-helper.js index 3f3fe17e2e0..beaf1a8aa1a 100644 --- a/test/inspector/inspector-helper.js +++ b/test/inspector/inspector-helper.js @@ -427,9 +427,24 @@ Harness.prototype.expectShutDown = function(errorCode) { }); }; -exports.startNodeForInspectorTest = function(callback) { - const child = spawn(process.execPath, - [ '--inspect-brk', mainScript ]); +Harness.prototype.kill = function() { + return this.enqueue_((callback) => { + this.process_.kill(); + callback(); + }); +}; + +exports.startNodeForInspectorTest = function(callback, + inspectorFlag = '--inspect-brk', + opt_script_contents) { + const args = [inspectorFlag]; + if (opt_script_contents) { + args.push('-e', opt_script_contents); + } else { + args.push(mainScript); + } + + const child = spawn(process.execPath, args); const timeoutId = timeout('Child process did not start properly', 4); diff --git a/test/inspector/test-not-blocked-on-idle.js b/test/inspector/test-not-blocked-on-idle.js new file mode 100644 index 00000000000..6d32888b44b --- /dev/null +++ b/test/inspector/test-not-blocked-on-idle.js @@ -0,0 +1,20 @@ +'use strict'; +require('../common'); +const helper = require('./inspector-helper.js'); + +function shouldShutDown(session) { + session + .sendInspectorCommands([ + { 'method': 'Debugger.enable' }, + { 'method': 'Debugger.pause' }, + ]) + .disconnect(true); +} + +function runTests(harness) { + // 1 second wait to make sure the inferior began running the script + setTimeout(() => harness.runFrontendSession([shouldShutDown]).kill(), 1000); +} + +const script = 'setInterval(() => {debugger;}, 60000);'; +helper.startNodeForInspectorTest(runTests, '--inspect', script); |