diff mbox

[v4,05/26] crypto: skip testing of unsupported cipher algorithms

Message ID 1456747261-22032-6-git-send-email-berrange@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Daniel P. Berrangé Feb. 29, 2016, noon UTC
We don't guarantee that all crypto backends will support
all cipher algorithms, so we should skip tests unless
the crypto backend indicates support.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
---
 tests/test-crypto-cipher.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Fam Zheng March 7, 2016, 5:52 a.m. UTC | #1
On Mon, 02/29 12:00, Daniel P. Berrange wrote:
> We don't guarantee that all crypto backends will support
> all cipher algorithms, so we should skip tests unless
> the crypto backend indicates support.
> 
> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
> ---
>  tests/test-crypto-cipher.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/test-crypto-cipher.c b/tests/test-crypto-cipher.c
> index 9f912ec..7a073e9 100644
> --- a/tests/test-crypto-cipher.c
> +++ b/tests/test-crypto-cipher.c
> @@ -380,7 +380,9 @@ int main(int argc, char **argv)
>      g_assert(qcrypto_init(NULL) == 0);
>  
>      for (i = 0; i < G_N_ELEMENTS(test_data); i++) {
> -        g_test_add_data_func(test_data[i].path, &test_data[i], test_cipher);
> +        if (qcrypto_cipher_supports(test_data[i].alg)) {
> +            g_test_add_data_func(test_data[i].path, &test_data[i], test_cipher);
> +        }
>      }
>  
>      g_test_add_func("/crypto/cipher/null-iv",
> -- 
> 2.5.0
> 

Reviewed-by: Fam Zheng <famz@redhat.com>
Eric Blake March 11, 2016, 7:10 p.m. UTC | #2
On 02/29/2016 05:00 AM, Daniel P. Berrange wrote:
> We don't guarantee that all crypto backends will support
> all cipher algorithms, so we should skip tests unless
> the crypto backend indicates support.
> 
> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
> ---
>  tests/test-crypto-cipher.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

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

> 
> diff --git a/tests/test-crypto-cipher.c b/tests/test-crypto-cipher.c
> index 9f912ec..7a073e9 100644
> --- a/tests/test-crypto-cipher.c
> +++ b/tests/test-crypto-cipher.c
> @@ -380,7 +380,9 @@ int main(int argc, char **argv)
>      g_assert(qcrypto_init(NULL) == 0);
>  
>      for (i = 0; i < G_N_ELEMENTS(test_data); i++) {
> -        g_test_add_data_func(test_data[i].path, &test_data[i], test_cipher);
> +        if (qcrypto_cipher_supports(test_data[i].alg)) {
> +            g_test_add_data_func(test_data[i].path, &test_data[i], test_cipher);
> +        }
>      }
>  
>      g_test_add_func("/crypto/cipher/null-iv",
>
diff mbox

Patch

diff --git a/tests/test-crypto-cipher.c b/tests/test-crypto-cipher.c
index 9f912ec..7a073e9 100644
--- a/tests/test-crypto-cipher.c
+++ b/tests/test-crypto-cipher.c
@@ -380,7 +380,9 @@  int main(int argc, char **argv)
     g_assert(qcrypto_init(NULL) == 0);
 
     for (i = 0; i < G_N_ELEMENTS(test_data); i++) {
-        g_test_add_data_func(test_data[i].path, &test_data[i], test_cipher);
+        if (qcrypto_cipher_supports(test_data[i].alg)) {
+            g_test_add_data_func(test_data[i].path, &test_data[i], test_cipher);
+        }
     }
 
     g_test_add_func("/crypto/cipher/null-iv",