diff mbox series

[v5,2/12] validation: pktio: fix checks in pktio tests

Message ID 1534845606-17334-3-git-send-email-odpbot@yandex.ru
State Superseded
Headers show
Series [v5,1/12] validation: pktio: check sctp flag in parser tests | expand

Commit Message

Github ODP bot Aug. 21, 2018, 9:59 a.m. UTC
From: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>


- cleanly close PktI/O if packet creation has failed
- verify UDP checksum in UDP checksum override test

Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>

---
/** Email created from pull request 674 (lumag:sctp-checksum)
 ** https://github.com/Linaro/odp/pull/674
 ** Patch: https://github.com/Linaro/odp/pull/674.patch
 ** Base sha: 912e026c108d7a496ac7467e953dea77dadaaa57
 ** Merge commit sha: 9ab290c4f721a97e8c289b8a7992e6cc6614e7c3
 **/
 test/validation/api/pktio/pktio.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/test/validation/api/pktio/pktio.c b/test/validation/api/pktio/pktio.c
index 09367d4ea..625cc325e 100644
--- a/test/validation/api/pktio/pktio.c
+++ b/test/validation/api/pktio/pktio.c
@@ -1958,7 +1958,14 @@  static void pktio_test_chksum(void (*config_fn)(odp_pktio_t, odp_pktio_t),
 
 	ret = create_packets_cs(pkt_tbl, pkt_seq, TX_BATCH_LEN, pktio_tx,
 				pktio_rx, false);
-	CU_ASSERT_FATAL(ret == TX_BATCH_LEN);
+	CU_ASSERT(ret == TX_BATCH_LEN);
+	if (ret != TX_BATCH_LEN) {
+		for (i = 0; i < num_ifaces; i++) {
+			CU_ASSERT_FATAL(odp_pktio_stop(pktio[i]) == 0);
+			CU_ASSERT_FATAL(odp_pktio_close(pktio[i]) == 0);
+		}
+		return;
+	}
 
 	ret = odp_pktout_queue(pktio_tx, &pktout_queue, 1);
 	CU_ASSERT_FATAL(ret > 0);
@@ -2296,8 +2303,10 @@  static void pktio_test_chksum_out_udp_ovr_test(odp_packet_t pkt)
 	odph_udphdr_t *udp = odp_packet_l4_ptr(pkt, NULL);
 
 	CU_ASSERT(udp != NULL);
-	if (udp != NULL)
+	if (udp != NULL) {
 		CU_ASSERT(udp->chksum != 0);
+		CU_ASSERT(!odph_udp_chksum_verify(pkt));
+	}
 }
 
 static void pktio_test_chksum_out_udp_ovr(void)