summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2023-01-17 10:48:08 -0700
committerTom Rini <trini@konsulko.com>2023-01-23 18:11:41 -0500
commiteacc261178b9c8024cb8de89ee4ca6c68d80d96a (patch)
treee40fcef678725303048937f4b2d5a393c8613be1 /test
parent79a7d4a61ff34c7745811c7b3090a60b230c2ef9 (diff)
bootstd: Add a new pre-scan priority for bootdevs
We need extensions to be set up before we start trying to boot any of the bootdevs. Add a new priority before all the others for tht sort of thing. Also add a 'none' option, so that the first one is not 0. While we are here, comment enum bootdev_prio_t fully and expand the test for the 'bootdev hunt' command. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test')
-rw-r--r--test/boot/bootdev.c51
1 files changed, 31 insertions, 20 deletions
diff --git a/test/boot/bootdev.c b/test/boot/bootdev.c
index f9653633a6..86607f7695 100644
--- a/test/boot/bootdev.c
+++ b/test/boot/bootdev.c
@@ -247,14 +247,14 @@ 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(" 40 ide ide_bootdev");
- ut_assert_nextline(" 10 mmc mmc_bootdev");
- ut_assert_nextline(" 30 nvme nvme_bootdev");
- ut_assert_nextline(" 30 scsi scsi_bootdev");
- ut_assert_nextline(" 30 spi_flash sf_bootdev");
- ut_assert_nextline(" 40 usb usb_bootdev");
- ut_assert_nextline(" 30 virtio virtio_bootdev");
+ ut_assert_nextline(" 6 ethernet eth_bootdev");
+ ut_assert_nextline(" 5 ide ide_bootdev");
+ ut_assert_nextline(" 2 mmc mmc_bootdev");
+ ut_assert_nextline(" 4 nvme nvme_bootdev");
+ ut_assert_nextline(" 4 scsi scsi_bootdev");
+ ut_assert_nextline(" 4 spi_flash sf_bootdev");
+ ut_assert_nextline(" 5 usb usb_bootdev");
+ ut_assert_nextline(" 4 virtio virtio_bootdev");
ut_assert_nextline("(total hunters: 8)");
ut_assert_console_end();
@@ -284,17 +284,28 @@ 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_nextline(" 6 ethernet eth_bootdev");
+ ut_assert_skip_to_line("(total hunters: 8)");
+ ut_assert_console_end();
+
+ /* Use the MMC hunter and see that it updates */
+ ut_assertok(run_command("bootdev hunt mmc", 0));
+ ut_assertok(run_command("bootdev hunt -l", 0));
+ ut_assert_skip_to_line(" 5 ide ide_bootdev");
+ ut_assert_nextline(" 2 * mmc mmc_bootdev");
ut_assert_skip_to_line("(total hunters: 8)");
ut_assert_console_end();
/* Scan all hunters */
sandbox_set_eth_enable(false);
-
+ test_set_skip_delays(true);
ut_assertok(run_command("bootdev hunt", 0));
ut_assert_nextline("Hunting with: ethernet");
ut_assert_nextline("Hunting with: ide");
ut_assert_nextline("Bus 0: not available ");
- ut_assert_nextline("Hunting with: mmc");
+
+ /* mmc hunter has already been used so should not run again */
+
ut_assert_nextline("Hunting with: nvme");
ut_assert_nextline("Hunting with: scsi");
ut_assert_nextline("scanning bus for devices...");
@@ -309,14 +320,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(" 40 * ide ide_bootdev");
- ut_assert_nextline(" 10 * mmc mmc_bootdev");
- ut_assert_nextline(" 30 * nvme nvme_bootdev");
- ut_assert_nextline(" 30 * scsi scsi_bootdev");
- ut_assert_nextline(" 30 * spi_flash sf_bootdev");
- ut_assert_nextline(" 40 * usb usb_bootdev");
- ut_assert_nextline(" 30 * virtio virtio_bootdev");
+ ut_assert_nextline(" 6 * ethernet eth_bootdev");
+ ut_assert_nextline(" 5 * ide ide_bootdev");
+ ut_assert_nextline(" 2 * mmc mmc_bootdev");
+ ut_assert_nextline(" 4 * nvme nvme_bootdev");
+ ut_assert_nextline(" 4 * scsi scsi_bootdev");
+ ut_assert_nextline(" 4 * spi_flash sf_bootdev");
+ ut_assert_nextline(" 5 * usb usb_bootdev");
+ ut_assert_nextline(" 4 * virtio virtio_bootdev");
ut_assert_nextline("(total hunters: 8)");
ut_assert_console_end();
@@ -370,14 +381,14 @@ static int bootdev_test_hunt_prio(struct unit_test_state *uts)
test_set_skip_delays(true);
console_record_reset_enable();
- ut_assertok(bootdev_hunt_prio(BOOTDEVP_2_SCAN_FAST, false));
+ ut_assertok(bootdev_hunt_prio(BOOTDEVP_4_SCAN_FAST, false));
ut_assert_nextline("scanning bus for devices...");
ut_assert_skip_to_line(" Type: Hard Disk");
ut_assert_nextlinen(" Capacity:");
ut_assert_console_end();
/* now try a different priority, verbosely */
- ut_assertok(bootdev_hunt_prio(BOOTDEVP_3_SCAN_SLOW, true));
+ ut_assertok(bootdev_hunt_prio(BOOTDEVP_5_SCAN_SLOW, true));
ut_assert_nextline("Hunting with: ide");
ut_assert_nextline("Bus 0: not available ");
ut_assert_nextline("Hunting with: usb");