Browse Source

test: make abort-fatal-error more robust

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
v0.11.11-release
Timothy J Fontaine 11 years ago
parent
commit
2f5e77f55b
  1. 15
      test/simple/test-abort-fatal-error.js

15
test/simple/test-abort-fatal-error.js

@ -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({}) }"'; cmdline += ' -e "a = []; for (i = 0; i < 1e9; i++) { a.push({}) }"';
exec(cmdline, function(err, stdout, stderr) { exec(cmdline, function(err, stdout, stderr) {
assert(err); if (!err) {
assert(stderr.toString().match(/abort/i)); 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);
}
}); });

Loading…
Cancel
Save