[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 01/17] tests: fix output message formatting for crypto benchmarks
From: |
Daniel P . Berrangé |
Subject: |
[PULL 01/17] tests: fix output message formatting for crypto benchmarks |
Date: |
Thu, 10 Sep 2020 11:06:07 +0100 |
The output was changed from g_print to g_test_message in
commit 24441f912e67233d9c52ce6b459ed75de2484525
Author: Marc-André Lureau <marcandre.lureau@redhat.com>
Date: Fri Aug 28 15:07:30 2020 +0400
tests: do not print benchmark output to stdout
As this makes the TAP output invalid. Use g_test_message().
The functions do not result in equivalent output. The g_print
statements were putting all the information on a single line
for ease of interpretation. The change to g_test_message split
the output across many lines making it painful to read.
The opportunity is used to tweak the information printed to be
more consistent across tests.
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
tests/benchmark-crypto-cipher.c | 12 ++++++++----
tests/benchmark-crypto-hash.c | 4 +++-
tests/benchmark-crypto-hmac.c | 7 +++----
3 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/tests/benchmark-crypto-cipher.c b/tests/benchmark-crypto-cipher.c
index 1936aa4ae0..c04f0a0fba 100644
--- a/tests/benchmark-crypto-cipher.c
+++ b/tests/benchmark-crypto-cipher.c
@@ -70,8 +70,10 @@ static void test_cipher_speed(size_t chunk_size,
}
g_test_timer_elapsed();
- g_test_message("Enc chunk %zu bytes ", chunk_size);
- g_test_message("%.2f MB/sec ", (double)total / MiB / g_test_timer_last());
+ g_test_message("enc(%s-%s) chunk %zu bytes %.2f MB/sec ",
+ QCryptoCipherAlgorithm_str(alg),
+ QCryptoCipherMode_str(mode),
+ chunk_size, (double)total / MiB / g_test_timer_last());
g_test_timer_start();
remain = total;
@@ -85,8 +87,10 @@ static void test_cipher_speed(size_t chunk_size,
}
g_test_timer_elapsed();
- g_test_message("Dec chunk %zu bytes ", chunk_size);
- g_test_message("%.2f MB/sec ", (double)total / MiB / g_test_timer_last());
+ g_test_message("dec(%s-%s) chunk %zu bytes %.2f MB/sec ",
+ QCryptoCipherAlgorithm_str(alg),
+ QCryptoCipherMode_str(mode),
+ chunk_size, (double)total / MiB / g_test_timer_last());
qcrypto_cipher_free(cipher);
g_free(plaintext);
diff --git a/tests/benchmark-crypto-hash.c b/tests/benchmark-crypto-hash.c
index 598111e75a..927b00bb4d 100644
--- a/tests/benchmark-crypto-hash.c
+++ b/tests/benchmark-crypto-hash.c
@@ -48,7 +48,9 @@ static void test_hash_speed(const void *opaque)
}
g_test_timer_elapsed();
- g_test_message("%.2f MB/sec ", (double)total / MiB / g_test_timer_last());
+ g_test_message("hash(%s): chunk %zu bytes %.2f MB/sec",
+ QCryptoHashAlgorithm_str(opts->alg),
+ opts->chunk_size, total / g_test_timer_last());
g_free(out);
g_free(in);
diff --git a/tests/benchmark-crypto-hmac.c b/tests/benchmark-crypto-hmac.c
index f9fa22df95..5cca636789 100644
--- a/tests/benchmark-crypto-hmac.c
+++ b/tests/benchmark-crypto-hmac.c
@@ -55,10 +55,9 @@ static void test_hmac_speed(const void *opaque)
} while (g_test_timer_elapsed() < 5.0);
total /= MiB;
- g_test_message("hmac(sha256): ");
- g_test_message("Testing chunk_size %zu bytes ", chunk_size);
- g_test_message("done: %.2f MB in %.2f secs: ", total, g_test_timer_last());
- g_test_message("%.2f MB/sec\n", total / g_test_timer_last());
+ g_test_message("hmac(%s): chunk %zu bytes %.2f MB/sec",
+ QCryptoHashAlgorithm_str(QCRYPTO_HASH_ALG_SHA256),
+ chunk_size, total / g_test_timer_last());
g_free(out);
g_free(in);
--
2.26.2
- [PULL 00/17] Crypto next patches, Daniel P . Berrangé, 2020/09/10
- [PULL 01/17] tests: fix output message formatting for crypto benchmarks,
Daniel P . Berrangé <=
- [PULL 02/17] crypto: Assume blocksize is a power of 2, Daniel P . Berrangé, 2020/09/10
- [PULL 03/17] crypto: Rename cipher include files to .c.inc, Daniel P . Berrangé, 2020/09/10
- [PULL 04/17] crypto: Remove redundant includes, Daniel P . Berrangé, 2020/09/10
- [PULL 05/17] crypto/nettle: Fix xts_encrypt arguments, Daniel P . Berrangé, 2020/09/10
- [PULL 06/17] crypto: Move QCryptoCipherDriver typedef to crypto/cipher.h, Daniel P . Berrangé, 2020/09/10
- [PULL 07/17] crypto: Use the correct const type for driver, Daniel P . Berrangé, 2020/09/10
- [PULL 08/17] crypto: Allocate QCryptoCipher with the subclass, Daniel P . Berrangé, 2020/09/10
- [PULL 09/17] crypto: Move cipher->driver init to qcrypto_*_cipher_ctx_new, Daniel P . Berrangé, 2020/09/10
- [PULL 11/17] crypto/builtin: Remove odd-sized AES block handling, Daniel P . Berrangé, 2020/09/10
- [PULL 12/17] crypto/builtin: Merge qcrypto_cipher_aes_{ecb, xts}_{en, de}crypt, Daniel P . Berrangé, 2020/09/10