test,tools: enable running tests under workers
Enable running tests inside workers by passing `--worker` to `tools/test.py`. A number of tests are marked as skipped, or have been slightly altered to fit the different environment. PR-URL: https://github.com/nodejs/node/pull/20876 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Shingo Inoue <leko.noor@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: John-David Dalton <john.david.dalton@gmail.com> Reviewed-By: Gus Caplan <me@gus.host>
This commit is contained in:
parent
d1c096cc9d
commit
229dca3dee
@ -1,7 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
// Flags: --expose-gc
|
// Flags: --expose-gc
|
||||||
|
|
||||||
require('../common');
|
const common = require('../common');
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const async_hooks = require('async_hooks');
|
const async_hooks = require('async_hooks');
|
||||||
const util = require('util');
|
const util = require('util');
|
||||||
@ -162,6 +162,10 @@ class ActivityCollector {
|
|||||||
const stub = { uid, type: 'Unknown', handleIsObject: true };
|
const stub = { uid, type: 'Unknown', handleIsObject: true };
|
||||||
this._activities.set(uid, stub);
|
this._activities.set(uid, stub);
|
||||||
return stub;
|
return stub;
|
||||||
|
} else if (!common.isMainThread) {
|
||||||
|
// Worker threads start main script execution inside of an AsyncWrap
|
||||||
|
// callback, so we don't yield errors for these.
|
||||||
|
return null;
|
||||||
} else {
|
} else {
|
||||||
const err = new Error(`Found a handle whose ${hook}` +
|
const err = new Error(`Found a handle whose ${hook}` +
|
||||||
' hook was invoked but not its init hook');
|
' hook was invoked but not its init hook');
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
const common = require('../common');
|
const common = require('../common');
|
||||||
if (!common.hasCrypto)
|
if (!common.hasCrypto)
|
||||||
common.skip('missing crypto');
|
common.skip('missing crypto');
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('Worker bootstrapping works differently -> different async IDs');
|
||||||
|
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const tick = require('./tick');
|
const tick = require('./tick');
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
const common = require('../common');
|
const common = require('../common');
|
||||||
if (!common.hasCrypto)
|
if (!common.hasCrypto)
|
||||||
common.skip('missing crypto');
|
common.skip('missing crypto');
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('Worker bootstrapping works differently -> different async IDs');
|
||||||
|
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const tick = require('./tick');
|
const tick = require('./tick');
|
||||||
|
@ -7,6 +7,9 @@ const spawnSync = require('child_process').spawnSync;
|
|||||||
const async_hooks = require('internal/async_hooks');
|
const async_hooks = require('internal/async_hooks');
|
||||||
const initHooks = require('./init-hooks');
|
const initHooks = require('./init-hooks');
|
||||||
|
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('Worker bootstrapping works differently -> different async IDs');
|
||||||
|
|
||||||
switch (process.argv[2]) {
|
switch (process.argv[2]) {
|
||||||
case 'test_invalid_async_id':
|
case 'test_invalid_async_id':
|
||||||
async_hooks.emitBefore(-2, 1);
|
async_hooks.emitBefore(-2, 1);
|
||||||
|
@ -88,6 +88,10 @@ const assert = require('assert');
|
|||||||
const tick = require('./tick');
|
const tick = require('./tick');
|
||||||
const initHooks = require('./init-hooks');
|
const initHooks = require('./init-hooks');
|
||||||
const { checkInvocations } = require('./hook-checks');
|
const { checkInvocations } = require('./hook-checks');
|
||||||
|
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('Worker bootstrapping works differently -> different timing');
|
||||||
|
|
||||||
// Include "Unknown"s because hook2 will not be able to identify
|
// Include "Unknown"s because hook2 will not be able to identify
|
||||||
// the type of the first Immediate since it will miss its `init` invocation.
|
// the type of the first Immediate since it will miss its `init` invocation.
|
||||||
const types = [ 'Immediate', 'Unknown' ];
|
const types = [ 'Immediate', 'Unknown' ];
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
require('../common');
|
const common = require('../common');
|
||||||
|
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const initHooks = require('./init-hooks');
|
const initHooks = require('./init-hooks');
|
||||||
@ -7,6 +7,9 @@ const tick = require('./tick');
|
|||||||
const { checkInvocations } = require('./hook-checks');
|
const { checkInvocations } = require('./hook-checks');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('Worker bootstrapping works differently -> different async IDs');
|
||||||
|
|
||||||
const hooks = initHooks();
|
const hooks = initHooks();
|
||||||
|
|
||||||
hooks.enable();
|
hooks.enable();
|
||||||
|
@ -7,6 +7,9 @@ const initHooks = require('./init-hooks');
|
|||||||
const { checkInvocations } = require('./hook-checks');
|
const { checkInvocations } = require('./hook-checks');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('Worker bootstrapping works differently -> different async IDs');
|
||||||
|
|
||||||
const hooks = initHooks();
|
const hooks = initHooks();
|
||||||
|
|
||||||
hooks.enable();
|
hooks.enable();
|
||||||
|
@ -7,6 +7,9 @@ const initHooks = require('./init-hooks');
|
|||||||
const { checkInvocations } = require('./hook-checks');
|
const { checkInvocations } = require('./hook-checks');
|
||||||
const dns = require('dns');
|
const dns = require('dns');
|
||||||
|
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('Worker bootstrapping works differently -> different async IDs');
|
||||||
|
|
||||||
const hooks = initHooks();
|
const hooks = initHooks();
|
||||||
|
|
||||||
hooks.enable();
|
hooks.enable();
|
||||||
|
@ -7,6 +7,9 @@ const initHooks = require('./init-hooks');
|
|||||||
const { checkInvocations } = require('./hook-checks');
|
const { checkInvocations } = require('./hook-checks');
|
||||||
const dns = require('dns');
|
const dns = require('dns');
|
||||||
|
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('Worker bootstrapping works differently -> different async IDs');
|
||||||
|
|
||||||
const hooks = initHooks();
|
const hooks = initHooks();
|
||||||
|
|
||||||
hooks.enable();
|
hooks.enable();
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const common = require('../common');
|
const common = require('../common');
|
||||||
if (common.isWindows) {
|
if (common.isWindows)
|
||||||
common.skip('no signals on Windows');
|
common.skip('no signals on Windows');
|
||||||
}
|
if (!common.isMainThread)
|
||||||
|
common.skip('No signal handling available in Workers');
|
||||||
|
|
||||||
const initHooks = require('./init-hooks');
|
const initHooks = require('./init-hooks');
|
||||||
const verifyGraph = require('./verify-graph');
|
const verifyGraph = require('./verify-graph');
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
// Flags: --no-force-async-hooks-checks --expose-internals
|
// Flags: --no-force-async-hooks-checks --expose-internals
|
||||||
require('../common');
|
const common = require('../common');
|
||||||
|
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('Workers don\'t inherit per-env state like the check flag');
|
||||||
|
|
||||||
const async_hooks = require('internal/async_hooks');
|
const async_hooks = require('internal/async_hooks');
|
||||||
|
|
||||||
|
@ -10,6 +10,9 @@ const initHooks = require('./init-hooks');
|
|||||||
const { checkInvocations } = require('./hook-checks');
|
const { checkInvocations } = require('./hook-checks');
|
||||||
const spawn = require('child_process').spawn;
|
const spawn = require('child_process').spawn;
|
||||||
|
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('Worker bootstrapping works differently -> different async IDs');
|
||||||
|
|
||||||
const hooks = initHooks();
|
const hooks = initHooks();
|
||||||
|
|
||||||
hooks.enable();
|
hooks.enable();
|
||||||
|
@ -4,6 +4,10 @@ const common = require('../common');
|
|||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const initHooks = require('./init-hooks');
|
const initHooks = require('./init-hooks');
|
||||||
const { checkInvocations } = require('./hook-checks');
|
const { checkInvocations } = require('./hook-checks');
|
||||||
|
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('Worker bootstrapping works differently -> different async IDs');
|
||||||
|
|
||||||
common.crashOnUnhandledRejection();
|
common.crashOnUnhandledRejection();
|
||||||
|
|
||||||
const p = new Promise(common.mustCall(function executor(resolve, reject) {
|
const p = new Promise(common.mustCall(function executor(resolve, reject) {
|
||||||
|
@ -6,6 +6,9 @@ const assert = require('assert');
|
|||||||
const initHooks = require('./init-hooks');
|
const initHooks = require('./init-hooks');
|
||||||
const { checkInvocations } = require('./hook-checks');
|
const { checkInvocations } = require('./hook-checks');
|
||||||
|
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('Worker bootstrapping works differently -> different async IDs');
|
||||||
|
|
||||||
common.crashOnUnhandledRejection();
|
common.crashOnUnhandledRejection();
|
||||||
|
|
||||||
const hooks = initHooks();
|
const hooks = initHooks();
|
||||||
|
@ -3,6 +3,8 @@ const common = require('../common');
|
|||||||
|
|
||||||
if (common.isWindows)
|
if (common.isWindows)
|
||||||
common.skip('no signals in Windows');
|
common.skip('no signals in Windows');
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('No signal handling available in Workers');
|
||||||
|
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const initHooks = require('./init-hooks');
|
const initHooks = require('./init-hooks');
|
||||||
|
@ -1,12 +1,15 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
require('../common');
|
const common = require('../common');
|
||||||
const commonPath = require.resolve('../common');
|
const commonPath = require.resolve('../common');
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const initHooks = require('./init-hooks');
|
const initHooks = require('./init-hooks');
|
||||||
const { checkInvocations } = require('./hook-checks');
|
const { checkInvocations } = require('./hook-checks');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('Worker bootstrapping works differently -> different async IDs');
|
||||||
|
|
||||||
const hooks = initHooks();
|
const hooks = initHooks();
|
||||||
hooks.enable();
|
hooks.enable();
|
||||||
|
|
||||||
|
@ -46,6 +46,14 @@ Object.defineProperty(exports, 'PORT', {
|
|||||||
enumerable: true
|
enumerable: true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
exports.isMainThread = (() => {
|
||||||
|
try {
|
||||||
|
return require('worker').isMainThread;
|
||||||
|
} catch {
|
||||||
|
// Worker module not enabled → only a single main thread exists.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
exports.isWindows = process.platform === 'win32';
|
exports.isWindows = process.platform === 'win32';
|
||||||
exports.isWOW64 = exports.isWindows &&
|
exports.isWOW64 = exports.isWindows &&
|
||||||
@ -746,6 +754,10 @@ exports.skipIfInspectorDisabled = function skipIfInspectorDisabled() {
|
|||||||
if (process.config.variables.v8_enable_inspector === 0) {
|
if (process.config.variables.v8_enable_inspector === 0) {
|
||||||
exports.skip('V8 inspector is disabled');
|
exports.skip('V8 inspector is disabled');
|
||||||
}
|
}
|
||||||
|
if (!exports.isMainThread) {
|
||||||
|
// TODO(addaleax): Fix me.
|
||||||
|
exports.skip('V8 inspector is not available in Workers');
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.skipIf32Bits = function skipIf32Bits() {
|
exports.skipIf32Bits = function skipIf32Bits() {
|
||||||
|
@ -19,5 +19,5 @@ const proc = spawn(
|
|||||||
// To double-check this test, set stdio to 'pipe' and uncomment the line below.
|
// To double-check this test, set stdio to 'pipe' and uncomment the line below.
|
||||||
// proc.stderr.pipe(process.stderr);
|
// proc.stderr.pipe(process.stderr);
|
||||||
proc.on('exit', common.mustCall(function(exitCode) {
|
proc.on('exit', common.mustCall(function(exitCode) {
|
||||||
process.exitCode = exitCode;
|
assert.strictEqual(exitCode, 0);
|
||||||
}));
|
}));
|
||||||
|
@ -3,6 +3,9 @@ const common = require('../common');
|
|||||||
const async_hooks = require('async_hooks');
|
const async_hooks = require('async_hooks');
|
||||||
common.crashOnUnhandledRejection();
|
common.crashOnUnhandledRejection();
|
||||||
|
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('Worker bootstrapping works differently -> different AsyncWraps');
|
||||||
|
|
||||||
const hook = async_hooks.createHook({
|
const hook = async_hooks.createHook({
|
||||||
init: common.mustCall(2),
|
init: common.mustCall(2),
|
||||||
before: common.mustCall(1),
|
before: common.mustCall(1),
|
||||||
|
@ -8,7 +8,7 @@ const common = require('../common');
|
|||||||
const async_hooks = require('async_hooks');
|
const async_hooks = require('async_hooks');
|
||||||
|
|
||||||
const hook = async_hooks.createHook({
|
const hook = async_hooks.createHook({
|
||||||
destroy: common.mustCall(1) // only 1 immediate is destroyed
|
destroy: common.mustCallAtLeast(1) // only 1 immediate is destroyed
|
||||||
}).enable();
|
}).enable();
|
||||||
|
|
||||||
new async_hooks.AsyncResource('foobar', { requireManualDestroy: true });
|
new async_hooks.AsyncResource('foobar', { requireManualDestroy: true });
|
||||||
|
@ -7,8 +7,8 @@ common.crashOnUnhandledRejection();
|
|||||||
Promise.resolve(1).then(common.mustCall(() => {
|
Promise.resolve(1).then(common.mustCall(() => {
|
||||||
async_hooks.createHook({
|
async_hooks.createHook({
|
||||||
init: common.mustCall(),
|
init: common.mustCall(),
|
||||||
before: common.mustCall(),
|
before: common.mustCallAtLeast(),
|
||||||
after: common.mustCall(2)
|
after: common.mustCallAtLeast(2)
|
||||||
}).enable();
|
}).enable();
|
||||||
|
|
||||||
process.nextTick(common.mustCall());
|
process.nextTick(common.mustCall());
|
||||||
|
@ -8,7 +8,7 @@ const common = require('../common');
|
|||||||
const async_hooks = require('async_hooks');
|
const async_hooks = require('async_hooks');
|
||||||
|
|
||||||
const hook = async_hooks.createHook({
|
const hook = async_hooks.createHook({
|
||||||
destroy: common.mustCall(2) // 1 immediate + manual destroy
|
destroy: common.mustCallAtLeast(2) // 1 immediate + manual destroy
|
||||||
}).enable();
|
}).enable();
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -3,6 +3,9 @@ const common = require('../common');
|
|||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const async_hooks = require('async_hooks');
|
const async_hooks = require('async_hooks');
|
||||||
|
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('Worker bootstrapping works differently -> different async IDs');
|
||||||
|
|
||||||
common.crashOnUnhandledRejection();
|
common.crashOnUnhandledRejection();
|
||||||
|
|
||||||
const promiseAsyncIds = [];
|
const promiseAsyncIds = [];
|
||||||
|
@ -3,6 +3,9 @@ const common = require('../common');
|
|||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const async_hooks = require('async_hooks');
|
const async_hooks = require('async_hooks');
|
||||||
|
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('Worker bootstrapping works differently -> different async IDs');
|
||||||
|
|
||||||
const initCalls = [];
|
const initCalls = [];
|
||||||
const resolveCalls = [];
|
const resolveCalls = [];
|
||||||
|
|
||||||
|
@ -6,6 +6,9 @@ const common = require('../common');
|
|||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const async_hooks = require('async_hooks');
|
const async_hooks = require('async_hooks');
|
||||||
|
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('Worker bootstrapping works differently -> different async IDs');
|
||||||
|
|
||||||
let seenId, seenResource;
|
let seenId, seenResource;
|
||||||
|
|
||||||
async_hooks.createHook({
|
async_hooks.createHook({
|
||||||
|
@ -5,6 +5,9 @@
|
|||||||
const common = require('../common');
|
const common = require('../common');
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
|
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('Worker bootstrapping works differently -> different timing');
|
||||||
|
|
||||||
const async_hooks = require('async_hooks');
|
const async_hooks = require('async_hooks');
|
||||||
|
|
||||||
const seenEvents = [];
|
const seenEvents = [];
|
||||||
|
@ -5,6 +5,9 @@ const assert = require('assert');
|
|||||||
const internalCp = require('internal/child_process');
|
const internalCp = require('internal/child_process');
|
||||||
const oldSpawnSync = internalCp.spawnSync;
|
const oldSpawnSync = internalCp.spawnSync;
|
||||||
|
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('stdio is not associated with file descriptors in Workers');
|
||||||
|
|
||||||
// Verify that customFds is used if stdio is not provided.
|
// Verify that customFds is used if stdio is not provided.
|
||||||
{
|
{
|
||||||
const msg = 'child_process: options.customFds option is deprecated. ' +
|
const msg = 'child_process: options.customFds option is deprecated. ' +
|
||||||
|
@ -6,7 +6,6 @@ const common = require('../common');
|
|||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const { fork } = require('child_process');
|
const { fork } = require('child_process');
|
||||||
const http = require('http');
|
const http = require('http');
|
||||||
const { kTimeout } = require('internal/timers');
|
|
||||||
|
|
||||||
if (process.argv[2] === 'child') {
|
if (process.argv[2] === 'child') {
|
||||||
process.once('message', (req, socket) => {
|
process.once('message', (req, socket) => {
|
||||||
@ -19,6 +18,8 @@ if (process.argv[2] === 'child') {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const { kTimeout } = require('internal/timers');
|
||||||
|
|
||||||
let child;
|
let child;
|
||||||
let socket;
|
let socket;
|
||||||
|
|
||||||
|
@ -30,7 +30,8 @@ common.expectsError(() => _validateStdio(stdio2, true),
|
|||||||
{ code: 'ERR_IPC_SYNC_FORK', type: Error }
|
{ code: 'ERR_IPC_SYNC_FORK', type: Error }
|
||||||
);
|
);
|
||||||
|
|
||||||
{
|
|
||||||
|
if (common.isMainThread) {
|
||||||
const stdio3 = [process.stdin, process.stdout, process.stderr];
|
const stdio3 = [process.stdin, process.stdout, process.stderr];
|
||||||
const result = _validateStdio(stdio3, false);
|
const result = _validateStdio(stdio3, false);
|
||||||
assert.deepStrictEqual(result, {
|
assert.deepStrictEqual(result, {
|
||||||
@ -42,4 +43,7 @@ common.expectsError(() => _validateStdio(stdio2, true),
|
|||||||
ipc: undefined,
|
ipc: undefined,
|
||||||
ipcFd: undefined
|
ipcFd: undefined
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
common.printSkipMessage(
|
||||||
|
'stdio is not associated with file descriptors in Workers');
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,9 @@ const path = require('path');
|
|||||||
const fixtures = require('../common/fixtures');
|
const fixtures = require('../common/fixtures');
|
||||||
const nodejs = `"${process.execPath}"`;
|
const nodejs = `"${process.execPath}"`;
|
||||||
|
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('process.chdir is not available in Workers');
|
||||||
|
|
||||||
if (process.argv.length > 2) {
|
if (process.argv.length > 2) {
|
||||||
console.log(process.argv.slice(2).join(' '));
|
console.log(process.argv.slice(2).join(' '));
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
const common = require('../common');
|
const common = require('../common');
|
||||||
if (process.config.variables.node_without_node_options)
|
if (process.config.variables.node_without_node_options)
|
||||||
common.skip('missing NODE_OPTIONS support');
|
common.skip('missing NODE_OPTIONS support');
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('process.chdir is not available in Workers');
|
||||||
|
|
||||||
// Test options specified by env variable.
|
// Test options specified by env variable.
|
||||||
|
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
const common = require('../common');
|
const common = require('../common');
|
||||||
if (process.config.variables.node_without_node_options)
|
if (process.config.variables.node_without_node_options)
|
||||||
common.skip('missing NODE_OPTIONS support');
|
common.skip('missing NODE_OPTIONS support');
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('process.chdir is not available in Workers');
|
||||||
|
|
||||||
// Test options specified by env variable.
|
// Test options specified by env variable.
|
||||||
|
|
||||||
|
@ -11,6 +11,8 @@ const tmpdir = require('../common/tmpdir');
|
|||||||
if (common.isWindows)
|
if (common.isWindows)
|
||||||
common.skip('On Windows named pipes live in their own ' +
|
common.skip('On Windows named pipes live in their own ' +
|
||||||
'filesystem and don\'t have a ~100 byte limit');
|
'filesystem and don\'t have a ~100 byte limit');
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('process.chdir is not available in Workers');
|
||||||
|
|
||||||
// Choose a socket name such that the absolute path would exceed 100 bytes.
|
// Choose a socket name such that the absolute path would exceed 100 bytes.
|
||||||
const socketDir = './unix-socket-dir';
|
const socketDir = './unix-socket-dir';
|
||||||
|
@ -27,9 +27,10 @@ const util = require('util');
|
|||||||
assert.ok(process.stdout.writable);
|
assert.ok(process.stdout.writable);
|
||||||
assert.ok(process.stderr.writable);
|
assert.ok(process.stderr.writable);
|
||||||
// Support legacy API
|
// Support legacy API
|
||||||
assert.strictEqual(typeof process.stdout.fd, 'number');
|
if (common.isMainThread) {
|
||||||
assert.strictEqual(typeof process.stderr.fd, 'number');
|
assert.strictEqual(typeof process.stdout.fd, 'number');
|
||||||
|
assert.strictEqual(typeof process.stderr.fd, 'number');
|
||||||
|
}
|
||||||
process.once('warning', common.mustCall((warning) => {
|
process.once('warning', common.mustCall((warning) => {
|
||||||
assert(/no such label/.test(warning.message));
|
assert(/no such label/.test(warning.message));
|
||||||
}));
|
}));
|
||||||
|
@ -3,6 +3,8 @@ const common = require('../common');
|
|||||||
// Fails with EINVAL on SmartOS, EBUSY on Windows, EBUSY on AIX.
|
// Fails with EINVAL on SmartOS, EBUSY on Windows, EBUSY on AIX.
|
||||||
if (common.isSunOS || common.isWindows || common.isAIX)
|
if (common.isSunOS || common.isWindows || common.isAIX)
|
||||||
common.skip('cannot rmdir current working directory');
|
common.skip('cannot rmdir current working directory');
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('process.chdir is not available in Workers');
|
||||||
|
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
@ -3,6 +3,8 @@ const common = require('../common');
|
|||||||
// Fails with EINVAL on SmartOS, EBUSY on Windows, EBUSY on AIX.
|
// Fails with EINVAL on SmartOS, EBUSY on Windows, EBUSY on AIX.
|
||||||
if (common.isSunOS || common.isWindows || common.isAIX)
|
if (common.isSunOS || common.isWindows || common.isAIX)
|
||||||
common.skip('cannot rmdir current working directory');
|
common.skip('cannot rmdir current working directory');
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('process.chdir is not available in Workers');
|
||||||
|
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
@ -3,6 +3,8 @@ const common = require('../common');
|
|||||||
// Fails with EINVAL on SmartOS, EBUSY on Windows, EBUSY on AIX.
|
// Fails with EINVAL on SmartOS, EBUSY on Windows, EBUSY on AIX.
|
||||||
if (common.isSunOS || common.isWindows || common.isAIX)
|
if (common.isSunOS || common.isWindows || common.isAIX)
|
||||||
common.skip('cannot rmdir current working directory');
|
common.skip('cannot rmdir current working directory');
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('process.chdir is not available in Workers');
|
||||||
|
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
// Flags: --debug-code
|
// Flags: --debug-code
|
||||||
|
|
||||||
require('../common');
|
const common = require('../common');
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
|
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('execArgv does not affect Workers');
|
||||||
|
|
||||||
assert(process.execArgv.includes('--debug-code'));
|
assert(process.execArgv.includes('--debug-code'));
|
||||||
|
@ -24,6 +24,9 @@ const common = require('../common');
|
|||||||
const fixtures = require('../common/fixtures');
|
const fixtures = require('../common/fixtures');
|
||||||
const tmpdir = require('../common/tmpdir');
|
const tmpdir = require('../common/tmpdir');
|
||||||
|
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('process.chdir is not available in Workers');
|
||||||
|
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
@ -28,6 +28,9 @@ let openCount = 0;
|
|||||||
let mode;
|
let mode;
|
||||||
let content;
|
let content;
|
||||||
|
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('process.umask is not available in Workers');
|
||||||
|
|
||||||
// Need to hijack fs.open/close to make sure that things
|
// Need to hijack fs.open/close to make sure that things
|
||||||
// get closed once they're opened.
|
// get closed once they're opened.
|
||||||
fs._openSync = fs.openSync;
|
fs._openSync = fs.openSync;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
// Flags: --expose-internals
|
// Flags: --expose-internals --experimental-worker
|
||||||
|
|
||||||
require('../common');
|
require('../common');
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
@ -7,5 +7,5 @@ const { builtinLibs } = require('internal/modules/cjs/helpers');
|
|||||||
|
|
||||||
const hasInspector = process.config.variables.v8_enable_inspector === 1;
|
const hasInspector = process.config.variables.v8_enable_inspector === 1;
|
||||||
|
|
||||||
const expectedLibs = hasInspector ? 33 : 32;
|
const expectedLibs = hasInspector ? 34 : 33;
|
||||||
assert.strictEqual(builtinLibs.length, expectedLibs);
|
assert.strictEqual(builtinLibs.length, expectedLibs);
|
||||||
|
@ -5,6 +5,8 @@ const fixtures = require('../common/fixtures');
|
|||||||
// Refs: https://github.com/nodejs/node/pull/2253
|
// Refs: https://github.com/nodejs/node/pull/2253
|
||||||
if (common.isSunOS)
|
if (common.isSunOS)
|
||||||
common.skip('unreliable on SunOS');
|
common.skip('unreliable on SunOS');
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('process.chdir is not available in Workers');
|
||||||
|
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const childProcess = require('child_process');
|
const childProcess = require('child_process');
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const { expectsError } = require('../common');
|
const common = require('../common');
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('process.chdir is not available in Workers');
|
||||||
|
|
||||||
expectsError(
|
common.expectsError(
|
||||||
() => {
|
() => {
|
||||||
process.chdir('does-not-exist');
|
process.chdir('does-not-exist');
|
||||||
},
|
},
|
||||||
|
@ -5,6 +5,9 @@ const assert = require('assert');
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('process.chdir is not available in Workers');
|
||||||
|
|
||||||
const tmpdir = require('../common/tmpdir');
|
const tmpdir = require('../common/tmpdir');
|
||||||
|
|
||||||
process.chdir('..');
|
process.chdir('..');
|
||||||
|
@ -3,9 +3,11 @@
|
|||||||
const common = require('../common');
|
const common = require('../common');
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
|
|
||||||
if (common.isWindows) {
|
if (common.isWindows || !common.isMainThread) {
|
||||||
|
if (common.isMainThread) {
|
||||||
assert.strictEqual(process.geteuid, undefined);
|
assert.strictEqual(process.geteuid, undefined);
|
||||||
assert.strictEqual(process.getegid, undefined);
|
assert.strictEqual(process.getegid, undefined);
|
||||||
|
}
|
||||||
assert.strictEqual(process.seteuid, undefined);
|
assert.strictEqual(process.seteuid, undefined);
|
||||||
assert.strictEqual(process.setegid, undefined);
|
assert.strictEqual(process.setegid, undefined);
|
||||||
return;
|
return;
|
||||||
|
@ -1,11 +1,14 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
require('../common');
|
const common = require('../common');
|
||||||
|
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('execArgv does not affect Workers');
|
||||||
|
|
||||||
// This test ensures that no asynchronous operations are performed in the 'exit'
|
// This test ensures that no asynchronous operations are performed in the 'exit'
|
||||||
// handler.
|
// handler.
|
||||||
// https://github.com/nodejs/node/issues/12322
|
// https://github.com/nodejs/node/issues/12322
|
||||||
|
|
||||||
process.on('exit', () => {
|
process.on('exit', () => {
|
||||||
setTimeout(process.abort, 0); // Should not run.
|
setTimeout(() => process.abort(), 0); // Should not run.
|
||||||
for (const start = Date.now(); Date.now() - start < 10;);
|
for (const start = Date.now(); Date.now() - start < 10;);
|
||||||
});
|
});
|
||||||
|
@ -3,6 +3,9 @@
|
|||||||
const common = require('../common');
|
const common = require('../common');
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
|
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('Error handling timing is different in Workers');
|
||||||
|
|
||||||
// If a process encounters an uncaughtException, it should schedule
|
// If a process encounters an uncaughtException, it should schedule
|
||||||
// processing of nextTicks on the next Immediates cycle but not
|
// processing of nextTicks on the next Immediates cycle but not
|
||||||
// before all Immediates are handled
|
// before all Immediates are handled
|
||||||
|
@ -24,11 +24,13 @@ const common = require('../common');
|
|||||||
|
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
|
|
||||||
if (common.isWindows) {
|
if (common.isWindows || !common.isMainThread) {
|
||||||
// uid/gid functions are POSIX only
|
// uid/gid functions are POSIX only, setters are main-thread only.
|
||||||
|
if (common.isMainThread) {
|
||||||
assert.strictEqual(process.getuid, undefined);
|
assert.strictEqual(process.getuid, undefined);
|
||||||
assert.strictEqual(process.setuid, undefined);
|
|
||||||
assert.strictEqual(process.getgid, undefined);
|
assert.strictEqual(process.getgid, undefined);
|
||||||
|
}
|
||||||
|
assert.strictEqual(process.setuid, undefined);
|
||||||
assert.strictEqual(process.setgid, undefined);
|
assert.strictEqual(process.setgid, undefined);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,9 @@
|
|||||||
const common = require('../common');
|
const common = require('../common');
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
|
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('process.umask is not available in Workers');
|
||||||
|
|
||||||
let mask;
|
let mask;
|
||||||
|
|
||||||
if (common.isWindows) {
|
if (common.isWindows) {
|
||||||
|
@ -22,6 +22,8 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
const common = require('../common');
|
const common = require('../common');
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('process.umask is not available in Workers');
|
||||||
|
|
||||||
// Note in Windows one can only set the "user" bits.
|
// Note in Windows one can only set the "user" bits.
|
||||||
let mask;
|
let mask;
|
||||||
|
@ -5,6 +5,9 @@ const fixtures = require('../common/fixtures');
|
|||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const net = require('net');
|
const net = require('net');
|
||||||
|
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('process.chdir is not available in Workers');
|
||||||
|
|
||||||
process.chdir(fixtures.fixturesDir);
|
process.chdir(fixtures.fixturesDir);
|
||||||
const repl = require('repl');
|
const repl = require('repl');
|
||||||
|
|
||||||
|
@ -4,6 +4,8 @@ if (common.isWindows) {
|
|||||||
// No way to send CTRL_C_EVENT to processes from JS right now.
|
// No way to send CTRL_C_EVENT to processes from JS right now.
|
||||||
common.skip('platform not supported');
|
common.skip('platform not supported');
|
||||||
}
|
}
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('No signal handling available in Workers');
|
||||||
|
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const spawn = require('child_process').spawn;
|
const spawn = require('child_process').spawn;
|
||||||
|
@ -4,6 +4,8 @@ if (common.isWindows) {
|
|||||||
// No way to send CTRL_C_EVENT to processes from JS right now.
|
// No way to send CTRL_C_EVENT to processes from JS right now.
|
||||||
common.skip('platform not supported');
|
common.skip('platform not supported');
|
||||||
}
|
}
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('No signal handling available in Workers');
|
||||||
|
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const spawn = require('child_process').spawn;
|
const spawn = require('child_process').spawn;
|
||||||
|
@ -26,6 +26,9 @@ const assert = require('assert');
|
|||||||
const fixtures = require('../common/fixtures');
|
const fixtures = require('../common/fixtures');
|
||||||
const hasInspector = process.config.variables.v8_enable_inspector === 1;
|
const hasInspector = process.config.variables.v8_enable_inspector === 1;
|
||||||
|
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('process.chdir is not available in Workers');
|
||||||
|
|
||||||
// We have to change the directory to ../fixtures before requiring repl
|
// We have to change the directory to ../fixtures before requiring repl
|
||||||
// in order to make the tests for completion of node_modules work properly
|
// in order to make the tests for completion of node_modules work properly
|
||||||
// since repl modifies module.paths.
|
// since repl modifies module.paths.
|
||||||
|
@ -4,6 +4,8 @@ const common = require('../common');
|
|||||||
|
|
||||||
if (!common.canCreateSymLink())
|
if (!common.canCreateSymLink())
|
||||||
common.skip('insufficient privileges');
|
common.skip('insufficient privileges');
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('process.chdir is not available in Workers');
|
||||||
|
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const { spawn } = require('child_process');
|
const { spawn } = require('child_process');
|
||||||
|
@ -5,6 +5,8 @@ const common = require('../common');
|
|||||||
// FIXME add sunos support
|
// FIXME add sunos support
|
||||||
if (common.isSunOS)
|
if (common.isSunOS)
|
||||||
common.skip(`Unsupported platform [${process.platform}]`);
|
common.skip(`Unsupported platform [${process.platform}]`);
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('Setting the process title from Workers is not supported');
|
||||||
|
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const exec = require('child_process').exec;
|
const exec = require('child_process').exec;
|
||||||
|
@ -3,9 +3,10 @@
|
|||||||
const common = require('../common');
|
const common = require('../common');
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
|
|
||||||
if (common.isWindows) {
|
if (common.isWindows)
|
||||||
common.skip('Sending signals with process.kill is not supported on Windows');
|
common.skip('Sending signals with process.kill is not supported on Windows');
|
||||||
}
|
if (!common.isMainThread)
|
||||||
|
common.skip('No signal handling available in Workers');
|
||||||
|
|
||||||
process.once('SIGINT', common.mustCall((signal) => {
|
process.once('SIGINT', common.mustCall((signal) => {
|
||||||
assert.strictEqual(signal, 'SIGINT');
|
assert.strictEqual(signal, 'SIGINT');
|
||||||
|
@ -25,6 +25,8 @@ const common = require('../common');
|
|||||||
|
|
||||||
if (common.isWindows)
|
if (common.isWindows)
|
||||||
common.skip('SIGUSR1 and SIGHUP signals are not supported');
|
common.skip('SIGUSR1 and SIGHUP signals are not supported');
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('Signal handling in Workers is not supported');
|
||||||
|
|
||||||
console.log(`process.pid: ${process.pid}`);
|
console.log(`process.pid: ${process.pid}`);
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
require('../common');
|
const common = require('../common');
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('Workers don’t have process-like stdio');
|
||||||
|
|
||||||
// Test if Node handles acessing process.stdin if it is a redirected
|
// Test if Node handles acessing process.stdin if it is a redirected
|
||||||
// pipe without deadlocking
|
// pipe without deadlocking
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
require('../common');
|
const common = require('../common');
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('Workers don’t have process-like stdio');
|
||||||
|
|
||||||
// Test if Node handles redirecting one child process stdout to another
|
// Test if Node handles redirecting one child process stdout to another
|
||||||
// process stdin without crashing.
|
// process stdin without crashing.
|
||||||
|
9
test/parallel/test-timers-immediate-unref-nested-once.js
Normal file
9
test/parallel/test-timers-immediate-unref-nested-once.js
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const common = require('../common');
|
||||||
|
|
||||||
|
// This immediate should not execute as it was unrefed
|
||||||
|
// and nothing else is keeping the event loop alive
|
||||||
|
setImmediate(() => {
|
||||||
|
setImmediate(common.mustNotCall()).unref();
|
||||||
|
});
|
@ -2,6 +2,11 @@
|
|||||||
|
|
||||||
const common = require('../common');
|
const common = require('../common');
|
||||||
|
|
||||||
|
if (!common.isMainThread) {
|
||||||
|
// Note that test-timers-immediate-unref-nested-once works instead.
|
||||||
|
common.skip('Worker bootstrapping works differently -> different timing');
|
||||||
|
}
|
||||||
|
|
||||||
// This immediate should not execute as it was unrefed
|
// This immediate should not execute as it was unrefed
|
||||||
// and nothing else is keeping the event loop alive
|
// and nothing else is keeping the event loop alive
|
||||||
setImmediate(common.mustNotCall()).unref();
|
setImmediate(common.mustNotCall()).unref();
|
||||||
|
@ -4,6 +4,9 @@ const assert = require('assert');
|
|||||||
const cp = require('child_process');
|
const cp = require('child_process');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('process.chdir is not available in Workers');
|
||||||
|
|
||||||
const CODE =
|
const CODE =
|
||||||
'setTimeout(() => { for (var i = 0; i < 100000; i++) { "test" + i } }, 1)';
|
'setTimeout(() => { for (var i = 0; i < 100000; i++) { "test" + i } }, 1)';
|
||||||
const FILE_NAME = 'node_trace.1.log';
|
const FILE_NAME = 'node_trace.1.log';
|
||||||
|
@ -5,6 +5,8 @@ const common = require('../common');
|
|||||||
|
|
||||||
if (!common.hasTracing)
|
if (!common.hasTracing)
|
||||||
common.skip('missing trace events');
|
common.skip('missing trace events');
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('process.chdir is not available in Workers');
|
||||||
|
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const cp = require('child_process');
|
const cp = require('child_process');
|
||||||
|
@ -5,6 +5,9 @@ const cp = require('child_process');
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const util = require('util');
|
const util = require('util');
|
||||||
|
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('process.chdir is not available in Workers');
|
||||||
|
|
||||||
const CODE =
|
const CODE =
|
||||||
'setTimeout(() => { for (var i = 0; i < 100000; i++) { "test" + i } }, 1)';
|
'setTimeout(() => { for (var i = 0; i < 100000; i++) { "test" + i } }, 1)';
|
||||||
const FILE_NAME = 'node_trace.1.log';
|
const FILE_NAME = 'node_trace.1.log';
|
||||||
|
@ -4,6 +4,9 @@ const assert = require('assert');
|
|||||||
const cp = require('child_process');
|
const cp = require('child_process');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('process.chdir is not available in Workers');
|
||||||
|
|
||||||
const CODE = `
|
const CODE = `
|
||||||
process.binding("trace_events").emit(
|
process.binding("trace_events").emit(
|
||||||
'b'.charCodeAt(0), 'custom',
|
'b'.charCodeAt(0), 'custom',
|
||||||
|
@ -6,6 +6,9 @@ const path = require('path');
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const tmpdir = require('../common/tmpdir');
|
const tmpdir = require('../common/tmpdir');
|
||||||
|
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('process.chdir is not available in Workers');
|
||||||
|
|
||||||
const names = [
|
const names = [
|
||||||
'environment',
|
'environment',
|
||||||
'nodeStart',
|
'nodeStart',
|
||||||
|
@ -3,6 +3,9 @@ const common = require('../common');
|
|||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const cp = require('child_process');
|
const cp = require('child_process');
|
||||||
|
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('process.chdir is not available in Workers');
|
||||||
|
|
||||||
const CODE = `console.log(
|
const CODE = `console.log(
|
||||||
process.binding("trace_events").categoryGroupEnabled("custom")
|
process.binding("trace_events").categoryGroupEnabled("custom")
|
||||||
);`;
|
);`;
|
||||||
|
@ -5,6 +5,9 @@ const assert = require('assert');
|
|||||||
const cp = require('child_process');
|
const cp = require('child_process');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('process.chdir is not available in Workers');
|
||||||
|
|
||||||
tmpdir.refresh();
|
tmpdir.refresh();
|
||||||
process.chdir(tmpdir.path);
|
process.chdir(tmpdir.path);
|
||||||
|
|
||||||
|
@ -4,6 +4,9 @@ const assert = require('assert');
|
|||||||
const cp = require('child_process');
|
const cp = require('child_process');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('process.chdir is not available in Workers');
|
||||||
|
|
||||||
const tests = new Array();
|
const tests = new Array();
|
||||||
const traceFile = 'node_trace.1.log';
|
const traceFile = 'node_trace.1.log';
|
||||||
|
|
||||||
|
@ -4,6 +4,9 @@ const assert = require('assert');
|
|||||||
const cp = require('child_process');
|
const cp = require('child_process');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('process.chdir is not available in Workers');
|
||||||
|
|
||||||
const CODE =
|
const CODE =
|
||||||
'setTimeout(() => { for (var i = 0; i < 100000; i++) { "test" + i } }, 1)';
|
'setTimeout(() => { for (var i = 0; i < 100000; i++) { "test" + i } }, 1)';
|
||||||
const FILE_NAME = 'node_trace.1.log';
|
const FILE_NAME = 'node_trace.1.log';
|
||||||
|
@ -4,6 +4,9 @@ const assert = require('assert');
|
|||||||
const cp = require('child_process');
|
const cp = require('child_process');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('process.chdir is not available in Workers');
|
||||||
|
|
||||||
const CODE =
|
const CODE =
|
||||||
'setTimeout(() => { for (var i = 0; i < 100000; i++) { "test" + i } }, 1)';
|
'setTimeout(() => { for (var i = 0; i < 100000; i++) { "test" + i } }, 1)';
|
||||||
const FILE_NAME = 'node_trace.1.log';
|
const FILE_NAME = 'node_trace.1.log';
|
||||||
|
@ -6,6 +6,9 @@ const path = require('path');
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const tmpdir = require('../common/tmpdir');
|
const tmpdir = require('../common/tmpdir');
|
||||||
|
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('process.chdir is not available in Workers');
|
||||||
|
|
||||||
if (process.argv[2] === 'child') {
|
if (process.argv[2] === 'child') {
|
||||||
const { performance } = require('perf_hooks');
|
const { performance } = require('perf_hooks');
|
||||||
|
|
||||||
|
@ -4,6 +4,9 @@ const assert = require('assert');
|
|||||||
const cp = require('child_process');
|
const cp = require('child_process');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('process.chdir is not available in Workers');
|
||||||
|
|
||||||
const tmpdir = require('../common/tmpdir');
|
const tmpdir = require('../common/tmpdir');
|
||||||
|
|
||||||
const FILE_NAME = 'node_trace.1.log';
|
const FILE_NAME = 'node_trace.1.log';
|
||||||
|
@ -4,6 +4,9 @@ const assert = require('assert');
|
|||||||
const cp = require('child_process');
|
const cp = require('child_process');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('process.chdir is not available in Workers');
|
||||||
|
|
||||||
const CODE =
|
const CODE =
|
||||||
'setTimeout(() => { for (var i = 0; i < 100000; i++) { "test" + i } }, 1)';
|
'setTimeout(() => { for (var i = 0; i < 100000; i++) { "test" + i } }, 1)';
|
||||||
const FILE_NAME = 'node_trace.1.log';
|
const FILE_NAME = 'node_trace.1.log';
|
||||||
|
@ -6,6 +6,9 @@ const path = require('path');
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const tmpdir = require('../common/tmpdir');
|
const tmpdir = require('../common/tmpdir');
|
||||||
|
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('process.chdir is not available in Workers');
|
||||||
|
|
||||||
const names = [
|
const names = [
|
||||||
'ContextifyScript::New',
|
'ContextifyScript::New',
|
||||||
'RunInThisContext',
|
'RunInThisContext',
|
||||||
|
@ -39,6 +39,8 @@ common.crashOnUnhandledRejection();
|
|||||||
delete providers.STREAMPIPE;
|
delete providers.STREAMPIPE;
|
||||||
delete providers.MESSAGEPORT;
|
delete providers.MESSAGEPORT;
|
||||||
delete providers.WORKER;
|
delete providers.WORKER;
|
||||||
|
if (!common.isMainThread)
|
||||||
|
delete providers.INSPECTORJSBINDING;
|
||||||
|
|
||||||
const objKeys = Object.keys(providers);
|
const objKeys = Object.keys(providers);
|
||||||
if (objKeys.length > 0)
|
if (objKeys.length > 0)
|
||||||
@ -281,7 +283,8 @@ if (common.hasCrypto) { // eslint-disable-line node-core/crypto-check
|
|||||||
testInitialized(req, 'SendWrap');
|
testInitialized(req, 'SendWrap');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (process.config.variables.v8_enable_inspector !== 0) {
|
if (process.config.variables.v8_enable_inspector !== 0 &&
|
||||||
|
common.isMainThread) {
|
||||||
const binding = process.binding('inspector');
|
const binding = process.binding('inspector');
|
||||||
const handle = new binding.Connection(() => {});
|
const handle = new binding.Connection(() => {});
|
||||||
testInitialized(handle, 'Connection');
|
testInitialized(handle, 'Connection');
|
||||||
|
@ -30,7 +30,6 @@ try {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e instanceof RangeError && acceptableOOMErrors.includes(e.message))
|
if (e instanceof RangeError && acceptableOOMErrors.includes(e.message))
|
||||||
common.skip(`Unable to allocate ${size} bytes for ArrayBuffer`);
|
common.skip(`Unable to allocate ${size} bytes for ArrayBuffer`);
|
||||||
|
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,6 +28,9 @@ const path = require('path');
|
|||||||
|
|
||||||
const tmpdir = require('../common/tmpdir');
|
const tmpdir = require('../common/tmpdir');
|
||||||
|
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('process.chdir is not available in Workers');
|
||||||
|
|
||||||
const expectFilePath = common.isWindows ||
|
const expectFilePath = common.isWindows ||
|
||||||
common.isLinux ||
|
common.isLinux ||
|
||||||
common.isOSX ||
|
common.isOSX ||
|
||||||
|
@ -25,6 +25,9 @@ const assert = require('assert');
|
|||||||
const child = require('child_process');
|
const child = require('child_process');
|
||||||
const fixtures = require('../common/fixtures');
|
const fixtures = require('../common/fixtures');
|
||||||
|
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('process.chdir is not available in Workers');
|
||||||
|
|
||||||
if (process.env.TEST_INIT) {
|
if (process.env.TEST_INIT) {
|
||||||
return process.stdout.write('Loaded successfully!');
|
return process.stdout.write('Loaded successfully!');
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,10 @@
|
|||||||
|
|
||||||
const common = require('../common');
|
const common = require('../common');
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
|
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('--require does not work with Workers');
|
||||||
|
|
||||||
const inspector = require('inspector');
|
const inspector = require('inspector');
|
||||||
const msg = 'Test inspector logging';
|
const msg = 'Test inspector logging';
|
||||||
let asserted = false;
|
let asserted = false;
|
||||||
|
@ -4,6 +4,9 @@ const common = require('../common');
|
|||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const { performance } = require('perf_hooks');
|
const { performance } = require('perf_hooks');
|
||||||
|
|
||||||
|
if (!common.isMainThread)
|
||||||
|
common.skip('bootstrapping workers works differently');
|
||||||
|
|
||||||
assert(performance);
|
assert(performance);
|
||||||
assert(performance.nodeTiming);
|
assert(performance.nodeTiming);
|
||||||
assert.strictEqual(typeof performance.timeOrigin, 'number');
|
assert.strictEqual(typeof performance.timeOrigin, 'number');
|
||||||
|
11
tools/run-worker.js
Normal file
11
tools/run-worker.js
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
'use strict';
|
||||||
|
if (typeof require === 'undefined') {
|
||||||
|
console.log('1..0 # Skipped: Not being run as CommonJS');
|
||||||
|
process.exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
const path = require('path');
|
||||||
|
const { Worker } = require('worker');
|
||||||
|
|
||||||
|
new Worker(path.resolve(process.cwd(), process.argv[2]))
|
||||||
|
.on('exit', (code) => process.exitCode = code);
|
@ -1375,6 +1375,8 @@ def BuildOptions():
|
|||||||
help="Expect test cases to fail", default=False, action="store_true")
|
help="Expect test cases to fail", default=False, action="store_true")
|
||||||
result.add_option("--valgrind", help="Run tests through valgrind",
|
result.add_option("--valgrind", help="Run tests through valgrind",
|
||||||
default=False, action="store_true")
|
default=False, action="store_true")
|
||||||
|
result.add_option("--worker", help="Run parallel tests inside a worker context",
|
||||||
|
default=False, action="store_true")
|
||||||
result.add_option("--check-deopts", help="Check tests for permanent deoptimizations",
|
result.add_option("--check-deopts", help="Check tests for permanent deoptimizations",
|
||||||
default=False, action="store_true")
|
default=False, action="store_true")
|
||||||
result.add_option("--cat", help="Print the source of the tests",
|
result.add_option("--cat", help="Print the source of the tests",
|
||||||
@ -1617,6 +1619,11 @@ def Main():
|
|||||||
options.node_args.append("--always-opt")
|
options.node_args.append("--always-opt")
|
||||||
options.progress = "deopts"
|
options.progress = "deopts"
|
||||||
|
|
||||||
|
if options.worker:
|
||||||
|
run_worker = join(workspace, "tools", "run-worker.js")
|
||||||
|
options.node_args.append('--experimental-worker')
|
||||||
|
options.node_args.append(run_worker)
|
||||||
|
|
||||||
shell = abspath(options.shell)
|
shell = abspath(options.shell)
|
||||||
buildspace = dirname(shell)
|
buildspace = dirname(shell)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user