Skip to content

Commit 7ca58b8

Browse files
richardlautargos
authored andcommitted
test: allow EOVERFLOW errors in fs position tests
Some platforms may return `EOVERFLOW` errors instead of `EFBIG`. PR-URL: #43510 Refs: #42999 Refs: #43509 Reviewed-By: LiviaMedeiros <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent 2e799bc commit 7ca58b8

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

test/parallel/test-fs-read-position-validation.mjs

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const offset = 0;
1212
const length = buffer.byteLength;
1313

1414
// allowedErrors is an array of acceptable internal errors
15-
// For example, on some platforms read syscall might return -EFBIG
15+
// For example, on some platforms read syscall might return -EFBIG or -EOVERFLOW
1616
async function testValid(position, allowedErrors = []) {
1717
return new Promise((resolve, reject) => {
1818
fs.open(filepath, 'r', common.mustSucceed((fd) => {
@@ -71,9 +71,9 @@ async function testInvalid(code, position) {
7171
await testValid(1n);
7272
await testValid(9);
7373
await testValid(9n);
74-
await testValid(Number.MAX_SAFE_INTEGER, [ 'EFBIG' ]);
74+
await testValid(Number.MAX_SAFE_INTEGER, [ 'EFBIG', 'EOVERFLOW' ]);
7575

76-
await testValid(2n ** 63n - 1n - BigInt(length), [ 'EFBIG' ]);
76+
await testValid(2n ** 63n - 1n - BigInt(length), [ 'EFBIG', 'EOVERFLOW' ]);
7777
await testInvalid('ERR_OUT_OF_RANGE', 2n ** 63n);
7878

7979
// TODO(LiviaMedeiros): test `2n ** 63n - BigInt(length)`

test/parallel/test-fs-readSync-position-validation.mjs

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const offset = 0;
1212
const length = buffer.byteLength;
1313

1414
// allowedErrors is an array of acceptable internal errors
15-
// For example, on some platforms read syscall might return -EFBIG
15+
// For example, on some platforms read syscall might return -EFBIG or -EOVERFLOW
1616
function testValid(position, allowedErrors = []) {
1717
let fdSync;
1818
try {
@@ -57,9 +57,9 @@ function testInvalid(code, position, internalCatch = false) {
5757
testValid(1n);
5858
testValid(9);
5959
testValid(9n);
60-
testValid(Number.MAX_SAFE_INTEGER, [ 'EFBIG' ]);
60+
testValid(Number.MAX_SAFE_INTEGER, [ 'EFBIG', 'EOVERFLOW' ]);
6161

62-
testValid(2n ** 63n - 1n - BigInt(length), [ 'EFBIG' ]);
62+
testValid(2n ** 63n - 1n - BigInt(length), [ 'EFBIG', 'EOVERFLOW' ]);
6363
testInvalid('ERR_OUT_OF_RANGE', 2n ** 63n);
6464

6565
// TODO(LiviaMedeiros): test `2n ** 63n - BigInt(length)`

0 commit comments

Comments
 (0)