node/test/sequential/test-vm-break-on-sigint.js
Keyhan Vakil f045a13cc9
test: move test-vm-break-on-sigint to sequential
This PR moves `test-vm-break-on-sigint.js` to sequential, following the
other PRs I have made to move CPU intensive tests into sequential. The
test has already been tuned to do less iterations in a previous PR.
However it is still causing ~7% of build failures. The timeouts seem
highly correlated with other tests which spawn a bunch of threads also
failing, see for example the [first Jenkins failure][] and the [last
Jenkins failure][].

[first Jenkins failure]: https://ci.nodejs.org/job/node-test-pull-request/45756/
[last Jenkins failure]: https://ci.nodejs.org/job/node-test-pull-request/45837/

Refs: https://github.com/nodejs/node/pull/44090
Refs: https://github.com/nodejs/node/pull/43981
Refs: https://github.com/nodejs/reliability/issues/337
PR-URL: https://github.com/nodejs/node/pull/44140
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: theanarkh <theratliter@gmail.com>
Reviewed-By: Feng Yu <F3n67u@outlook.com>
2022-08-07 12:26:59 +00:00

23 lines
710 B
JavaScript

'use strict';
const common = require('../common');
// This test ensures that running vm with breakOnSignt option in multiple
// worker_threads does not crash.
// Issue: https://github.com/nodejs/node/issues/43699
const { Worker } = require('worker_threads');
const vm = require('vm');
// Don't use isMainThread to allow running this test inside a worker.
if (!process.env.HAS_STARTED_WORKER) {
process.env.HAS_STARTED_WORKER = 1;
for (let i = 0; i < 10; i++) {
const worker = new Worker(__filename);
worker.on('exit', common.mustCall());
}
} else {
const ctx = vm.createContext({});
for (let i = 0; i < 100; i++) {
vm.runInContext('console.log(1)', ctx, { breakOnSigint: true });
}
}