summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSimon Glass <[email protected]>2025-10-15 16:44:08 +0100
committerTom Rini <[email protected]>2025-10-22 14:16:56 -0600
commitbef963cb751049cacc86f2754452efadd03ae2f0 (patch)
tree8d3ab1a17fb3204b9d978bfc91caac75d6690a31 /test
parent0fe6de0dc5b137a2def3a8cc0baa2fb73a3f8541 (diff)
boot: Keep track of which bootmeths have been used
Add a bitfield which tracks when bootmeths have been used. This will be needed when global bootmeths can be used later in the iteration. Fix a missing bootflow_free() while here. Signed-off-by: Simon Glass <[email protected]>
Diffstat (limited to 'test')
-rw-r--r--test/boot/bootflow.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/test/boot/bootflow.c b/test/boot/bootflow.c
index 83fb646babf..8317dee1e20 100644
--- a/test/boot/bootflow.c
+++ b/test/boot/bootflow.c
@@ -310,6 +310,7 @@ static int bootflow_iter(struct unit_test_state *uts)
ut_assert(!iter.doing_global);
ut_assert(!iter.have_global);
ut_asserteq(-1, iter.first_glob_method);
+ ut_asserteq(BIT(0), iter.methods_done);
/*
* This shows MEDIA even though there is none, since in
@@ -318,6 +319,7 @@ static int bootflow_iter(struct unit_test_state *uts)
* know.
*/
ut_asserteq(BOOTFLOWST_MEDIA, bflow.state);
+ bootflow_free(&bflow);
ut_asserteq(-EPROTONOSUPPORT, bootflow_scan_next(&iter, &bflow));
ut_asserteq(2, iter.num_methods);
@@ -327,6 +329,7 @@ static int bootflow_iter(struct unit_test_state *uts)
ut_asserteq_str("efi", iter.method->name);
ut_asserteq(0, bflow.err);
ut_asserteq(BOOTFLOWST_MEDIA, bflow.state);
+ ut_asserteq(BIT(0) | BIT(1), iter.methods_done);
bootflow_free(&bflow);
/* The next device is mmc1.bootdev - at first we use the whole device */
@@ -338,6 +341,7 @@ static int bootflow_iter(struct unit_test_state *uts)
ut_asserteq_str("extlinux", iter.method->name);
ut_asserteq(0, bflow.err);
ut_asserteq(BOOTFLOWST_MEDIA, bflow.state);
+ ut_asserteq(BIT(0) | BIT(1), iter.methods_done);
bootflow_free(&bflow);
ut_asserteq(-ENOENT, bootflow_scan_next(&iter, &bflow));
@@ -348,9 +352,10 @@ static int bootflow_iter(struct unit_test_state *uts)
ut_asserteq_str("efi", iter.method->name);
ut_asserteq(0, bflow.err);
ut_asserteq(BOOTFLOWST_MEDIA, bflow.state);
+ ut_asserteq(BIT(0) | BIT(1), iter.methods_done);
bootflow_free(&bflow);
- /* Then more to partition 1 where we find something */
+ /* Then move to partition 1 where we find something */
ut_assertok(bootflow_scan_next(&iter, &bflow));
ut_asserteq(2, iter.num_methods);
ut_asserteq(0, iter.cur_method);
@@ -380,6 +385,7 @@ static int bootflow_iter(struct unit_test_state *uts)
ut_asserteq_str("extlinux", iter.method->name);
ut_asserteq(0, bflow.err);
ut_asserteq(BOOTFLOWST_MEDIA, bflow.state);
+ ut_asserteq(BIT(0) | BIT(1), iter.methods_done);
bootflow_free(&bflow);
bootflow_iter_uninit(&iter);