qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 04/18] crypto: use &error_fatal in crypto tests


From: Eric Blake
Subject: Re: [PATCH 04/18] crypto: use &error_fatal in crypto tests
Date: Thu, 8 Jul 2021 13:33:07 -0500
User-agent: NeoMutt/20210205-556-f84451-dirty

On Tue, Jul 06, 2021 at 10:59:10AM +0100, Daniel P. Berrangé wrote:
> Using error_fatal provides better diagnostics when tests
> failed, than using asserts, because we see the text of
> the error message.
> 
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>  tests/unit/test-crypto-hash.c | 12 ++++++------
>  tests/unit/test-crypto-hmac.c | 28 ++++++++--------------------
>  2 files changed, 14 insertions(+), 26 deletions(-)

> 
> diff --git a/tests/unit/test-crypto-hash.c b/tests/unit/test-crypto-hash.c
> index ce7d0ab9b5..b50e28f212 100644
> --- a/tests/unit/test-crypto-hash.c
> @@ -243,7 +243,7 @@ static void test_hash_base64(void)
>  
>  int main(int argc, char **argv)
>  {
> -    g_assert(qcrypto_init(NULL) == 0);
> +    g_assert(qcrypto_init(&error_fatal) == 0);

This is a side effect inside a g_assert().  It might be worth cleaning
it up while you are touching here.  But since it is pre-existing, it
doesn't affect my:

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org




reply via email to

[Prev in Thread] Current Thread [Next in Thread]