boot: Don't change the method count after global bootmeths

At present before scanning global bootmeths, the iterator sets the
method count to the index of the first global bootmeth. Now that we
support scanning the global bootmeths multiple times, we must leave this
count alone.

Check against have_global and first_glob_method instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2025-09-29 14:54:26 -06:00
parent db66d8d149
commit 1200d2b52f
2 changed files with 17 additions and 7 deletions

View File

@@ -467,7 +467,7 @@ static int bootflow_iter_glob(struct unit_test_state *uts)
ut_asserteq(-EPROTONOSUPPORT, bootflow_scan_next(&iter, &bflow));
/* at this point the global bootmeths are stranded above num_methods */
ut_asserteq(3, iter.num_methods);
ut_asserteq(4, iter.num_methods);
ut_asserteq(3, iter.first_glob_method);
ut_assert(!iter.doing_global);
ut_assert(iter.have_global);
@@ -534,7 +534,7 @@ static int bootflow_iter_disable(struct unit_test_state *uts)
ut_assertok(bootflow_scan_first(NULL, NULL, &iter, 0, &bflow));
/* at this point the global bootmeths are stranded above num_methods */
ut_asserteq(4, iter.num_methods);
ut_asserteq(5, iter.num_methods);
ut_assert(!iter.doing_global);
ut_assert(iter.have_global);
ut_asserteq(4, iter.first_glob_method);
@@ -546,7 +546,7 @@ static int bootflow_iter_disable(struct unit_test_state *uts)
ut_assert_console_end();
/* Check that the sandbox bootmeth has been removed */
ut_asserteq(3, iter.num_methods);
ut_asserteq(4, iter.num_methods);
for (i = 0; i < iter.num_methods; i++)
ut_assert(strcmp("sandbox", iter.method_order[i]->name));