summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2023-01-17 20:47:40 +0300
committerTom Rini <trini@konsulko.com>2023-01-24 02:11:40 +0300
commit4146c823fc27c1a4e06d1d25e0a2d4644948a5fc (patch)
tree0d9ca4207ef94dacac79d0ec8f8d38d30637ec92 /test
parentc8c3fd24cc0dd9512237dc13528e90eb46e704a7 (diff)
downloadu-boot-4146c823fc27c1a4e06d1d25e0a2d4644948a5fc.tar.xz
bootstd: Add a hunter for ethernet
Sometimes ethernet devices are attached to PCI. Since it is quick to scan, add this into the ethernet hunter. Run dhcp to establish the network connection. Drop this from the bootdev since that is not needed now. Update a log message for clarity. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test')
-rw-r--r--test/boot/bootdev.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/test/boot/bootdev.c b/test/boot/bootdev.c
index 78cb0ac628..32a31c4460 100644
--- a/test/boot/bootdev.c
+++ b/test/boot/bootdev.c
@@ -238,9 +238,10 @@ static int bootdev_test_hunter(struct unit_test_state *uts)
bootdev_list_hunters(std);
ut_assert_nextline("Prio Used Uclass Hunter");
ut_assert_nextlinen("----");
+ ut_assert_nextline(" 50 ethernet eth_bootdev");
ut_assert_nextline(" 10 mmc mmc_bootdev");
ut_assert_nextline(" 40 usb usb_bootdev");
- ut_assert_nextline("(total hunters: 2)");
+ ut_assert_nextline("(total hunters: 3)");
ut_assert_console_end();
ut_assertok(bootdev_hunt("usb1", false));
@@ -248,8 +249,8 @@ static int bootdev_test_hunter(struct unit_test_state *uts)
"Bus usb@1: scanning bus usb@1 for devices... 5 USB Device(s) found");
ut_assert_console_end();
- /* USB is second in the list, so bit 1 */
- ut_asserteq(BIT(1), std->hunters_used);
+ /* USB is third in the list, so bit 2 */
+ ut_asserteq(BIT(2), std->hunters_used);
return 0;
}
@@ -269,11 +270,14 @@ static int bootdev_test_cmd_hunt(struct unit_test_state *uts)
ut_assertok(run_command("bootdev hunt -l", 0));
ut_assert_nextline("Prio Used Uclass Hunter");
ut_assert_nextlinen("----");
- ut_assert_skip_to_line("(total hunters: 2)");
+ ut_assert_skip_to_line("(total hunters: 3)");
ut_assert_console_end();
/* Scan all hunters */
+ sandbox_set_eth_enable(false);
+
ut_assertok(run_command("bootdev hunt", 0));
+ ut_assert_nextline("Hunting with: ethernet");
ut_assert_nextline("Hunting with: mmc");
ut_assert_nextline("Hunting with: usb");
ut_assert_nextline(
@@ -284,13 +288,14 @@ static int bootdev_test_cmd_hunt(struct unit_test_state *uts)
ut_assertok(run_command("bootdev hunt -l", 0));
ut_assert_nextlinen("Prio");
ut_assert_nextlinen("----");
+ ut_assert_nextline(" 50 * ethernet eth_bootdev");
ut_assert_nextline(" 10 * mmc mmc_bootdev");
ut_assert_nextline(" 40 * usb usb_bootdev");
- ut_assert_nextline("(total hunters: 2)");
+ ut_assert_nextline("(total hunters: 3)");
ut_assert_console_end();
- ut_asserteq(GENMASK(1, 0), std->hunters_used);
+ ut_asserteq(GENMASK(2, 0), std->hunters_used);
return 0;
}