diff mbox series

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

Message ID 1534870807-18456-5-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>


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: f6c423a7d29e2c7d6d890cbc098a398d0d7e1288
 ** Merge commit sha: d4f772b36da26684194cb0452a01b8da1ba7e3e1
 **/
 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
 };