summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSimon Glass <[email protected]>2025-10-15 16:44:06 +0100
committerTom Rini <[email protected]>2025-10-22 14:16:56 -0600
commiteca985905d7956ca69e1abfe9ef1d3eb5c64c0a9 (patch)
tree541d96a1a0d7059071667673d5148b068296a201 /test
parenta2301201e36d665c08b51617e1c66133b32d9808 (diff)
boot: Update first_glob_method when dropping a bootmeth
For now we only support dropping non-global bootmeths from the iteration. Update first_glob_method in that case and add a few checks that things are correct. Signed-off-by: Simon Glass <[email protected]>
Diffstat (limited to 'test')
-rw-r--r--test/boot/bootflow.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/boot/bootflow.c b/test/boot/bootflow.c
index f3386a1eb31..07bf239485c 100644
--- a/test/boot/bootflow.c
+++ b/test/boot/bootflow.c
@@ -482,7 +482,11 @@ static int bootflow_iter_disable(struct unit_test_state *uts)
/* Try to boot the bootmgr flow, which will fail */
console_record_reset_enable();
ut_assertok(bootflow_scan_first(NULL, NULL, &iter, 0, &bflow));
+
+ /* at this point the global bootmeths are stranded above num_methods */
ut_asserteq(3, iter.num_methods);
+ ut_assert(!iter.doing_global);
+ ut_asserteq(3, iter.first_glob_method);
ut_asserteq_str("sandbox", iter.method->name);
ut_assertok(inject_response(uts));
ut_asserteq(-ENOTSUPP, bootflow_run_boot(&iter, &bflow));
@@ -492,9 +496,13 @@ static int bootflow_iter_disable(struct unit_test_state *uts)
/* Check that the sandbox bootmeth has been removed */
ut_asserteq(2, iter.num_methods);
+
for (i = 0; i < iter.num_methods; i++)
ut_assert(strcmp("sandbox", iter.method_order[i]->name));
+ /* the first global bootmeth is now down one place in the list */
+ ut_asserteq(2, iter.first_glob_method);
+
return 0;
}
BOOTSTD_TEST(bootflow_iter_disable, UTF_DM | UTF_SCAN_FDT | UTF_CONSOLE);