diff mbox series

[API-NEXT,v1,3/3] validation: packet: add packet subtype tests

Message ID 1533816007-30726-4-git-send-email-odpbot@yandex.ru
State New
Headers show
Series [API-NEXT,v1,1/3] api: packet: add subtype call | expand

Commit Message

Github ODP bot Aug. 9, 2018, noon UTC
From: Petri Savolainen <petri.savolainen@linaro.org>


Check that packet subtype is correct.

Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>

---
/** Email created from pull request 669 (psavol:next-packet-subtype)
 ** https://github.com/Linaro/odp/pull/669
 ** Patch: https://github.com/Linaro/odp/pull/669.patch
 ** Base sha: 9b2b5a9695ad66977c964c83691cd2fef4c45b85
 ** Merge commit sha: 3a6201b601ab55e07cbfd561fa9904ba48035478
 **/
 .../validation/api/crypto/odp_crypto_test_inp.c |  2 ++
 test/validation/api/ipsec/ipsec.c               | 17 +++++++++++++++--
 test/validation/api/packet/packet.c             |  3 +++
 3 files changed, 20 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/test/validation/api/crypto/odp_crypto_test_inp.c b/test/validation/api/crypto/odp_crypto_test_inp.c
index 07f1d1fac..5b395c2a6 100644
--- a/test/validation/api/crypto/odp_crypto_test_inp.c
+++ b/test/validation/api/crypto/odp_crypto_test_inp.c
@@ -225,6 +225,7 @@  static int alg_packet_op(odp_packet_t pkt,
 	CU_ASSERT(ODP_EVENT_PACKET ==
 		  odp_event_types(odp_packet_to_event(pkt), &subtype));
 	CU_ASSERT(ODP_EVENT_PACKET_CRYPTO == subtype);
+	CU_ASSERT(odp_packet_subtype(pkt) == ODP_EVENT_PACKET_CRYPTO);
 
 	rc = odp_crypto_result(&result, pkt);
 	if (rc < 0) {
@@ -298,6 +299,7 @@  static int alg_packet_op_enq(odp_packet_t pkt,
 	CU_ASSERT(ODP_EVENT_PACKET ==
 		  odp_event_types(odp_packet_to_event(pkt), &subtype));
 	CU_ASSERT(ODP_EVENT_PACKET_CRYPTO == subtype);
+	CU_ASSERT(odp_packet_subtype(pkt) == ODP_EVENT_PACKET_CRYPTO);
 
 	rc = odp_crypto_result(&result, pkt);
 	if (rc < 0) {
diff --git a/test/validation/api/ipsec/ipsec.c b/test/validation/api/ipsec/ipsec.c
index 31a6f9b53..be47d109b 100644
--- a/test/validation/api/ipsec/ipsec.c
+++ b/test/validation/api/ipsec/ipsec.c
@@ -502,6 +502,7 @@  static int ipsec_send_in_one(const ipsec_test_part *part,
 							    pkto, &num_out,
 							    &param));
 		CU_ASSERT_EQUAL(num_out, part->out_pkt);
+		CU_ASSERT(odp_packet_subtype(*pkto) == ODP_EVENT_PACKET_IPSEC);
 	} else if (ODP_IPSEC_OP_MODE_ASYNC == suite_context.inbound_op_mode) {
 		CU_ASSERT_EQUAL(1, odp_ipsec_in_enq(&pkt, 1, &param));
 
@@ -517,6 +518,8 @@  static int ipsec_send_in_one(const ipsec_test_part *part,
 					odp_event_types(event, &subtype));
 			CU_ASSERT_EQUAL(ODP_EVENT_PACKET_IPSEC, subtype);
 			pkto[i] = odp_ipsec_packet_from_event(event);
+			CU_ASSERT(odp_packet_subtype(pkto[i]) ==
+				  ODP_EVENT_PACKET_IPSEC);
 		}
 	} else {
 		odp_queue_t queue;
@@ -555,7 +558,10 @@  static int ipsec_send_in_one(const ipsec_test_part *part,
 						subtype);
 				CU_ASSERT(!part->out[i].status.error.sa_lookup);
 
-				pkto[i++] = odp_ipsec_packet_from_event(ev);
+				pkto[i] = odp_ipsec_packet_from_event(ev);
+				CU_ASSERT(odp_packet_subtype(pkto[i]) ==
+					  ODP_EVENT_PACKET_IPSEC);
+				i++;
 				continue;
 			}
 		}
@@ -586,6 +592,8 @@  static int ipsec_send_out_one(const ipsec_test_part *part,
 							     pkto, &num_out,
 							     &param));
 		CU_ASSERT_EQUAL(num_out, part->out_pkt);
+		CU_ASSERT(odp_packet_subtype(*pkto) ==
+			  ODP_EVENT_PACKET_IPSEC);
 	} else if (ODP_IPSEC_OP_MODE_ASYNC == suite_context.outbound_op_mode) {
 		CU_ASSERT_EQUAL(1, odp_ipsec_out_enq(&pkt, 1, &param));
 
@@ -601,6 +609,8 @@  static int ipsec_send_out_one(const ipsec_test_part *part,
 					odp_event_types(event, &subtype));
 			CU_ASSERT_EQUAL(ODP_EVENT_PACKET_IPSEC, subtype);
 			pkto[i] = odp_ipsec_packet_from_event(event);
+			CU_ASSERT(odp_packet_subtype(pkto[i]) ==
+				  ODP_EVENT_PACKET_IPSEC);
 		}
 	} else {
 		struct odp_ipsec_out_inline_param_t inline_param;
@@ -657,7 +667,10 @@  static int ipsec_send_out_one(const ipsec_test_part *part,
 						subtype);
 				CU_ASSERT(part->out[i].status.error.all);
 
-				pkto[i++] = odp_ipsec_packet_from_event(ev);
+				pkto[i] = odp_ipsec_packet_from_event(ev);
+				CU_ASSERT(odp_packet_subtype(pkto[i]) ==
+					  ODP_EVENT_PACKET_IPSEC);
+				i++;
 				continue;
 			}
 		}
diff --git a/test/validation/api/packet/packet.c b/test/validation/api/packet/packet.c
index a564c0028..fa7ce8b82 100644
--- a/test/validation/api/packet/packet.c
+++ b/test/validation/api/packet/packet.c
@@ -319,6 +319,7 @@  static void packet_test_alloc_free(void)
 	CU_ASSERT(odp_event_types(odp_packet_to_event(packet), &subtype) ==
 		  ODP_EVENT_PACKET);
 	CU_ASSERT(subtype == ODP_EVENT_PACKET_BASIC);
+	CU_ASSERT(odp_packet_subtype(packet) == ODP_EVENT_PACKET_BASIC);
 	CU_ASSERT(odp_packet_to_u64(packet) !=
 		  odp_packet_to_u64(ODP_PACKET_INVALID));
 
@@ -402,6 +403,8 @@  static void packet_test_alloc_free_multi(void)
 					  &subtype) ==
 			  ODP_EVENT_PACKET);
 		CU_ASSERT(subtype == ODP_EVENT_PACKET_BASIC);
+		CU_ASSERT(odp_packet_subtype(packet[i]) ==
+			  ODP_EVENT_PACKET_BASIC);
 		CU_ASSERT(odp_packet_to_u64(packet[i]) !=
 			  odp_packet_to_u64(ODP_PACKET_INVALID));