diff options
author | Rich Trott <rtrott@gmail.com> | 2018-05-30 08:46:38 +0000 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2018-06-02 04:42:09 +0200 |
commit | 6168959546f84449f6c12efbc65189c9b45a4130 (patch) | |
tree | 9838a1f3d15ebc9d32346a1b986c71759a307f1b | |
parent | 862a22ab490818909f5dc448e1805bc846c8c6d0 (diff) | |
download | node-new-6168959546f84449f6c12efbc65189c9b45a4130.tar.gz |
test: run crypto benchmark only once in tests
Prevent crypto benchmark files from running more than one benchmark
during tests.
PR-URL: https://github.com/nodejs/node/pull/21032
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
-rw-r--r-- | benchmark/crypto/aes-gcm-throughput.js | 3 | ||||
-rw-r--r-- | benchmark/crypto/cipher-stream.js | 3 | ||||
-rw-r--r-- | test/parallel/test-benchmark-crypto.js | 5 |
3 files changed, 9 insertions, 2 deletions
diff --git a/benchmark/crypto/aes-gcm-throughput.js b/benchmark/crypto/aes-gcm-throughput.js index 5c1e71e728..cd8f29c8c7 100644 --- a/benchmark/crypto/aes-gcm-throughput.js +++ b/benchmark/crypto/aes-gcm-throughput.js @@ -9,6 +9,9 @@ const bench = common.createBenchmark(main, { }); function main({ n, len, cipher }) { + // Default cipher for tests. + if (cipher === '') + cipher = 'aes-128-gcm'; const message = Buffer.alloc(len, 'b'); const key = crypto.randomBytes(keylen[cipher]); const iv = crypto.randomBytes(12); diff --git a/benchmark/crypto/cipher-stream.js b/benchmark/crypto/cipher-stream.js index 64f6ff7b72..9f986dfb36 100644 --- a/benchmark/crypto/cipher-stream.js +++ b/benchmark/crypto/cipher-stream.js @@ -10,6 +10,9 @@ const bench = common.createBenchmark(main, { }); function main({ api, cipher, type, len, writes }) { + // Default cipher for tests. + if (cipher === '') + cipher = 'AES192'; if (api === 'stream' && /^v0\.[0-8]\./.test(process.version)) { console.error('Crypto streams not available until v0.10'); // use the legacy, just so that we can compare them. diff --git a/test/parallel/test-benchmark-crypto.js b/test/parallel/test-benchmark-crypto.js index 2e78d78bc9..f24edf675f 100644 --- a/test/parallel/test-benchmark-crypto.js +++ b/test/parallel/test-benchmark-crypto.js @@ -12,14 +12,15 @@ const runBenchmark = require('../common/benchmark'); runBenchmark('crypto', [ - 'n=1', 'algo=sha256', 'api=stream', + 'cipher=', 'keylen=1024', 'len=1', + 'n=1', 'out=buffer', 'type=buf', 'v=crypto', - 'writes=1' + 'writes=1', ], { NODEJS_BENCHMARK_ZERO_ALLOWED: 1 }); |