From c4006ddfc35796db1179eca7a4547bb5aec19ba8 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Tue, 3 May 2016 11:29:37 -0700 Subject: [PATCH] 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: https://github.com/nodejs/node/issues/6527 PR-URL: https://github.com/nodejs/node/pull/6555 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Anna Henningsen Reviewed-By: Joao Reis Reviewed-By: Santiago Gimeno --- test/known_issues/known_issues.status | 20 +++++++++++++++++++ .../test-stdout-buffer-flush-on-exit.js | 15 ++++++++++---- 2 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 test/known_issues/known_issues.status diff --git a/test/known_issues/known_issues.status b/test/known_issues/known_issues.status new file mode 100644 index 0000000000..12e4b10d06 --- /dev/null +++ b/test/known_issues/known_issues.status @@ -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] diff --git a/test/known_issues/test-stdout-buffer-flush-on-exit.js b/test/known_issues/test-stdout-buffer-flush-on-exit.js index f4ea0b5e01..be29081007 100644 --- a/test/known_issues/test-stdout-buffer-flush-on-exit.js +++ b/test/known_issues/test-stdout-buffer-flush-on-exit.js @@ -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);