Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
test: fix inconsistency write size in test-fs-readfile-tostring-fail
  • Loading branch information
pluris committed Dec 13, 2023
commit be0fb37b629ba9dd279323549ca68b810267c3d2
5 changes: 3 additions & 2 deletions test/pummel/test-fs-readfile-tostring-fail.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = kStringMaxLength / 200;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const size = kStringMaxLength / 200;
const size = Math.floor(kStringMaxLength / 200);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your review. I fixed it. 😄


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}`);
}

Expand All @@ -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;

Expand Down