Skip to content

Commit e01cce5

Browse files
cjihrigRafaelGSS
authored andcommitted
test: skip experimental test with pointer compression
The test test/parallel/test-experimental-shared-value-conveyor.js was added to test the --harmony-struct feature of V8. However, when used with pointer compression, the process crashes. This commit skips the test for pointer compression builds. This change uses a child process because starting a Node pointer compression build with --harmony-struct immediately crashes the process. Once this crash is addresses, this commit can be reverted. PR-URL: #48738 Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Debadree Chatterjee <debadree333@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com>
1 parent 318e075 commit e01cce5

File tree

1 file changed

+29
-16
lines changed

1 file changed

+29
-16
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,38 @@
11
'use strict';
2-
3-
// Flags: --harmony-struct
4-
52
const common = require('../common');
63
const assert = require('assert');
4+
const { spawnSync } = require('child_process');
75
const { Worker, parentPort } = require('worker_threads');
86

9-
// Do not use isMainThread so that this test itself can be run inside a Worker.
10-
if (!process.env.HAS_STARTED_WORKER) {
11-
process.env.HAS_STARTED_WORKER = 1;
12-
const m = new globalThis.SharedArray(16);
7+
if (process.env.TEST_CHILD_PROCESS === '1') {
8+
// Do not use isMainThread so that this test itself can be run inside a Worker.
9+
if (!process.env.HAS_STARTED_WORKER) {
10+
process.env.HAS_STARTED_WORKER = 1;
11+
const m = new globalThis.SharedArray(16);
1312

14-
const worker = new Worker(__filename);
15-
worker.once('message', common.mustCall((message) => {
16-
assert.strictEqual(message, m);
17-
}));
13+
const worker = new Worker(__filename);
14+
worker.once('message', common.mustCall((message) => {
15+
assert.strictEqual(message, m);
16+
}));
1817

19-
worker.postMessage(m);
18+
worker.postMessage(m);
19+
} else {
20+
parentPort.once('message', common.mustCall((message) => {
21+
// Simple echo.
22+
parentPort.postMessage(message);
23+
}));
24+
}
2025
} else {
21-
parentPort.once('message', common.mustCall((message) => {
22-
// Simple echo.
23-
parentPort.postMessage(message);
24-
}));
26+
if (process.config.variables.v8_enable_pointer_compression === 1) {
27+
common.skip('--harmony-struct cannot be used with pointer compression');
28+
}
29+
30+
const args = ['--harmony-struct', __filename];
31+
const options = { env: { TEST_CHILD_PROCESS: '1', ...process.env } };
32+
const child = spawnSync(process.execPath, args, options);
33+
34+
assert.strictEqual(child.stderr.toString().trim(), '');
35+
assert.strictEqual(child.stdout.toString().trim(), '');
36+
assert.strictEqual(child.status, 0);
37+
assert.strictEqual(child.signal, null);
2538
}

0 commit comments

Comments
 (0)