aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2023-01-17 10:47:13 -0700
committerTom Rini <trini@konsulko.com>2023-01-23 18:11:39 -0500
commita0fb9de60d2fe64107ebadc85e73000e84a963ea (patch)
tree79d7aa74c8be1afedd43533f8ff1017312ab7a0b
parent3d01254140fc9e5e900d739cb97bd9fba6aa2b68 (diff)
downloadu-boot-a0fb9de60d2fe64107ebadc85e73000e84a963ea.zip
u-boot-a0fb9de60d2fe64107ebadc85e73000e84a963ea.tar.gz
u-boot-a0fb9de60d2fe64107ebadc85e73000e84a963ea.tar.bz2
dm: test: Correct assertion in dm_test_part()
This obscures the line number. Update the test to avoid make sure that the line which failed is displayed, so it is possible to diagnose the failure. Signed-off-by: Simon Glass <sjg@chromium.org>
-rw-r--r--test/dm/part.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/test/dm/part.c b/test/dm/part.c
index 78dd847..5e4efa5 100644
--- a/test/dm/part.c
+++ b/test/dm/part.c
@@ -11,8 +11,8 @@
#include <dm/test.h>
#include <test/ut.h>
-static inline int do_test(struct unit_test_state *uts, int expected,
- const char *part_str, bool whole)
+static int do_test(struct unit_test_state *uts, int expected,
+ const char *part_str, bool whole)
{
struct blk_desc *mmc_dev_desc;
struct disk_partition part_info;
@@ -54,11 +54,8 @@ static int dm_test_part(struct unit_test_state *uts)
oldbootdevice = env_get("bootdevice");
-#define test(expected, part_str, whole) do { \
- ret = do_test(uts, expected, part_str, whole); \
- if (ret) \
- goto out; \
-} while (0)
+#define test(expected, part_str, whole) \
+ ut_assertok(do_test(uts, expected, part_str, whole))
env_set("bootdevice", NULL);
test(-ENODEV, NULL, true);
@@ -92,7 +89,6 @@ static int dm_test_part(struct unit_test_state *uts)
test(2, "1#test2", false);
ret = 0;
-out:
env_set("bootdevice", oldbootdevice);
return ret;
}