FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

test: move long-running test to sequential · nodejs/node@1b85989 · GitHub

/ node Public

Commit 1b85989

Browse files
authored andcommitted
test: move long-running test to sequential
test-buffer-creation-regression is flaky on some SmartOS hosts in CI, timing out. Move to sequential so it does not compete with other tests for resources. Reduce three test cases to just the one needed to identify the regression. PR-URL: #10161 Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Italo A. Casas <me@italoacasas.com> Backport-Of: #10161 PR-URL: #11176 Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent f83d035 commit 1b85989

2 files changed

Lines changed: 36 additions & 41 deletions

File tree

‎test/parallel/test-buffer-creation-regression.js‎

Lines changed: 0 additions & 41 deletions
This file was deleted.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
'use strict';
2+
3+
const common = require('../common');
4+
const assert = require('assert');
5+
6+
function test(arrayBuffer, offset, length) {
7+
const uint8Array = new Uint8Array(arrayBuffer, offset, length);
8+
for (let i = 0; i < length; i += 1) {
9+
uint8Array[i] = 1;
10+
}
11+
12+
const buffer = Buffer.from(arrayBuffer, offset, length);
13+
for (let i = 0; i < length; i += 1) {
14+
assert.strictEqual(buffer[i], 1);
15+
}
16+
}
17+
18+
const acceptableOOMErrors = [
19+
'Array buffer allocation failed',
20+
'Invalid array buffer length'
21+
];
22+
23+
const size = 8589934592; /* 1 << 33 */
24+
const offset = 4294967296; /* 1 << 32 */
25+
const length = 1000;
26+
let arrayBuffer;
27+
28+
try {
29+
arrayBuffer = new ArrayBuffer(size);
30+
} catch (e) {
31+
if (e instanceof RangeError && acceptableOOMErrors.includes(e.message))
32+
return common.skip(`Unable to allocate ${size} bytes for ArrayBuffer`);
33+
throw e;
34+
}
35+
36+
test(arrayBuffer, offset, length);

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL