1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-17 08:32:07 +02:00

bootstd: Report missing labels only when asked

Use the -l flag to indicate whether to report missing uclasses.

Also try to be more helpful when no devices are found. For example, when
we see something 'scsi0' requested and nothing was found, this indicates
that there are no SCSI devices, so show a suitable message.

Move messages out of the low-level functions so that silent operation
is possible.

This means they are never reported unless BOOTSTD_FULL is enabled, since
the -l flag cannot otherwise be set.

Suggested-by: Tom Rini <trini@konsulko.com>

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2023-04-24 13:49:47 +12:00
committed by Tom Rini
parent d80bb4f958
commit 1736b4af0e
3 changed files with 31 additions and 15 deletions

View File

@@ -124,7 +124,8 @@ static int bootdev_test_labels(struct unit_test_state *uts)
mflags);
/* Check invalid uclass */
ut_asserteq(-EINVAL, bootdev_find_by_label("fred0", &dev, &mflags));
ut_asserteq(-EPFNOSUPPORT,
bootdev_find_by_label("fred0", &dev, &mflags));
/* Check unknown sequence number */
ut_asserteq(-ENOENT, bootdev_find_by_label("mmc6", &dev, &mflags));
@@ -179,9 +180,8 @@ static int bootdev_test_any(struct unit_test_state *uts)
/* Check invalid uclass */
mflags = 123;
ut_asserteq(-EINVAL, bootdev_find_by_any("fred0", &dev, &mflags));
ut_assert_nextline("Unknown uclass 'fred0' in label");
ut_assert_nextline("Cannot find bootdev 'fred0' (err=-22)");
ut_asserteq(-EPFNOSUPPORT, bootdev_find_by_any("fred0", &dev, &mflags));
ut_assert_nextline("Cannot find bootdev 'fred0' (err=-96)");
ut_asserteq(123, mflags);
ut_assert_console_end();
@@ -512,9 +512,8 @@ static int bootdev_test_hunt_label(struct unit_test_state *uts)
old = (void *)&mflags; /* arbitrary pointer to check against dev */
dev = old;
mflags = 123;
ut_asserteq(-EINVAL,
ut_asserteq(-EPFNOSUPPORT,
bootdev_hunt_and_find_by_label("fred", &dev, &mflags));
ut_assert_nextline("Unknown uclass 'fred' in label");
ut_asserteq_ptr(old, dev);
ut_asserteq(123, mflags);
ut_assert_console_end();
@@ -525,7 +524,6 @@ static int bootdev_test_hunt_label(struct unit_test_state *uts)
bootdev_hunt_and_find_by_label("mmc4", &dev, &mflags));
ut_asserteq_ptr(old, dev);
ut_asserteq(123, mflags);
ut_assert_nextline("Unknown seq 4 for label 'mmc4'");
ut_assert_console_end();
ut_assertok(bootstd_test_check_mmc_hunter(uts));