diff mbox

[RFC,1/2] validation: crypto: handle synchronous operations in async test

Message ID 1424992760-28846-2-git-send-email-taras.kondratiuk@linaro.org
State New
Headers show

Commit Message

Taras Kondratiuk Feb. 26, 2015, 11:19 p.m. UTC
Current API can't force crypto operation to be strictly sync or async.
Hence test should handle synchronous operation even if 'pref_mode' is
set to ODP_CRYPTO_ASYNC.

Signed-off-by: Taras Kondratiuk <taras.kondratiuk@linaro.org>
---
 test/validation/crypto/odp_crypto_test_async_inp.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)
diff mbox

Patch

diff --git a/test/validation/crypto/odp_crypto_test_async_inp.c b/test/validation/crypto/odp_crypto_test_async_inp.c
index 9e4e9f1..494a68e 100644
--- a/test/validation/crypto/odp_crypto_test_async_inp.c
+++ b/test/validation/crypto/odp_crypto_test_async_inp.c
@@ -90,21 +90,22 @@  static void alg_test(enum odp_crypto_op op,
 		CU_FAIL("%s : not implemented for combined alg mode\n");
 	}
 
-	rc = odp_crypto_operation(&op_params, &posted, NULL);
+	rc = odp_crypto_operation(&op_params, &posted, &result);
 	if (rc < 0) {
 		CU_FAIL("Failed odp_crypto_operation()");
 		goto cleanup;
 	}
-	CU_ASSERT(posted);
 
-	/* Poll completion queue for results */
-	do {
-		event = odp_queue_deq(compl_queue);
-	} while (event == ODP_EVENT_INVALID);
+	if (posted) {
+		/* Poll completion queue for results */
+		do {
+			event = odp_queue_deq(suite_context.queue);
+		} while (event == ODP_EVENT_INVALID);
 
-	compl_event = odp_crypto_compl_from_event(event);
-	odp_crypto_compl_result(compl_event, &result);
-	odp_crypto_compl_free(compl_event);
+		compl_event = odp_crypto_compl_from_event(event);
+		odp_crypto_compl_result(compl_event, &result);
+		odp_crypto_compl_free(compl_event);
+	}
 
 	CU_ASSERT(result.ok);
 	CU_ASSERT(result.pkt == pkt);