mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00
test: fix inconsistency write size in test-fs-readfile-tostring-fail
PR-URL: https://github.com/nodejs/node/pull/51141 Refs: https://github.com/nodejs/node/issues/51133 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Deokjin Kim <deokjin81.kim@gmail.com>
This commit is contained in:
parent
a3a4eff0be
commit
26d39e875f
1 changed files with 3 additions and 2 deletions
|
@ -9,13 +9,15 @@ const assert = require('assert');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const cp = require('child_process');
|
const cp = require('child_process');
|
||||||
const kStringMaxLength = require('buffer').constants.MAX_STRING_LENGTH;
|
const kStringMaxLength = require('buffer').constants.MAX_STRING_LENGTH;
|
||||||
|
const size = Math.floor(kStringMaxLength / 200);
|
||||||
|
|
||||||
if (common.isAIX && (Number(cp.execSync('ulimit -f')) * 512) < kStringMaxLength)
|
if (common.isAIX && (Number(cp.execSync('ulimit -f')) * 512) < kStringMaxLength)
|
||||||
common.skip('intensive toString tests due to file size confinements');
|
common.skip('intensive toString tests due to file size confinements');
|
||||||
|
|
||||||
const tmpdir = require('../common/tmpdir');
|
const tmpdir = require('../common/tmpdir');
|
||||||
tmpdir.refresh();
|
tmpdir.refresh();
|
||||||
|
|
||||||
if (!tmpdir.hasEnoughSpace(kStringMaxLength)) {
|
if (!tmpdir.hasEnoughSpace(kStringMaxLength + size)) {
|
||||||
common.skip(`Not enough space in ${tmpdir.path}`);
|
common.skip(`Not enough space in ${tmpdir.path}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +28,6 @@ const stream = fs.createWriteStream(file, {
|
||||||
|
|
||||||
stream.on('error', (err) => { throw err; });
|
stream.on('error', (err) => { throw err; });
|
||||||
|
|
||||||
const size = kStringMaxLength / 200;
|
|
||||||
const a = Buffer.alloc(size, 'a');
|
const a = Buffer.alloc(size, 'a');
|
||||||
let expectedSize = 0;
|
let expectedSize = 0;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue