[API-NEXT,v1,4/4] validation: packet: test packet_data_seg_len

Message ID 1519308009-12837-5-git-send-email-odpbot@yandex.ru
State New
Headers show
Series
  • api: packet: data and segment length
Related show

Commit Message

Github ODP bot Feb. 22, 2018, 2 p.m.
From: Petri Savolainen <petri.savolainen@linaro.org>


Test the new combined packet data and seg_len function.

Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>

---
/** Email created from pull request 497 (psavol:next-packet-data-doc)
 ** https://github.com/Linaro/odp/pull/497
 ** Patch: https://github.com/Linaro/odp/pull/497.patch
 ** Base sha: ea2afab619ae74108a03798bc358fdfcd29fdd88
 ** Merge commit sha: d1c9a3d36dfe9e38ecfe7d4a52bebe13d0c01098
 **/
 test/validation/api/packet/packet.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Patch

diff --git a/test/validation/api/packet/packet.c b/test/validation/api/packet/packet.c
index f829d0cb1..78a14800c 100644
--- a/test/validation/api/packet/packet.c
+++ b/test/validation/api/packet/packet.c
@@ -604,7 +604,8 @@  void packet_test_basic_metadata(void)
 void packet_test_length(void)
 {
 	odp_packet_t pkt = test_packet;
-	uint32_t buf_len, headroom, tailroom;
+	uint32_t buf_len, headroom, tailroom, seg_len;
+	void *data;
 	odp_pool_capability_t capa;
 
 	CU_ASSERT_FATAL(odp_pool_capability(&capa) == 0);
@@ -612,8 +613,13 @@  void packet_test_length(void)
 	buf_len = odp_packet_buf_len(pkt);
 	headroom = odp_packet_headroom(pkt);
 	tailroom = odp_packet_tailroom(pkt);
+	data     = odp_packet_data(pkt);
 
+	CU_ASSERT(data != NULL);
 	CU_ASSERT(odp_packet_len(pkt) == packet_len);
+	CU_ASSERT(odp_packet_seg_len(pkt) <= packet_len);
+	CU_ASSERT(odp_packet_data_seg_len(pkt, &seg_len) == data);
+	CU_ASSERT(seg_len == odp_packet_seg_len(pkt));
 	CU_ASSERT(headroom >= capa.pkt.min_headroom);
 	CU_ASSERT(tailroom >= capa.pkt.min_tailroom);