Skip to content

Commit be0bb5f

Browse files
TrottMyles Borins
authored and
Myles Borins
committed
test: fix unreliable known_issues test
`test-stdout-buffer-flush-on-exit` was not failing reliably on POSIX machines and not failing at all on Windows. Revised test fails reliably on POSIX and is skipped (in CI) on Windows where the issue does not exist. Fixes: #6527 PR-URL: #6555 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Joao Reis <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]>
1 parent 216486c commit be0bb5f

File tree

2 files changed

+31
-4
lines changed

2 files changed

+31
-4
lines changed

test/known_issues/known_issues.status

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
prefix known_issues
2+
3+
# If a known issue does not apply to a platform, list the test name in the
4+
# appropriate section below, without ".js", followed by ": SKIP". Example:
5+
# sample-test : SKIP
6+
7+
[true] # This section applies to all platforms
8+
9+
[$system==win32]
10+
test-stdout-buffer-flush-on-exit: SKIP
11+
12+
[$system==linux]
13+
14+
[$system==macos]
15+
16+
[$system==solaris]
17+
18+
[$system==freebsd]
19+
20+
[$system==aix]

test/known_issues/test-stdout-buffer-flush-on-exit.js

+11-4
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,23 @@ require('../common');
55
const assert = require('assert');
66
const execSync = require('child_process').execSync;
77

8-
const longLine = 'foo bar baz quux quuz aaa bbb ccc'.repeat(65536);
8+
const lineSeed = 'foo bar baz quux quuz aaa bbb ccc';
99

1010
if (process.argv[2] === 'child') {
11+
const longLine = lineSeed.repeat(parseInt(process.argv[4], 10));
1112
process.on('exit', () => {
1213
console.log(longLine);
1314
});
1415
process.exit();
1516
}
1617

17-
const cmd = `${process.execPath} ${__filename} child`;
18-
const stdout = execSync(cmd).toString().trim();
18+
[16, 18, 20].forEach((exponent) => {
19+
const bigNum = Math.pow(2, exponent);
20+
const longLine = lineSeed.repeat(bigNum);
21+
const cmd = `${process.execPath} ${__filename} child ${exponent} ${bigNum}`;
22+
const stdout = execSync(cmd).toString().trim();
23+
24+
assert.strictEqual(stdout, longLine, `failed with exponent ${exponent}`);
25+
});
26+
1927

20-
assert.strictEqual(stdout, longLine);

0 commit comments

Comments
 (0)