diff mbox

validation: pktio: add more debug log to pktio_pkt_seq()

Message ID 1456949223-32489-1-git-send-email-zoltan.kiss@linaro.org
State Superseded
Headers show

Commit Message

Zoltan Kiss March 2, 2016, 8:07 p.m. UTC
Signed-off-by: Zoltan Kiss <zoltan.kiss@linaro.org>
---
 test/validation/pktio/pktio.c | 26 +++++++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)
diff mbox

Patch

diff --git a/test/validation/pktio/pktio.c b/test/validation/pktio/pktio.c
index a5f25da..084e5cd 100644
--- a/test/validation/pktio/pktio.c
+++ b/test/validation/pktio/pktio.c
@@ -172,29 +172,45 @@  static uint32_t pktio_pkt_seq(odp_packet_t pkt)
 	pkt_head_t head;
 	pkt_tail_t tail;
 
-	if (pkt == ODP_PACKET_INVALID)
+	if (pkt == ODP_PACKET_INVALID) {
+		fprintf(stderr, "error: pkt invalid\n");
 		return TEST_SEQ_INVALID;
+	}
 
 	off = odp_packet_l4_offset(pkt);
-	if (off ==  ODP_PACKET_OFFSET_INVALID)
+	if (off ==  ODP_PACKET_OFFSET_INVALID) {
+		fprintf(stderr, "error: offset invalid\n");
 		return TEST_SEQ_INVALID;
+	}
 
 	off += ODPH_UDPHDR_LEN;
-	if (odp_packet_copydata_out(pkt, off, sizeof(head), &head) != 0)
+	if (odp_packet_copydata_out(pkt, off, sizeof(head), &head) != 0) {
+		fprintf(stderr, "error: header copy failed\n");
 		return TEST_SEQ_INVALID;
+	}
 
-	if (head.magic != TEST_SEQ_MAGIC)
+	if (head.magic != TEST_SEQ_MAGIC) {
+		fprintf(stderr, "error: header magic invalid %u\n", head.magic);
 		return TEST_SEQ_INVALID;
+	}
 
 	if (odp_packet_len(pkt) == packet_len) {
 		off = packet_len - sizeof(tail);
-		if (odp_packet_copydata_out(pkt, off, sizeof(tail), &tail) != 0)
+		if (odp_packet_copydata_out(pkt, off, sizeof(tail), &tail) != 0) {
+			fprintf(stderr, "error: header copy failed\n");
 			return TEST_SEQ_INVALID;
+		}
 
 		if (tail.magic == TEST_SEQ_MAGIC) {
 			seq = head.seq;
 			CU_ASSERT(seq != TEST_SEQ_INVALID);
+		} else {
+			fprintf(stderr, "error: tail magic invalid %u\n",
+				tail.magic);
 		}
+	} else {
+		fprintf(stderr, "error: packet length invalid: %u (%u)\n",
+			odp_packet_len(pkt), packet_len);
 	}
 
 	return seq;