mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00: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/29599 Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
36 lines
1.1 KiB
JavaScript
36 lines
1.1 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`);
|
|
const assert = require('assert');
|
|
|
|
// 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);
|
|
|
|
assert.throws(function() {
|
|
buf.toString('utf16le');
|
|
}, /"toString\(\)" failed/);
|