Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c8ee379

Browse filesBrowse files
TrottMylesBorins
authored andcommitted
test: run crypto benchmark only once in tests
Prevent crypto benchmark files from running more than one benchmark during tests. PR-URL: #21032 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
1 parent a3fdd2e commit c8ee379
Copy full SHA for c8ee379

File tree

Expand file treeCollapse file tree

3 files changed

+9
-2
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

3 files changed

+9
-2
lines changed
Open diff view settings
Collapse file

‎benchmark/crypto/aes-gcm-throughput.js‎

Copy file name to clipboardExpand all lines: benchmark/crypto/aes-gcm-throughput.js
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ const bench = common.createBenchmark(main, {
99
});
1010

1111
function main({ n, len, cipher }) {
12+
// Default cipher for tests.
13+
if (cipher === '')
14+
cipher = 'aes-128-gcm';
1215
const message = Buffer.alloc(len, 'b');
1316
const key = crypto.randomBytes(keylen[cipher]);
1417
const iv = crypto.randomBytes(12);
Collapse file

‎benchmark/crypto/cipher-stream.js‎

Copy file name to clipboardExpand all lines: benchmark/crypto/cipher-stream.js
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ const bench = common.createBenchmark(main, {
1010
});
1111

1212
function main({ api, cipher, type, len, writes }) {
13+
// Default cipher for tests.
14+
if (cipher === '')
15+
cipher = 'AES192';
1316
if (api === 'stream' && /^v0\.[0-8]\./.test(process.version)) {
1417
console.error('Crypto streams not available until v0.10');
1518
// use the legacy, just so that we can compare them.
Collapse file

‎test/parallel/test-benchmark-crypto.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-benchmark-crypto.js
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@ const runBenchmark = require('../common/benchmark');
1212

1313
runBenchmark('crypto',
1414
[
15-
'n=1',
1615
'algo=sha256',
1716
'api=stream',
17+
'cipher=',
1818
'keylen=1024',
1919
'len=1',
20+
'n=1',
2021
'out=buffer',
2122
'type=buf',
2223
'v=crypto',
23-
'writes=1'
24+
'writes=1',
2425
],
2526
{ NODEJS_BENCHMARK_ZERO_ALLOWED: 1 });

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.