diff mbox series

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

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

Commit Message

Github ODP bot Aug. 21, 2018, 4:59 p.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: f6c423a7d29e2c7d6d890cbc098a398d0d7e1288
 ** Merge commit sha: d4f772b36da26684194cb0452a01b8da1ba7e3e1
 **/
 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)