diff --git a/benchmark/crypto/timingSafeEqual.js b/benchmark/crypto/timingSafeEqual.js index 475807dba4ea..bd8962a3bdf4 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 ea666f58a73a..322a71910258 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] diff --git a/test/parallel/parallel.status b/test/parallel/parallel.status index d8fba447e96e..921c04d011d1 100644 --- a/test/parallel/parallel.status +++ b/test/parallel/parallel.status @@ -35,10 +35,6 @@ test-performance-function: PASS, FLAKY # https://github.com/nodejs/node/issues/54346 test-esm-loader-hooks-inspect-wait: PASS, FLAKY -[$system==linux && $arch==s390x] -# https://github.com/nodejs/node/issues/58353 -test-http2-debug: PASS, FLAKY - [$system==macos] # https://github.com/nodejs/node/issues/42741 test-http-server-headers-timeout-keepalive: PASS,FLAKY diff --git a/test/parallel/test-http2-debug.js b/test/parallel/test-http2-debug.js index 5f2f6c54da7c..c7252317be3a 100644 --- a/test/parallel/test-http2-debug.js +++ b/test/parallel/test-http2-debug.js @@ -5,27 +5,37 @@ if (!common.hasCrypto) common.skip('missing crypto'); const assert = require('assert'); const { spawnSyncAndAssert } = require('../common/child_process'); +const fs = require('fs'); const path = require('path'); +const tmpdir = require('../common/tmpdir'); -spawnSyncAndAssert(process.execPath, [ - path.resolve(__dirname, 'test-http2-ping.js'), -], { - env: { - ...process.env, - NODE_DEBUG: 'http2', - NODE_DEBUG_NATIVE: 'http2', - }, -}, { - trim: true, - stderr(output) { - assert.match(output, - /Setting the NODE_DEBUG environment variable to 'http2' can expose sensitive data/); - assert.match(output, /\(such as passwords, tokens and authentication headers\) in the resulting log\.\r?\n/); - assert.match(output, /Http2Session client \(\d+\) handling data frame for stream \d+\r?\n/); - assert.match(output, /HttpStream \d+ \(\d+\) \[Http2Session client \(\d+\)\] reading starting\r?\n/); - assert.match(output, /HttpStream \d+ \(\d+\) \[Http2Session client \(\d+\)\] closed with code 0\r?\n/); - assert.match(output, /HttpStream \d+ \(\d+\) \[Http2Session server \(\d+\)\] closed with code 0\r?\n/); - assert.match(output, /HttpStream \d+ \(\d+\) \[Http2Session server \(\d+\)\] tearing down stream\r?\n/); - }, - stdout: '' -}); +tmpdir.refresh(); +const stderrFile = tmpdir.resolve('stderr.log'); +// Native debug writes can be lost when a non-blocking stderr pipe fills. +const stderrFd = fs.openSync(stderrFile, 'w'); +try { + spawnSyncAndAssert(process.execPath, [ + path.resolve(__dirname, 'test-http2-ping.js'), + ], { + env: { + ...process.env, + NODE_DEBUG: 'http2', + NODE_DEBUG_NATIVE: 'http2', + }, + stdio: ['pipe', 'pipe', stderrFd], + }, { + stdout: '' + }); +} finally { + fs.closeSync(stderrFd); +} + +const output = fs.readFileSync(stderrFile, 'utf8'); +assert.match(output, + /Setting the NODE_DEBUG environment variable to 'http2' can expose sensitive data/); +assert.match(output, /\(such as passwords, tokens and authentication headers\) in the resulting log\.\r?\n/); +assert.match(output, /Http2Session client \(\d+\) handling data frame for stream \d+\r?\n/); +assert.match(output, /HttpStream \d+ \(\d+\) \[Http2Session client \(\d+\)\] reading starting\r?\n/); +assert.match(output, /HttpStream \d+ \(\d+\) \[Http2Session client \(\d+\)\] closed with code 0\r?\n/); +assert.match(output, /HttpStream \d+ \(\d+\) \[Http2Session server \(\d+\)\] closed with code 0\r?\n/); +assert.match(output, /HttpStream \d+ \(\d+\) \[Http2Session server \(\d+\)\] tearing down stream\r?\n/);