From: "Daniel P. Berrange" <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
"Daniel P. Berrange" <berrange@redhat.com>
Subject: [Qemu-devel] [PULL v1 5/6] crypto: fix initialization of crypto in tests
Date: Wed, 19 Oct 2016 11:02:47 +0100 [thread overview]
Message-ID: <1476871368-9120-6-git-send-email-berrange@redhat.com> (raw)
In-Reply-To: <1476871368-9120-1-git-send-email-berrange@redhat.com>
The test-io-channel-tls test was missing a call to qcrypto_init
and test-crypto-hash was initializing it multiple times,
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
---
tests/test-crypto-hash.c | 12 ++----------
tests/test-io-channel-tls.c | 3 +++
2 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/tests/test-crypto-hash.c b/tests/test-crypto-hash.c
index 42fc77a..214a9f7 100644
--- a/tests/test-crypto-hash.c
+++ b/tests/test-crypto-hash.c
@@ -89,8 +89,6 @@ static void test_hash_alloc(void)
{
size_t i;
- g_assert(qcrypto_init(NULL) == 0);
-
for (i = 0; i < G_N_ELEMENTS(expected_outputs) ; i++) {
uint8_t *result = NULL;
size_t resultlen = 0;
@@ -123,8 +121,6 @@ static void test_hash_prealloc(void)
{
size_t i;
- g_assert(qcrypto_init(NULL) == 0);
-
for (i = 0; i < G_N_ELEMENTS(expected_outputs) ; i++) {
uint8_t *result;
size_t resultlen;
@@ -161,8 +157,6 @@ static void test_hash_iov(void)
{
size_t i;
- g_assert(qcrypto_init(NULL) == 0);
-
for (i = 0; i < G_N_ELEMENTS(expected_outputs) ; i++) {
struct iovec iov[3] = {
{ .iov_base = (char *)INPUT_TEXT1, .iov_len = strlen(INPUT_TEXT1) },
@@ -199,8 +193,6 @@ static void test_hash_digest(void)
{
size_t i;
- g_assert(qcrypto_init(NULL) == 0);
-
for (i = 0; i < G_N_ELEMENTS(expected_outputs) ; i++) {
int ret;
char *digest;
@@ -230,8 +222,6 @@ static void test_hash_base64(void)
{
size_t i;
- g_assert(qcrypto_init(NULL) == 0);
-
for (i = 0; i < G_N_ELEMENTS(expected_outputs) ; i++) {
int ret;
char *digest;
@@ -253,6 +243,8 @@ static void test_hash_base64(void)
int main(int argc, char **argv)
{
+ g_assert(qcrypto_init(NULL) == 0);
+
g_test_init(&argc, &argv, NULL);
g_test_add_func("/crypto/hash/iov", test_hash_iov);
g_test_add_func("/crypto/hash/alloc", test_hash_alloc);
diff --git a/tests/test-io-channel-tls.c b/tests/test-io-channel-tls.c
index 3c361a7..bd3ae2b 100644
--- a/tests/test-io-channel-tls.c
+++ b/tests/test-io-channel-tls.c
@@ -27,6 +27,7 @@
#include "io/channel-tls.h"
#include "io/channel-socket.h"
#include "io-channel-helpers.h"
+#include "crypto/init.h"
#include "crypto/tlscredsx509.h"
#include "qemu/acl.h"
#include "qom/object_interfaces.h"
@@ -265,6 +266,8 @@ int main(int argc, char **argv)
{
int ret;
+ g_assert(qcrypto_init(NULL) == 0);
+
module_call_init(MODULE_INIT_QOM);
g_test_init(&argc, &argv, NULL);
setenv("GNUTLS_FORCE_FIPS_MODE", "2", 1);
--
2.7.4
next prev parent reply other threads:[~2016-10-19 10:03 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-19 10:02 [Qemu-devel] [PULL v1 0/6] Merge qcrypto 2016/10/19 Daniel P. Berrange
2016-10-19 10:02 ` [Qemu-devel] [PULL v1 1/6] crypto: extend mode as a parameter in qcrypto_cipher_supports() Daniel P. Berrange
2016-10-19 10:02 ` [Qemu-devel] [PULL v1 2/6] crypto: add CTR mode support Daniel P. Berrange
2016-10-19 10:02 ` [Qemu-devel] [PULL v1 3/6] crypto: add mode check in qcrypto_cipher_new() for cipher-builtin Daniel P. Berrange
2016-10-19 10:02 ` [Qemu-devel] [PULL v1 4/6] qtest: fix make check complaint in crypto module Daniel P. Berrange
2016-10-19 10:02 ` Daniel P. Berrange [this message]
2016-10-19 10:02 ` [Qemu-devel] [PULL v1 6/6] crypto: fix initialization of gcrypt threading Daniel P. Berrange
2016-10-20 9:28 ` [Qemu-devel] [PULL v1 0/6] Merge qcrypto 2016/10/19 Daniel P. Berrange
-- strict thread matches above, loose matches on Subject: below --
2016-10-20 13:45 [Qemu-devel] [PULL v1 0/6] Merge qcrypto 2016/10/20 Daniel P. Berrange
2016-10-20 13:45 ` [Qemu-devel] [PULL v1 5/6] crypto: fix initialization of crypto in tests Daniel P. Berrange
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1476871368-9120-6-git-send-email-berrange@redhat.com \
--to=berrange@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.