Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: fix flaky test-repl-sigint-nested-eval #45354

Merged
merged 2 commits into from
Nov 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions test/parallel/parallel.status
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ prefix parallel
# sample-test : PASS,FLAKY

[true] # This section applies to all platforms
# https://github.com/nodejs/node/issues/41123
test-repl-sigint-nested-eval: PASS, FLAKY
# https://github.com/nodejs/node/issues/43084
test-worker-http2-stream-terminate: PASS, FLAKY

Expand Down
13 changes: 7 additions & 6 deletions test/parallel/test-repl-sigint-nested-eval.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ if (!common.isMainThread)
const assert = require('assert');
const spawn = require('child_process').spawn;

process.env.REPL_TEST_PPID = process.pid;
const child = spawn(process.execPath, [ '-i' ], {
stdio: [null, null, 2]
stdio: [null, null, 2, 'ipc']
});

let stdout = '';
Expand All @@ -22,17 +21,19 @@ child.stdout.on('data', function(c) {
});

child.stdout.once('data', common.mustCall(() => {
process.on('SIGUSR2', common.mustCall(() => {
child.on('message', common.mustCall((msg) => {
assert.strictEqual(msg, 'repl is busy');
process.kill(child.pid, 'SIGINT');
child.stdout.once('data', common.mustCall(() => {
// Make sure REPL still works.
child.stdin.end('"foobar"\n');
}));
}));

child.stdin.write('process.kill(+process.env.REPL_TEST_PPID, "SIGUSR2");' +
'vm.runInThisContext("while(true){}", ' +
'{ breakOnSigint: true });\n');
child.stdin.write(
'vm.runInThisContext("process.send(\'repl is busy\'); while(true){}", ' +
'{ breakOnSigint: true });\n'
);
}));

child.on('close', function(code) {
Expand Down