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

Commit e10892c

Browse files
author
Julien Gilli
committed
test: make test-abort-fatal-error non flaky
Before this change, test/simple/test-abort-fatal-error.js would fail in some environments for reasons I wasn't able to fully understand. It was marked as flaky on some systems, but not on others on which it was failing sometimes (OSX). This change basically syncs test-abort-fatal-error with how it's implemented in v0.12. It back ports 429b587 (or rather the parts that apply to it since it's a merge commit), 2f5e77f and 114bff4. After backporting these changes in v0.10, test-abort-fatal-error is not flaky anymore in environments for which it was flaky. It also has the added benefit of being more robust because it checks exit codes and signals instead of error messages. Tested on OSX and SmartOS, the only platforms on which I could reproduce the flakiness of this test. This change also removes test-abort-fatal-error from the list of flaky tests in test/simple/simple.status. Fixes #25720. PR: #25755 PR-URL: #25755 Reviewed-By: João Reis <[email protected]>
1 parent a2f879f commit e10892c

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

test/simple/simple.status

-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ test-tls-securepair-server : PASS,FLAKY
1717
test-timers-first-fire : PASS,FLAKY
1818

1919
[$system==linux]
20-
test-abort-fatal-error : PASS,FLAKY
2120
test-debugger-client : PASS,FLAKY
2221
test-process-argv-0 : PASS,FLAKY
2322
test-cluster-master-kill : PASS,FLAKY
@@ -29,7 +28,6 @@ test-cluster-master-error : PASS,FLAKY
2928
test-http-exit-delay : PASS,FLAKY
3029

3130
[$system==solaris]
32-
test-abort-fatal-error : PASS,FLAKY
3331
test-debugger-repl : PASS,FLAKY
3432
test-debugger-repl-break-in-module : PASS,FLAKY
3533
test-debugger-repl-utf8 : PASS,FLAKY

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

+15-4
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,21 @@ if (process.platform === 'win32') {
3030
var exec = require('child_process').exec;
3131

3232
var cmdline = 'ulimit -c 0; ' + process.execPath;
33-
cmdline += ' --max-old-space-size=1 --max-new-space-size=1';
34-
cmdline += ' -e "setInterval(function() { new Buffer(1024); }, 1);"';
33+
cmdline += ' --max-old-space-size=4 --max-new-space-size=1';
34+
cmdline += ' -e "a = []; for (i = 0; i < 1e9; i++) { a.push({}) }"';
3535

3636
exec(cmdline, function(err, stdout, stderr) {
37-
assert(err);
38-
assert(stderr.toString().match(/abort/i));
37+
if (!err) {
38+
console.log(stdout);
39+
console.log(stderr);
40+
assert(false, 'this test should fail');
41+
return;
42+
}
43+
44+
if (err.code !== 134 && err.signal !== 'SIGABRT') {
45+
console.log(stdout);
46+
console.log(stderr);
47+
console.log(err);
48+
assert(false, err);
49+
}
3950
});

0 commit comments

Comments
 (0)