Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
test: make abort-fatal-error more robust
Browse files Browse the repository at this point in the history
It's saner to check exit codes or signals to determine if the process
actually aborted. On OSX and Linux the exit code is 134, on SunOS it
propagates the SIGABRT signal
  • Loading branch information
tjfontaine committed Jan 28, 2014
1 parent cd2d3ae commit 2f5e77f
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions test/simple/test-abort-fatal-error.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,17 @@ cmdline += ' --max-old-space-size=4 --max-new-space-size=1';
cmdline += ' -e "a = []; for (i = 0; i < 1e9; i++) { a.push({}) }"';

exec(cmdline, function(err, stdout, stderr) {
assert(err);
assert(stderr.toString().match(/abort/i));
if (!err) {
console.log(stdout);
console.log(stderr);
assert(false, 'this test should fail');
return;
}

if (err.code !== 134 || err.signal !== 'SIGABRT') {
console.log(stdout);
console.log(stderr);
console.log(err);
assert(false, err);
}
});

0 comments on commit 2f5e77f

Please sign in to comment.