[PATCH v2 2/5] dm: test: Improve partition test error output

Joshua Watt jpewhacker at gmail.com
Mon Jul 3 15:39:53 CEST 2023


Improve the logging when the partition test fails so that it is clear
what went wrong, shown with actual values.

Signed-off-by: Joshua Watt <JPEWhacker at gmail.com>
---
 test/dm/part.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/test/dm/part.c b/test/dm/part.c
index d5c58d6e3f..7dd8bc7a3c 100644
--- a/test/dm/part.c
+++ b/test/dm/part.c
@@ -17,10 +17,12 @@ static int do_test(struct unit_test_state *uts, int expected,
 	struct blk_desc *mmc_dev_desc;
 	struct disk_partition part_info;
 
-	ut_asserteq(expected,
-		    part_get_info_by_dev_and_name_or_num("mmc", part_str,
-							 &mmc_dev_desc,
-							 &part_info, whole));
+	int ret = part_get_info_by_dev_and_name_or_num("mmc", part_str,
+						       &mmc_dev_desc,
+						       &part_info, whole);
+
+	ut_assertf(expected == ret, "test(%d, \"%s\", %d) == %d", expected,
+		   part_str, whole, ret);
 	return 0;
 }
 
-- 
2.33.0



More information about the U-Boot mailing list