diff mbox series

[v5,4/12] validation: pktio: parser: add SCTP test

Message ID 1534845606-17334-5-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>


Add SCTP packet parsing test, checking that protocol is properly
recognized.

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/parser.c | 38 ++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)
diff mbox series

Patch

diff --git a/test/validation/api/pktio/parser.c b/test/validation/api/pktio/parser.c
index f22a62555..db37c1c5b 100644
--- a/test/validation/api/pktio/parser.c
+++ b/test/validation/api/pktio/parser.c
@@ -381,6 +381,24 @@  static void parser_test_vlan_qinq_ipv4_udp(void)
 	odp_packet_free(pkt);
 }
 
+static void parser_test_ipv4_sctp(void)
+{
+	odp_packet_t pkt;
+
+	pkt = loopback_packet(pktio_a, pktio_b, test_packet_ipv4_sctp,
+			      sizeof(test_packet_ipv4_sctp));
+	CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
+	CU_ASSERT(odp_packet_has_eth(pkt));
+	CU_ASSERT(odp_packet_has_ipv4(pkt));
+	CU_ASSERT(odp_packet_has_sctp(pkt));
+
+	CU_ASSERT(!odp_packet_has_ipv6(pkt));
+	CU_ASSERT(!odp_packet_has_tcp(pkt));
+	CU_ASSERT(!odp_packet_has_udp(pkt));
+
+	odp_packet_free(pkt);
+}
+
 static void parser_test_ipv6_icmp(void)
 {
 	odp_packet_t pkt;
@@ -455,6 +473,24 @@  static void parser_test_vlan_ipv6_udp(void)
 	odp_packet_free(pkt);
 }
 
+static void parser_test_ipv6_sctp(void)
+{
+	odp_packet_t pkt;
+
+	pkt = loopback_packet(pktio_a, pktio_b, test_packet_ipv6_sctp,
+			      sizeof(test_packet_ipv6_sctp));
+	CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
+	CU_ASSERT(odp_packet_has_eth(pkt));
+	CU_ASSERT(odp_packet_has_ipv6(pkt));
+	CU_ASSERT(odp_packet_has_sctp(pkt));
+
+	CU_ASSERT(!odp_packet_has_ipv4(pkt));
+	CU_ASSERT(!odp_packet_has_tcp(pkt));
+	CU_ASSERT(!odp_packet_has_udp(pkt));
+
+	odp_packet_free(pkt);
+}
+
 int parser_suite_init(void)
 {
 	int i;
@@ -564,9 +600,11 @@  odp_testinfo_t parser_suite[] = {
 	ODP_TEST_INFO(parser_test_ipv4_udp),
 	ODP_TEST_INFO_CONDITIONAL(parser_test_vlan_ipv4_udp, loop_pktio),
 	ODP_TEST_INFO_CONDITIONAL(parser_test_vlan_qinq_ipv4_udp, loop_pktio),
+	ODP_TEST_INFO(parser_test_ipv4_sctp),
 	ODP_TEST_INFO(parser_test_ipv6_icmp),
 	ODP_TEST_INFO(parser_test_ipv6_tcp),
 	ODP_TEST_INFO(parser_test_ipv6_udp),
 	ODP_TEST_INFO_CONDITIONAL(parser_test_vlan_ipv6_udp, loop_pktio),
+	ODP_TEST_INFO(parser_test_ipv6_sctp),
 	ODP_TEST_INFO_NULL
 };