mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
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>
This commit is contained in:
1 parent
8d904b4f4e
commit
bdfca60f11
2 files changed
+4
-3
No files matched your search
@@ -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++) {
|
||||
|
||||
@@ -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]
|
||||
|
||||
Reference in new issue
Block a user