mirror of
https://github.com/nodejs/node.git
synced 2026-11-25 23:01:06 -05:00
test: handle stringbytes allocation failures
Buffer.allocUnsafe() can throw ERR_MEMORY_ALLOCATION_FAILED under memory pressure. Accept it alongside the V8 allocation-failure message so the tests take their intended low-memory skip. Signed-off-by: Filip Skokan <panva.ip@gmail.com> Assisted-by: Codex PR-URL: https://github.com/nodejs/node/pull/66887 Reviewed-By: Richard Lau <richard.lau@ibm.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
This commit is contained in:
1 parent
5fd81baf19
commit
08428bebf4
8 files changed
+16
-8
No files matched your search
@@ -17,7 +17,8 @@ try {
|
||||
buf = Buffer.allocUnsafe(kStringMaxLength);
|
||||
} catch (e) {
|
||||
// If the exception is not due to memory confinement then rethrow it.
|
||||
if (e.message !== 'Array buffer allocation failed') throw (e);
|
||||
if (e.code !== 'ERR_MEMORY_ALLOCATION_FAILED' &&
|
||||
e.message !== 'Array buffer allocation failed') throw (e);
|
||||
common.skip(skipMessage);
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -17,7 +17,8 @@ try {
|
||||
buf = Buffer.allocUnsafe(kStringMaxLength + 1);
|
||||
} catch (e) {
|
||||
// If the exception is not due to memory confinement then rethrow it.
|
||||
if (e.message !== 'Array buffer allocation failed') throw (e);
|
||||
if (e.code !== 'ERR_MEMORY_ALLOCATION_FAILED' &&
|
||||
e.message !== 'Array buffer allocation failed') throw (e);
|
||||
common.skip(skipMessage);
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -17,7 +17,8 @@ try {
|
||||
buf = Buffer.allocUnsafe(kStringMaxLength + 1);
|
||||
} catch (e) {
|
||||
// If the exception is not due to memory confinement then rethrow it.
|
||||
if (e.message !== 'Array buffer allocation failed') throw (e);
|
||||
if (e.code !== 'ERR_MEMORY_ALLOCATION_FAILED' &&
|
||||
e.message !== 'Array buffer allocation failed') throw (e);
|
||||
common.skip(skipMessage);
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -18,7 +18,8 @@ try {
|
||||
buf = Buffer.allocUnsafe(kStringMaxLength + 1);
|
||||
} catch (e) {
|
||||
// If the exception is not due to memory confinement then rethrow it.
|
||||
if (e.message !== 'Array buffer allocation failed') throw (e);
|
||||
if (e.code !== 'ERR_MEMORY_ALLOCATION_FAILED' &&
|
||||
e.message !== 'Array buffer allocation failed') throw (e);
|
||||
common.skip(skipMessage);
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -17,7 +17,8 @@ try {
|
||||
buf = Buffer.allocUnsafe(kStringMaxLength + 1);
|
||||
} catch (e) {
|
||||
// If the exception is not due to memory confinement then rethrow it.
|
||||
if (e.message !== 'Array buffer allocation failed') throw (e);
|
||||
if (e.code !== 'ERR_MEMORY_ALLOCATION_FAILED' &&
|
||||
e.message !== 'Array buffer allocation failed') throw (e);
|
||||
common.skip(skipMessage);
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -17,7 +17,8 @@ try {
|
||||
buf = Buffer.allocUnsafe(kStringMaxLength + 1);
|
||||
} catch (e) {
|
||||
// If the exception is not due to memory confinement then rethrow it.
|
||||
if (e.message !== 'Array buffer allocation failed') throw (e);
|
||||
if (e.code !== 'ERR_MEMORY_ALLOCATION_FAILED' &&
|
||||
e.message !== 'Array buffer allocation failed') throw (e);
|
||||
common.skip(skipMessage);
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -17,7 +17,8 @@ try {
|
||||
buf = Buffer.allocUnsafe(kStringMaxLength + 2);
|
||||
} catch (e) {
|
||||
// If the exception is not due to memory confinement then rethrow it.
|
||||
if (e.message !== 'Array buffer allocation failed') throw (e);
|
||||
if (e.code !== 'ERR_MEMORY_ALLOCATION_FAILED' &&
|
||||
e.message !== 'Array buffer allocation failed') throw (e);
|
||||
common.skip(skipMessage);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,8 @@ try {
|
||||
buf = Buffer.allocUnsafe(kStringMaxLength * 2 + 2);
|
||||
} catch (e) {
|
||||
// If the exception is not due to memory confinement then rethrow it.
|
||||
if (e.message !== 'Array buffer allocation failed') throw (e);
|
||||
if (e.code !== 'ERR_MEMORY_ALLOCATION_FAILED' &&
|
||||
e.message !== 'Array buffer allocation failed') throw (e);
|
||||
common.skip(skipMessage);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user