diff mbox

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

Message ID 1426693221-31018-2-git-send-email-taras.kondratiuk@linaro.org
State Accepted
Commit 040a85a205569a30d3168a292d4acda2a32fd926
Headers show

Commit Message

Taras Kondratiuk March 18, 2015, 3:40 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 | 27 +++++++++++-----------
 1 file changed, 14 insertions(+), 13 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 feefd49..527e98a 100644
--- a/test/validation/crypto/odp_crypto_test_async_inp.c
+++ b/test/validation/crypto/odp_crypto_test_async_inp.c
@@ -92,23 +92,24 @@  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);
-
-	compl_event = odp_crypto_compl_from_event(event);
-	CU_ASSERT(odp_crypto_compl_to_u64(compl_event) ==
-		  odp_crypto_compl_to_u64(odp_crypto_compl_from_event(event)));
-	odp_crypto_compl_result(compl_event, &result);
-	odp_crypto_compl_free(compl_event);
+
+	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);
+		CU_ASSERT(odp_crypto_compl_to_u64(compl_event) ==
+			  odp_crypto_compl_to_u64(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);