Commit 194eb69f8b3 for nodejs
commit 194eb69f8b32c6a97c2480f5ea1149237448ceeb
Author: Filip Skokan <panva.ip@gmail.com>
Date: Sun Sep 20 09:12:05 2026 +0200
test: deflake test-benchmark-crypto
Test mode reduces bufferSize to one, giving the random buffers a 1/256
chance of matching and failing the comparison count assertion. Use 256
bytes in test mode and force the first bytes to differ before timing.
Remove the flaky designation.
Fixes: https://github.com/nodejs/node/issues/52690
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
Assisted-by: Codex
PR-URL: https://github.com/nodejs/node/pull/66151
Fixes: https://github.com/nodejs/node/issues/58353
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Richard Lau <richard.lau@ibm.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
diff --git a/benchmark/crypto/timingSafeEqual.js b/benchmark/crypto/timingSafeEqual.js
index 475807dba4e..bd8962a3bdf 100644
--- a/benchmark/crypto/timingSafeEqual.js
+++ b/benchmark/crypto/timingSafeEqual.js
@@ -7,10 +7,14 @@ const { randomBytes, timingSafeEqual } = require('node:crypto');
const bench = common.createBenchmark(main, {
n: [1e5],
bufferSize: [10, 100, 200, 2_100, 22_023],
+}, {
+ test: { bufferSize: 256 },
});
function main({ n, bufferSize }) {
const bufs = [randomBytes(bufferSize), randomBytes(bufferSize)];
+ // Ensure the buffers differ even if the random bytes are identical.
+ bufs[1][0] = bufs[0][0] ^ 1;
bench.start();
let count = 0;
for (let i = 0; i < n; i++) {
diff --git a/test/benchmark/benchmark.status b/test/benchmark/benchmark.status
index ea666f58a73..322a7191025 100644
--- a/test/benchmark/benchmark.status
+++ b/test/benchmark/benchmark.status
@@ -6,9 +6,6 @@ prefix benchmark
[true] # This section applies to all platforms
-# https://github.com/nodejs/node/issues/52690
-test-benchmark-crypto: PASS, FLAKY
-
[$system==win32]
[$system==linux]