From 8089011c4c7c8d97aca141f1f1e190a019561c9c Mon Sep 17 00:00:00 2001 From: Richard Lau Date: Wed, 22 Jun 2022 19:23:01 +0100 Subject: [PATCH] test: allow EOVERFLOW errors in fs position tests Some platforms may return `EOVERFLOW` errors instead of `EFBIG`. PR-URL: https://github.com/nodejs/node/pull/43510 Refs: https://github.com/nodejs/node/pull/42999 Refs: https://github.com/nodejs/node/issues/43509 Reviewed-By: LiviaMedeiros Reviewed-By: Santiago Gimeno Reviewed-By: Luigi Pinca --- test/parallel/test-fs-read-position-validation.mjs | 6 +++--- test/parallel/test-fs-readSync-position-validation.mjs | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/parallel/test-fs-read-position-validation.mjs b/test/parallel/test-fs-read-position-validation.mjs index 919a8dd1419..1b65dc19a2e 100644 --- a/test/parallel/test-fs-read-position-validation.mjs +++ b/test/parallel/test-fs-read-position-validation.mjs @@ -12,7 +12,7 @@ const offset = 0; const length = buffer.byteLength; // allowedErrors is an array of acceptable internal errors -// For example, on some platforms read syscall might return -EFBIG +// For example, on some platforms read syscall might return -EFBIG or -EOVERFLOW async function testValid(position, allowedErrors = []) { return new Promise((resolve, reject) => { fs.open(filepath, 'r', common.mustSucceed((fd) => { @@ -71,9 +71,9 @@ async function testInvalid(code, position) { await testValid(1n); await testValid(9); await testValid(9n); - await testValid(Number.MAX_SAFE_INTEGER, [ 'EFBIG' ]); + await testValid(Number.MAX_SAFE_INTEGER, [ 'EFBIG', 'EOVERFLOW' ]); - await testValid(2n ** 63n - 1n - BigInt(length), [ 'EFBIG' ]); + await testValid(2n ** 63n - 1n - BigInt(length), [ 'EFBIG', 'EOVERFLOW' ]); await testInvalid('ERR_OUT_OF_RANGE', 2n ** 63n); // TODO(LiviaMedeiros): test `2n ** 63n - BigInt(length)` diff --git a/test/parallel/test-fs-readSync-position-validation.mjs b/test/parallel/test-fs-readSync-position-validation.mjs index 5cf40ba1b08..1c3b22ac86d 100644 --- a/test/parallel/test-fs-readSync-position-validation.mjs +++ b/test/parallel/test-fs-readSync-position-validation.mjs @@ -12,7 +12,7 @@ const offset = 0; const length = buffer.byteLength; // allowedErrors is an array of acceptable internal errors -// For example, on some platforms read syscall might return -EFBIG +// For example, on some platforms read syscall might return -EFBIG or -EOVERFLOW function testValid(position, allowedErrors = []) { let fdSync; try { @@ -57,9 +57,9 @@ function testInvalid(code, position, internalCatch = false) { testValid(1n); testValid(9); testValid(9n); - testValid(Number.MAX_SAFE_INTEGER, [ 'EFBIG' ]); + testValid(Number.MAX_SAFE_INTEGER, [ 'EFBIG', 'EOVERFLOW' ]); - testValid(2n ** 63n - 1n - BigInt(length), [ 'EFBIG' ]); + testValid(2n ** 63n - 1n - BigInt(length), [ 'EFBIG', 'EOVERFLOW' ]); testInvalid('ERR_OUT_OF_RANGE', 2n ** 63n); // TODO(LiviaMedeiros): test `2n ** 63n - BigInt(length)`