diff mbox series

[v3,2/11] validation: pktio: fix checks in pktio tests

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

Commit Message

Github ODP bot Aug. 20, 2018, 10: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: dc28824415ea510e3ef62e47f7640bf4a8420fde
 ** Merge commit sha: b482f9618a6edb2a2f2491ee5a7af757eab93b24
 **/
 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)