From 0f6a2627448cbda2094d9e945a54fb053483b399 Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Sun, 8 Jun 2025 18:47:08 +0530 Subject: [PATCH] test: improve flakiness detection on stack corruption tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This change skips asserting the exit code of the child process with the corrupted async hooks stack only on those platforms where termination via a signal has been observed. Refs: https://github.com/nodejs/node/pull/58478#discussion_r2132170010 Signed-off-by: Darshan Sen PR-URL: https://github.com/nodejs/node/pull/58601 Reviewed-By: Juan José Arboleda Reviewed-By: Joyee Cheung Reviewed-By: Rafael Gonzaga Reviewed-By: Luigi Pinca --- test/async-hooks/test-emit-after-on-destroyed.js | 7 +++++-- test/async-hooks/test-improper-unwind.js | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/test/async-hooks/test-emit-after-on-destroyed.js b/test/async-hooks/test-emit-after-on-destroyed.js index 5de296e6372..913cec7bd6a 100644 --- a/test/async-hooks/test-emit-after-on-destroyed.js +++ b/test/async-hooks/test-emit-after-on-destroyed.js @@ -53,9 +53,12 @@ if (process.argv[2] === 'child') { child.stdout.on('data', (d) => { outData = Buffer.concat([ outData, d ]); }); child.on('close', common.mustCall((code, signal) => { - if (signal) { - console.log(`Child closed with signal: ${signal}`); + if ((common.isAIX || + (common.isLinux && process.arch === 'x64')) && + signal === 'SIGABRT') { + // XXX: The child process could be aborted due to unknown reasons. Work around it. } else { + assert.strictEqual(signal, null); assert.strictEqual(code, 1); } assert.match(outData.toString(), heartbeatMsg, diff --git a/test/async-hooks/test-improper-unwind.js b/test/async-hooks/test-improper-unwind.js index de4ee1b758e..fb7f212a680 100644 --- a/test/async-hooks/test-improper-unwind.js +++ b/test/async-hooks/test-improper-unwind.js @@ -56,9 +56,12 @@ if (process.argv[2] === 'child') { child.stdout.on('data', (d) => { outData = Buffer.concat([ outData, d ]); }); child.on('close', common.mustCall((code, signal) => { - if (signal) { - console.log(`Child closed with signal: ${signal}`); + if ((common.isAIX || + (common.isLinux && process.arch === 'x64')) && + signal === 'SIGABRT') { + // XXX: The child process could be aborted due to unknown reasons. Work around it. } else { + assert.strictEqual(signal, null); assert.strictEqual(code, 1); } assert.match(outData.toString(), heartbeatMsg,