diff mbox

[API-NEXT,PATCHv5,06/10] validation: packet: add test for correct odp_packet_buffer_len()

Message ID 1460679929-30653-7-git-send-email-bill.fischofer@linaro.org
State New
Headers show

Commit Message

Bill Fischofer April 15, 2016, 12:25 a.m. UTC
Extend the packet_test_length() test to properly test odp_packet_buf_len()

Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
Reviewed-by: Bala Manoharan <bala.manoharan@linaro.org>
---
 test/validation/packet/packet.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
diff mbox

Patch

diff --git a/test/validation/packet/packet.c b/test/validation/packet/packet.c
index d59e96c..dc40cfb 100644
--- a/test/validation/packet/packet.c
+++ b/test/validation/packet/packet.c
@@ -277,6 +277,20 @@  void packet_test_length(void)
 	CU_ASSERT(tailroom >= ODP_CONFIG_PACKET_TAILROOM);
 #endif
 	CU_ASSERT(buf_len >= packet_len + headroom + tailroom);
+
+	pkt = segmented_test_packet;
+	buf_len = odp_packet_buf_len(pkt);
+	headroom = odp_packet_headroom(pkt);
+	tailroom = odp_packet_tailroom(pkt);
+
+	CU_ASSERT(odp_packet_len(pkt) == segmented_packet_len);
+#if ODP_CONFIG_PACKET_HEADROOM != 0 /* Avoid 'always true' warning */
+	CU_ASSERT(headroom >= ODP_CONFIG_PACKET_HEADROOM);
+#endif
+#if ODP_CONFIG_PACKET_TAILROOM != 0 /* Avoid 'always true' warning */
+	CU_ASSERT(tailroom >= ODP_CONFIG_PACKET_TAILROOM);
+#endif
+	CU_ASSERT(buf_len >= packet_len + headroom + tailroom);
 }
 
 void packet_test_debug(void)