diff options
author | Daniel P. Berrangé <berrange@redhat.com> | 2024-03-11 12:11:09 +0000 |
---|---|---|
committer | Daniel P. Berrangé <berrange@redhat.com> | 2024-03-19 20:17:12 +0000 |
commit | 48ca1cabd3f8f3ec5342bd5b6ae9513b12d1951d (patch) | |
tree | feb2979a874df7020b4b4316f1edecea35b47330 | |
parent | e503fc55acffccac5d2755633e7a48262e8edd9b (diff) | |
download | qemu-48ca1cabd3f8f3ec5342bd5b6ae9513b12d1951d.zip qemu-48ca1cabd3f8f3ec5342bd5b6ae9513b12d1951d.tar.gz qemu-48ca1cabd3f8f3ec5342bd5b6ae9513b12d1951d.tar.bz2 |
crypto: use error_abort for unexpected failures
This improves the error diagnosis from the unit test when a cipher
is unexpected not available from
ERROR:../tests/unit/test-crypto-cipher.c:683:test_cipher: assertion failed: (err == NULL)
Bail out! ERROR:../tests/unit/test-crypto-cipher.c:683:test_cipher: assertion failed: (err == NULL)
Aborted (core dumped)
to
Unexpected error in qcrypto_cipher_ctx_new() at ../crypto/cipher-gcrypt.c.inc:262:
./build//tests/unit/test-crypto-cipher: Cannot initialize cipher: Invalid cipher algorithm
Aborted (core dumped)
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
-rw-r--r-- | tests/unit/test-crypto-cipher.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/tests/unit/test-crypto-cipher.c b/tests/unit/test-crypto-cipher.c index 11ab1a5..d0ea7b4 100644 --- a/tests/unit/test-crypto-cipher.c +++ b/tests/unit/test-crypto-cipher.c @@ -676,9 +676,8 @@ static void test_cipher(const void *opaque) cipher = qcrypto_cipher_new( data->alg, data->mode, key, nkey, - &err); + data->plaintext ? &error_abort : &err); if (data->plaintext) { - g_assert(err == NULL); g_assert(cipher != NULL); } else { error_free_or_abort(&err); |