diff mbox series

[2/5] validation: packet: print reason for suite init failure

Message ID 1486556381-22233-3-git-send-email-petri.savolainen@linaro.org
State Accepted
Commit 2afd00967b751ef3a9fe45d2f966f35956c93520
Headers show
Series Packet test fixes | expand

Commit Message

Petri Savolainen Feb. 8, 2017, 12:19 p.m. UTC
Knowing the reason for suite init function failure helps in
debugging.

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

---
 test/common_plat/validation/api/packet/packet.c | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

-- 
2.8.1
diff mbox series

Patch

diff --git a/test/common_plat/validation/api/packet/packet.c b/test/common_plat/validation/api/packet/packet.c
index fa5206f..e3d28f6 100644
--- a/test/common_plat/validation/api/packet/packet.c
+++ b/test/common_plat/validation/api/packet/packet.c
@@ -110,8 +110,10 @@  int packet_suite_init(void)
 	uint8_t data = 0;
 	uint32_t i;
 
-	if (odp_pool_capability(&capa) < 0)
+	if (odp_pool_capability(&capa) < 0) {
+		printf("pool_capability failed\n");
 		return -1;
+	}
 
 	/* Pick a typical packet size and decrement it to the single segment
 	 * limit if needed (min_seg_len maybe equal to max_len
@@ -136,14 +138,17 @@  int packet_suite_init(void)
 	params.pkt.uarea_size = sizeof(struct udata_struct);
 
 	packet_pool = odp_pool_create("packet_pool", &params);
-	if (packet_pool == ODP_POOL_INVALID)
+	if (packet_pool == ODP_POOL_INVALID) {
+		printf("pool_create failed: 1\n");
 		return -1;
+	}
 
 	params.pkt.uarea_size = 0;
 	packet_pool_no_uarea = odp_pool_create("packet_pool_no_uarea",
 					       &params);
 	if (packet_pool_no_uarea == ODP_POOL_INVALID) {
 		odp_pool_destroy(packet_pool);
+		printf("pool_create failed: 2\n");
 		return -1;
 	}
 
@@ -154,6 +159,7 @@  int packet_suite_init(void)
 	if (packet_pool_double_uarea == ODP_POOL_INVALID) {
 		odp_pool_destroy(packet_pool_no_uarea);
 		odp_pool_destroy(packet_pool);
+		printf("pool_create failed: 3\n");
 		return -1;
 	}
 
@@ -174,8 +180,10 @@  int packet_suite_init(void)
 	} while (segmented_test_packet == ODP_PACKET_INVALID);
 
 	if (odp_packet_is_valid(test_packet) == 0 ||
-	    odp_packet_is_valid(segmented_test_packet) == 0)
+	    odp_packet_is_valid(segmented_test_packet) == 0) {
+		printf("packet_is_valid failed\n");
 		return -1;
+	}
 
 	segmentation_supported = odp_packet_is_segmented(segmented_test_packet);
 
@@ -187,16 +195,21 @@  int packet_suite_init(void)
 
 	udat = odp_packet_user_area(test_packet);
 	udat_size = odp_packet_user_area_size(test_packet);
-	if (!udat || udat_size != sizeof(struct udata_struct))
+	if (!udat || udat_size != sizeof(struct udata_struct)) {
+		printf("packet_user_area failed: 1\n");
 		return -1;
+	}
 
 	odp_pool_print(packet_pool);
 	memcpy(udat, &test_packet_udata, sizeof(struct udata_struct));
 
 	udat = odp_packet_user_area(segmented_test_packet);
 	udat_size = odp_packet_user_area_size(segmented_test_packet);
-	if (udat == NULL || udat_size != sizeof(struct udata_struct))
+	if (udat == NULL || udat_size != sizeof(struct udata_struct)) {
+		printf("packet_user_area failed: 2\n");
 		return -1;
+	}
+
 	memcpy(udat, &test_packet_udata, sizeof(struct udata_struct));
 
 	return 0;