1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-10-13 05:56:28 +02:00

test: boot: Use UTF_CONSOLE in tests

Set this flag rather than doing things manually in the test.

Drop unnecessary calls to console_record_reset_enable()

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
This commit is contained in:
Simon Glass
2024-08-22 07:57:54 -06:00
committed by Tom Rini
parent f034becd06
commit a6a80b3b29
5 changed files with 42 additions and 70 deletions

View File

@@ -28,7 +28,6 @@ static int bootdev_test_cmd_list(struct unit_test_state *uts)
{
int probed;
console_record_reset_enable();
for (probed = 0; probed < 2; probed++) {
int probe_ch = probed ? '+' : ' ';
@@ -49,7 +48,7 @@ static int bootdev_test_cmd_list(struct unit_test_state *uts)
return 0;
}
BOOTSTD_TEST(bootdev_test_cmd_list, UTF_DM | UTF_SCAN_FDT);
BOOTSTD_TEST(bootdev_test_cmd_list, UTF_DM | UTF_SCAN_FDT | UTF_CONSOLE);
/* Check 'bootdev select' and 'info' commands */
static int bootdev_test_cmd_select(struct unit_test_state *uts)
@@ -59,7 +58,6 @@ static int bootdev_test_cmd_select(struct unit_test_state *uts)
/* get access to the CLI's cur_bootdev */
ut_assertok(bootstd_get_priv(&std));
console_record_reset_enable();
ut_asserteq(1, run_command("bootdev info", 0));
ut_assert_nextlinen("Please use");
ut_assert_console_end();
@@ -99,7 +97,7 @@ static int bootdev_test_cmd_select(struct unit_test_state *uts)
return 0;
}
BOOTSTD_TEST(bootdev_test_cmd_select, UTF_DM | UTF_SCAN_FDT);
BOOTSTD_TEST(bootdev_test_cmd_select, UTF_DM | UTF_SCAN_FDT | UTF_CONSOLE);
/* Check bootdev labels */
static int bootdev_test_labels(struct unit_test_state *uts)
@@ -157,7 +155,6 @@ static int bootdev_test_any(struct unit_test_state *uts)
* 9 [ + ] OK mmc mmc1.bootdev
* a [ ] OK mmc mmc0.bootdev
*/
console_record_reset_enable();
ut_assertok(bootdev_find_by_any("8", &dev, &mflags));
ut_asserteq(UCLASS_BOOTDEV, device_get_uclass_id(dev));
ut_asserteq(BOOTFLOW_METHF_SINGLE_DEV, mflags);
@@ -185,7 +182,8 @@ static int bootdev_test_any(struct unit_test_state *uts)
return 0;
}
BOOTSTD_TEST(bootdev_test_any, UTF_DM | UTF_SCAN_FDT | UTF_ETH_BOOTDEV);
BOOTSTD_TEST(bootdev_test_any, UTF_DM | UTF_SCAN_FDT | UTF_ETH_BOOTDEV |
UTF_CONSOLE);
/*
* Check bootdev ordering with the bootdev-order property and boot_targets
@@ -321,7 +319,6 @@ static int bootdev_test_prio(struct unit_test_state *uts)
ut_assertok(bootstd_test_drop_bootdev_order(uts));
/* 3 MMC and 3 USB bootdevs: MMC should come before USB */
console_record_reset_enable();
ut_assertok(bootflow_scan_first(NULL, NULL, &iter, 0, &bflow));
ut_asserteq(-ENODEV, bootflow_scan_next(&iter, &bflow));
ut_asserteq(6, iter.num_devs);
@@ -361,7 +358,6 @@ static int bootdev_test_hunter(struct unit_test_state *uts)
/* get access to the used hunters */
ut_assertok(bootstd_get_priv(&std));
console_record_reset_enable();
bootdev_list_hunters(std);
ut_assert_nextline("Prio Used Uclass Hunter");
ut_assert_nextlinen("----");
@@ -388,7 +384,7 @@ static int bootdev_test_hunter(struct unit_test_state *uts)
return 0;
}
BOOTSTD_TEST(bootdev_test_hunter, UTF_DM | UTF_SCAN_FDT);
BOOTSTD_TEST(bootdev_test_hunter, UTF_DM | UTF_SCAN_FDT | UTF_CONSOLE);
/* Check 'bootdev hunt' command */
static int bootdev_test_cmd_hunt(struct unit_test_state *uts)
@@ -401,7 +397,6 @@ static int bootdev_test_cmd_hunt(struct unit_test_state *uts)
/* get access to the used hunters */
ut_assertok(bootstd_get_priv(&std));
console_record_reset_enable();
ut_assertok(run_command("bootdev hunt -l", 0));
ut_assert_nextline("Prio Used Uclass Hunter");
ut_assert_nextlinen("----");
@@ -462,7 +457,8 @@ static int bootdev_test_cmd_hunt(struct unit_test_state *uts)
return 0;
}
BOOTSTD_TEST(bootdev_test_cmd_hunt, UTF_DM | UTF_SCAN_FDT | UTF_ETH_BOOTDEV);
BOOTSTD_TEST(bootdev_test_cmd_hunt, UTF_DM | UTF_SCAN_FDT | UTF_ETH_BOOTDEV |
UTF_CONSOLE);
/* Check searching for bootdevs using the hunters */
static int bootdev_test_hunt_scan(struct unit_test_state *uts)
@@ -527,7 +523,6 @@ static int bootdev_test_hunt_prio(struct unit_test_state *uts)
usb_started = false;
test_set_skip_delays(true);
console_record_reset_enable();
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");
@@ -544,7 +539,7 @@ static int bootdev_test_hunt_prio(struct unit_test_state *uts)
return 0;
}
BOOTSTD_TEST(bootdev_test_hunt_prio, UTF_DM | UTF_SCAN_FDT);
BOOTSTD_TEST(bootdev_test_hunt_prio, UTF_DM | UTF_SCAN_FDT | UTF_CONSOLE);
/* Check hunting for bootdevs with a particular label */
static int bootdev_test_hunt_label(struct unit_test_state *uts)
@@ -559,7 +554,6 @@ static int bootdev_test_hunt_label(struct unit_test_state *uts)
ut_assertok(bootstd_get_priv(&std));
/* scan an unknown uclass */
console_record_reset_enable();
old = (void *)&mflags; /* arbitrary pointer to check against dev */
dev = old;
mflags = 123;
@@ -597,7 +591,7 @@ static int bootdev_test_hunt_label(struct unit_test_state *uts)
return 0;
}
BOOTSTD_TEST(bootdev_test_hunt_label, UTF_DM | UTF_SCAN_FDT);
BOOTSTD_TEST(bootdev_test_hunt_label, UTF_DM | UTF_SCAN_FDT | UTF_CONSOLE);
/* Check iterating to the next label in a list */
static int bootdev_test_next_label(struct unit_test_state *uts)
@@ -624,7 +618,6 @@ static int bootdev_test_next_label(struct unit_test_state *uts)
dev = NULL;
mflags = 123;
ut_assertok(bootdev_next_label(&iter, &dev, &mflags));
console_record_reset_enable();
ut_assert_console_end();
ut_assertnonnull(dev);
ut_asserteq_str("mmc0.bootdev", dev->name);
@@ -675,7 +668,7 @@ static int bootdev_test_next_label(struct unit_test_state *uts)
return 0;
}
BOOTSTD_TEST(bootdev_test_next_label, UTF_DM | UTF_SCAN_FDT | UTF_ETH_BOOTDEV |
UTF_SF_BOOTDEV);
UTF_SF_BOOTDEV | UTF_CONSOLE);
/* Check iterating to the next prioirty in a list */
static int bootdev_test_next_prio(struct unit_test_state *uts)
@@ -700,7 +693,6 @@ static int bootdev_test_next_prio(struct unit_test_state *uts)
iter.flags = BOOTFLOWIF_SHOW;
dev = NULL;
console_record_reset_enable();
ut_assertok(bootdev_next_prio(&iter, &dev));
ut_assertnonnull(dev);
ut_asserteq_str("mmc2.bootdev", dev->name);
@@ -759,4 +751,5 @@ static int bootdev_test_next_prio(struct unit_test_state *uts)
return 0;
}
BOOTSTD_TEST(bootdev_test_next_prio, UTF_DM | UTF_SCAN_FDT | UTF_SF_BOOTDEV);
BOOTSTD_TEST(bootdev_test_next_prio, UTF_DM | UTF_SCAN_FDT | UTF_SF_BOOTDEV |
UTF_CONSOLE);