diff --git a/test/abort/test-abort-uncaught-exception.js b/test/abort/test-abort-uncaught-exception.js index f9847193769d2d..fb30cfba3cd34a 100644 --- a/test/abort/test-abort-uncaught-exception.js +++ b/test/abort/test-abort-uncaught-exception.js @@ -21,7 +21,7 @@ function run(flags, signals) { child.on('exit', common.mustCall(function(code, sig) { if (common.isWindows) { if (signals) - assert.strictEqual(code, 3); + assert.strictEqual(code, 0xC0000005); else assert.strictEqual(code, 1); } else { diff --git a/test/abort/test-http-parser-consume.js b/test/abort/test-http-parser-consume.js index 4a05a299a8e956..9115aba70dbf17 100644 --- a/test/abort/test-http-parser-consume.js +++ b/test/abort/test-http-parser-consume.js @@ -1,28 +1,33 @@ 'use strict'; const common = require('../common'); const assert = require('assert'); -const http = require('http'); -const spawn = require('child_process').spawn; +const { createServer, get } = require('http'); +const { spawn } = require('child_process'); if (process.argv[2] === 'child') { - const server = http.createServer(common.mustCall((req, res) => { - res.end('hello'); - })); - + // sub-process + const server = createServer(common.mustCall((_, res) => res.end('h'))); server.listen(0, common.mustCall((s) => { - const rr = http.get( - { port: server.address().port }, - common.mustCall((d) => { - // This bad input (0) should abort the parser and the process - rr.parser.consume(0); - server.close(); - })); + const rr = get({ port: server.address().port }, common.mustCall(() => { + // This bad input (0) should abort the parser and the process + rr.parser.consume(0); + // This line should be unreachanble. + assert.fail('this should be unreachable'); + })); })); } else { - const child = spawn(process.execPath, [__filename, 'child'], - { stdio: 'inherit' }); + // super-proces + const child = spawn(process.execPath, [__filename, 'child']); + child.stdout.on('data', common.mustNotCall()); + + let stderr = ''; + child.stderr.on('data', common.mustCallAtLeast((data) => { + assert(Buffer.isBuffer(data)); + stderr += data.toString('utf8'); + }, 1)); child.on('exit', common.mustCall((code, signal) => { - assert(common.nodeProcessAborted(code, signal), - 'process should have aborted, but did not'); + assert(stderr.includes('failed'), `stderr: ${stderr}`); + const didAbort = common.nodeProcessAborted(code, signal); + assert(didAbort, `process did not abort, code:${code} signal:${signal}`); })); } diff --git a/vcbuild.bat b/vcbuild.bat index 08dfc3fd3b3f8e..78f3c242455f3c 100644 --- a/vcbuild.bat +++ b/vcbuild.bat @@ -58,8 +58,8 @@ if /i "%1"=="nosnapshot" set nosnapshot=1&goto arg-ok if /i "%1"=="noetw" set noetw=1&goto arg-ok if /i "%1"=="noperfctr" set noperfctr=1&goto arg-ok if /i "%1"=="licensertf" set licensertf=1&goto arg-ok -if /i "%1"=="test" set test_args=%test_args% doctool known_issues message parallel sequential addons -J&set lint_cpp=1&set lint_js=1&set build_addons=1&goto arg-ok -if /i "%1"=="test-ci" set test_args=%test_args% %test_ci_args% -p tap --logfile test.tap doctool inspector known_issues message sequential parallel addons&set cctest_args=%cctest_args% --gtest_output=tap:cctest.tap&set build_addons=1&goto arg-ok +if /i "%1"=="test" set test_args=%test_args% abort doctool known_issues message parallel sequential addons -J&set lint_cpp=1&set lint_js=1&set build_addons=1&goto arg-ok +if /i "%1"=="test-ci" set test_args=%test_args% %test_ci_args% -p tap --logfile test.tap abort doctool inspector known_issues message sequential parallel addons&set cctest_args=%cctest_args% --gtest_output=tap:cctest.tap&set build_addons=1&goto arg-ok if /i "%1"=="test-addons" set test_args=%test_args% addons&set build_addons=1&goto arg-ok if /i "%1"=="test-simple" set test_args=%test_args% sequential parallel -J&goto arg-ok if /i "%1"=="test-message" set test_args=%test_args% message&goto arg-ok