From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33351) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bxDet-0006Yk-Ul for qemu-devel@nongnu.org; Thu, 20 Oct 2016 09:45:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bxDet-00042I-1v for qemu-devel@nongnu.org; Thu, 20 Oct 2016 09:45:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59078) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1bxDes-00042A-Rz for qemu-devel@nongnu.org; Thu, 20 Oct 2016 09:45:22 -0400 From: "Daniel P. Berrange" Date: Thu, 20 Oct 2016 14:45:09 +0100 Message-Id: <1476971110-10403-6-git-send-email-berrange@redhat.com> In-Reply-To: <1476971110-10403-1-git-send-email-berrange@redhat.com> References: <1476971110-10403-1-git-send-email-berrange@redhat.com> Subject: [Qemu-devel] [PULL v1 5/6] crypto: fix initialization of crypto in tests List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , "Daniel P. Berrange" 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 Signed-off-by: Daniel P. Berrange --- 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