Skip to content

Commit

Permalink
test: fix unreliable known_issues test
Browse files Browse the repository at this point in the history
`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: nodejs#6527
PR-URL: nodejs#6555
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Joao Reis <reis@janeasystems.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
  • Loading branch information
Trott committed May 6, 2016
1 parent 2bceda6 commit c4006dd
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 4 deletions.
20 changes: 20 additions & 0 deletions test/known_issues/known_issues.status
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
prefix known_issues

# If a known issue does not apply to a platform, list the test name in the
# appropriate section below, without ".js", followed by ": SKIP". Example:
# sample-test : SKIP

[true] # This section applies to all platforms

[$system==win32]
test-stdout-buffer-flush-on-exit: SKIP

[$system==linux]

[$system==macos]

[$system==solaris]

[$system==freebsd]

[$system==aix]
15 changes: 11 additions & 4 deletions test/known_issues/test-stdout-buffer-flush-on-exit.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,23 @@ require('../common');
const assert = require('assert');
const execSync = require('child_process').execSync;

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

if (process.argv[2] === 'child') {
const longLine = lineSeed.repeat(parseInt(process.argv[4], 10));
process.on('exit', () => {
console.log(longLine);
});
process.exit();
}

const cmd = `${process.execPath} ${__filename} child`;
const stdout = execSync(cmd).toString().trim();
[16, 18, 20].forEach((exponent) => {
const bigNum = Math.pow(2, exponent);
const longLine = lineSeed.repeat(bigNum);
const cmd = `${process.execPath} ${__filename} child ${exponent} ${bigNum}`;
const stdout = execSync(cmd).toString().trim();

assert.strictEqual(stdout, longLine, `failed with exponent ${exponent}`);
});


assert.strictEqual(stdout, longLine);

0 comments on commit c4006dd

Please sign in to comment.