From 684dd9db2f5f7ad932cbe159685ff261c4fcdc10 Mon Sep 17 00:00:00 2001 From: Jungku Lee Date: Mon, 25 Dec 2023 12:38:40 +0900 Subject: [PATCH] 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 Reviewed-By: Deokjin Kim --- test/pummel/test-fs-readfile-tostring-fail.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/pummel/test-fs-readfile-tostring-fail.js b/test/pummel/test-fs-readfile-tostring-fail.js index 8ffe630076a52d..5863de251f0945 100644 --- a/test/pummel/test-fs-readfile-tostring-fail.js +++ b/test/pummel/test-fs-readfile-tostring-fail.js @@ -9,13 +9,15 @@ const assert = require('assert'); const fs = require('fs'); const cp = require('child_process'); const kStringMaxLength = require('buffer').constants.MAX_STRING_LENGTH; +const size = Math.floor(kStringMaxLength / 200); + if (common.isAIX && (Number(cp.execSync('ulimit -f')) * 512) < kStringMaxLength) common.skip('intensive toString tests due to file size confinements'); const tmpdir = require('../common/tmpdir'); tmpdir.refresh(); -if (!tmpdir.hasEnoughSpace(kStringMaxLength)) { +if (!tmpdir.hasEnoughSpace(kStringMaxLength + size)) { common.skip(`Not enough space in ${tmpdir.path}`); } @@ -26,7 +28,6 @@ const stream = fs.createWriteStream(file, { stream.on('error', (err) => { throw err; }); -const size = kStringMaxLength / 200; const a = Buffer.alloc(size, 'a'); let expectedSize = 0;