-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Make common.skip() exit. Also add common.printSkipMessage() for partial skips. * Don't make needless things before skip PR-URL: #14021 Fixes: #14016 Reviewed-By: Refael Ackermann <refack@gmail.com>
- Loading branch information
1 parent
cc1a47d
commit 2d2986a
Showing
333 changed files
with
896 additions
and
1,633 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 5 additions & 10 deletions
15
test/addons/stringbytes-external-exceed-max/test-stringbytes-external-at-max.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,29 @@ | ||
'use strict'; | ||
|
||
const common = require('../../common'); | ||
const skipMessage = 'intensive toString tests due to memory confinements'; | ||
if (!common.enoughTestMem) | ||
common.skip(skipMessage); | ||
|
||
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; | ||
|
||
const skipMessage = 'intensive toString tests due to memory confinements'; | ||
if (!common.enoughTestMem) { | ||
common.skip(skipMessage); | ||
return; | ||
} | ||
|
||
let buf; | ||
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); | ||
common.skip(skipMessage); | ||
return; | ||
} | ||
|
||
// Ensure we have enough memory available for future allocations to succeed. | ||
if (!binding.ensureAllocation(2 * kStringMaxLength)) { | ||
if (!binding.ensureAllocation(2 * kStringMaxLength)) | ||
common.skip(skipMessage); | ||
return; | ||
} | ||
|
||
const maxString = buf.toString('latin1'); | ||
assert.strictEqual(maxString.length, kStringMaxLength); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.