mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
These tests seem to trigger failures in the entire CI job (not just the test) on AIX. Skip them to see if that helps alleviate spurious failures in node-test-commit-aix (and the upstream PR and commit test jobs). See: - https://github.com/nodejs/build/issues/1820#issuecomment-505998851 - https://github.com/nodejs/build/issues/1847#issuecomment-504210708 PR-URL: https://github.com/nodejs/node/pull/28469 Backport-PR-URL: https://github.com/nodejs/node/pull/28826 Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
42 lines
1.3 KiB
JavaScript
42 lines
1.3 KiB
JavaScript
'use strict';
|
|
|
|
const common = require('../../common');
|
|
const skipMessage = 'intensive toString tests due to memory confinements';
|
|
if (!common.enoughTestMem)
|
|
common.skip(skipMessage);
|
|
|
|
// See https://github.com/nodejs/build/issues/1820#issuecomment-505998851
|
|
// See https://github.com/nodejs/node/pull/28469
|
|
if (process.platform === 'aix')
|
|
common.skip('flaky on AIX');
|
|
|
|
const binding = require(`./build/${common.buildType}/binding`);
|
|
|
|
// v8 fails silently if string length > v8::String::kMaxLength
|
|
// v8::String::kMaxLength defined in v8.h
|
|
const kStringMaxLength = process.binding('buffer').kStringMaxLength;
|
|
|
|
let buf;
|
|
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);
|
|
common.skip(skipMessage);
|
|
}
|
|
|
|
// Ensure we have enough memory available for future allocations to succeed.
|
|
if (!binding.ensureAllocation(2 * kStringMaxLength))
|
|
common.skip(skipMessage);
|
|
|
|
const stringLengthHex = kStringMaxLength.toString(16);
|
|
|
|
common.expectsError(function() {
|
|
buf.toString('utf16le');
|
|
}, {
|
|
message: `Cannot create a string longer than 0x${stringLengthHex} ` +
|
|
'characters',
|
|
code: 'ERR_STRING_TOO_LONG',
|
|
type: Error
|
|
});
|