mirror of
https://github.com/u-boot/u-boot.git
synced 2025-05-09 03:21:51 +00: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:
parent
f034becd06
commit
a6a80b3b29
5 changed files with 42 additions and 70 deletions
|
@ -50,7 +50,6 @@ static int inject_response(struct unit_test_state *uts)
|
|||
/* Check 'bootflow scan/list' commands */
|
||||
static int bootflow_cmd(struct unit_test_state *uts)
|
||||
{
|
||||
console_record_reset_enable();
|
||||
ut_assertok(run_command("bootdev select 1", 0));
|
||||
ut_assert_console_end();
|
||||
ut_assertok(run_command("bootflow scan -lH", 0));
|
||||
|
@ -76,14 +75,13 @@ static int bootflow_cmd(struct unit_test_state *uts)
|
|||
|
||||
return 0;
|
||||
}
|
||||
BOOTSTD_TEST(bootflow_cmd, UTF_DM | UTF_SCAN_FDT);
|
||||
BOOTSTD_TEST(bootflow_cmd, UTF_DM | UTF_SCAN_FDT | UTF_CONSOLE);
|
||||
|
||||
/* Check 'bootflow scan' with a label / seq */
|
||||
static int bootflow_cmd_label(struct unit_test_state *uts)
|
||||
{
|
||||
test_set_eth_enable(false);
|
||||
|
||||
console_record_reset_enable();
|
||||
ut_assertok(run_command("bootflow scan -lH mmc1", 0));
|
||||
ut_assert_nextline("Scanning for bootflows with label 'mmc1'");
|
||||
ut_assert_skip_to_line("(1 bootflow, 1 valid)");
|
||||
|
@ -123,14 +121,14 @@ static int bootflow_cmd_label(struct unit_test_state *uts)
|
|||
|
||||
return 0;
|
||||
}
|
||||
BOOTSTD_TEST(bootflow_cmd_label, UTF_DM | UTF_SCAN_FDT | UTF_ETH_BOOTDEV);
|
||||
BOOTSTD_TEST(bootflow_cmd_label, UTF_DM | UTF_SCAN_FDT | UTF_ETH_BOOTDEV |
|
||||
UTF_CONSOLE);
|
||||
|
||||
/* Check 'bootflow scan/list' commands using all bootdevs */
|
||||
static int bootflow_cmd_glob(struct unit_test_state *uts)
|
||||
{
|
||||
ut_assertok(bootstd_test_drop_bootdev_order(uts));
|
||||
|
||||
console_record_reset_enable();
|
||||
ut_assertok(run_command("bootflow scan -lGH", 0));
|
||||
ut_assert_nextline("Scanning for bootflows in all bootdevs");
|
||||
ut_assert_nextline("Seq Method State Uclass Part Name Filename");
|
||||
|
@ -155,14 +153,13 @@ static int bootflow_cmd_glob(struct unit_test_state *uts)
|
|||
|
||||
return 0;
|
||||
}
|
||||
BOOTSTD_TEST(bootflow_cmd_glob, UTF_DM | UTF_SCAN_FDT);
|
||||
BOOTSTD_TEST(bootflow_cmd_glob, UTF_DM | UTF_SCAN_FDT | UTF_CONSOLE);
|
||||
|
||||
/* Check 'bootflow scan -e' */
|
||||
static int bootflow_cmd_scan_e(struct unit_test_state *uts)
|
||||
{
|
||||
ut_assertok(bootstd_test_drop_bootdev_order(uts));
|
||||
|
||||
console_record_reset_enable();
|
||||
ut_assertok(run_command("bootflow scan -aleGH", 0));
|
||||
ut_assert_nextline("Scanning for bootflows in all bootdevs");
|
||||
ut_assert_nextline("Seq Method State Uclass Part Name Filename");
|
||||
|
@ -206,12 +203,11 @@ static int bootflow_cmd_scan_e(struct unit_test_state *uts)
|
|||
|
||||
return 0;
|
||||
}
|
||||
BOOTSTD_TEST(bootflow_cmd_scan_e, UTF_DM | UTF_SCAN_FDT);
|
||||
BOOTSTD_TEST(bootflow_cmd_scan_e, UTF_DM | UTF_SCAN_FDT | UTF_CONSOLE);
|
||||
|
||||
/* Check 'bootflow info' */
|
||||
static int bootflow_cmd_info(struct unit_test_state *uts)
|
||||
{
|
||||
console_record_reset_enable();
|
||||
ut_assertok(run_command("bootdev select 1", 0));
|
||||
ut_assert_console_end();
|
||||
ut_assertok(run_command("bootflow scan", 0));
|
||||
|
@ -247,12 +243,11 @@ static int bootflow_cmd_info(struct unit_test_state *uts)
|
|||
|
||||
return 0;
|
||||
}
|
||||
BOOTSTD_TEST(bootflow_cmd_info, UTF_DM | UTF_SCAN_FDT);
|
||||
BOOTSTD_TEST(bootflow_cmd_info, UTF_DM | UTF_SCAN_FDT | UTF_CONSOLE);
|
||||
|
||||
/* Check 'bootflow scan -b' to boot the first available bootdev */
|
||||
static int bootflow_scan_boot(struct unit_test_state *uts)
|
||||
{
|
||||
console_record_reset_enable();
|
||||
ut_assertok(inject_response(uts));
|
||||
ut_assertok(run_command("bootflow scan -b", 0));
|
||||
ut_assert_nextline(
|
||||
|
@ -269,7 +264,7 @@ static int bootflow_scan_boot(struct unit_test_state *uts)
|
|||
|
||||
return 0;
|
||||
}
|
||||
BOOTSTD_TEST(bootflow_scan_boot, UTF_DM | UTF_SCAN_FDT);
|
||||
BOOTSTD_TEST(bootflow_scan_boot, UTF_DM | UTF_SCAN_FDT | UTF_CONSOLE);
|
||||
|
||||
/* Check iterating through available bootflows */
|
||||
static int bootflow_iter(struct unit_test_state *uts)
|
||||
|
@ -385,7 +380,6 @@ static int bootflow_system(struct unit_test_state *uts)
|
|||
|
||||
/* We should get a single 'bootmgr' method right at the end */
|
||||
bootstd_clear_glob();
|
||||
console_record_reset_enable();
|
||||
ut_assertok(run_command("bootflow scan -lH", 0));
|
||||
ut_assert_skip_to_line(
|
||||
" 0 efi_mgr ready (none) 0 <NULL> ");
|
||||
|
@ -395,7 +389,8 @@ static int bootflow_system(struct unit_test_state *uts)
|
|||
|
||||
return 0;
|
||||
}
|
||||
BOOTSTD_TEST(bootflow_system, UTF_DM | UTF_SCAN_PDATA | UTF_SCAN_FDT);
|
||||
BOOTSTD_TEST(bootflow_system, UTF_DM | UTF_SCAN_PDATA | UTF_SCAN_FDT |
|
||||
UTF_CONSOLE);
|
||||
#endif
|
||||
|
||||
/* Check disabling a bootmethod if it requests it */
|
||||
|
@ -414,7 +409,6 @@ static int bootflow_iter_disable(struct unit_test_state *uts)
|
|||
ut_assertok(bootstd_test_drop_bootdev_order(uts));
|
||||
|
||||
bootstd_clear_glob();
|
||||
console_record_reset_enable();
|
||||
ut_assertok(inject_response(uts));
|
||||
ut_assertok(run_command("bootflow scan -lbH", 0));
|
||||
|
||||
|
@ -436,7 +430,7 @@ static int bootflow_iter_disable(struct unit_test_state *uts)
|
|||
|
||||
return 0;
|
||||
}
|
||||
BOOTSTD_TEST(bootflow_iter_disable, UTF_DM | UTF_SCAN_FDT);
|
||||
BOOTSTD_TEST(bootflow_iter_disable, UTF_DM | UTF_SCAN_FDT | UTF_CONSOLE);
|
||||
|
||||
/* Check 'bootflow scan' with a bootmeth ordering including a global bootmeth */
|
||||
static int bootflow_scan_glob_bootmeth(struct unit_test_state *uts)
|
||||
|
@ -450,7 +444,6 @@ static int bootflow_scan_glob_bootmeth(struct unit_test_state *uts)
|
|||
* Make sure that the -G flag makes the scan fail, since this is not
|
||||
* supported when an ordering is provided
|
||||
*/
|
||||
console_record_reset_enable();
|
||||
ut_assertok(bootmeth_set_order("efi firmware0"));
|
||||
ut_assertok(run_command("bootflow scan -lGH", 0));
|
||||
ut_assert_nextline("Scanning for bootflows in all bootdevs");
|
||||
|
@ -477,12 +470,12 @@ static int bootflow_scan_glob_bootmeth(struct unit_test_state *uts)
|
|||
|
||||
return 0;
|
||||
}
|
||||
BOOTSTD_TEST(bootflow_scan_glob_bootmeth, UTF_DM | UTF_SCAN_FDT);
|
||||
BOOTSTD_TEST(bootflow_scan_glob_bootmeth, UTF_DM | UTF_SCAN_FDT |
|
||||
UTF_CONSOLE);
|
||||
|
||||
/* Check 'bootflow boot' to boot a selected bootflow */
|
||||
static int bootflow_cmd_boot(struct unit_test_state *uts)
|
||||
{
|
||||
console_record_reset_enable();
|
||||
ut_assertok(run_command("bootdev select 1", 0));
|
||||
ut_assert_console_end();
|
||||
ut_assertok(run_command("bootflow scan", 0));
|
||||
|
@ -506,7 +499,7 @@ static int bootflow_cmd_boot(struct unit_test_state *uts)
|
|||
|
||||
return 0;
|
||||
}
|
||||
BOOTSTD_TEST(bootflow_cmd_boot, UTF_DM | UTF_SCAN_FDT);
|
||||
BOOTSTD_TEST(bootflow_cmd_boot, UTF_DM | UTF_SCAN_FDT | UTF_CONSOLE);
|
||||
|
||||
/**
|
||||
* prep_mmc_bootdev() - Set up an mmc bootdev so we can access other distros
|
||||
|
@ -583,7 +576,6 @@ static int scan_mmc_bootdev(struct unit_test_state *uts, const char *mmc_dev,
|
|||
|
||||
ut_assertok(prep_mmc_bootdev(uts, mmc_dev, bind_cros, &old_order));
|
||||
|
||||
console_record_reset_enable();
|
||||
ut_assertok(run_command("bootflow scan", 0));
|
||||
ut_assert_console_end();
|
||||
|
||||
|
@ -611,7 +603,6 @@ static int scan_mmc_android_bootdev(struct unit_test_state *uts, const char *mmc
|
|||
|
||||
ut_assertok(prep_mmc_bootdev(uts, mmc_dev, true, &old_order));
|
||||
|
||||
console_record_reset_enable();
|
||||
ut_assertok(run_command("bootflow scan", 0));
|
||||
/* Android bootflow might print one or two 'ANDROID:*' logs */
|
||||
ut_check_skipline(uts);
|
||||
|
@ -673,7 +664,7 @@ static int bootflow_cmd_menu(struct unit_test_state *uts)
|
|||
|
||||
return 0;
|
||||
}
|
||||
BOOTSTD_TEST(bootflow_cmd_menu, UTF_DM | UTF_SCAN_FDT);
|
||||
BOOTSTD_TEST(bootflow_cmd_menu, UTF_DM | UTF_SCAN_FDT | UTF_CONSOLE);
|
||||
|
||||
/* Check 'bootflow scan -m' to select a bootflow using a menu */
|
||||
static int bootflow_scan_menu(struct unit_test_state *uts)
|
||||
|
@ -779,7 +770,6 @@ static int bootflow_cmd_hunt_single(struct unit_test_state *uts)
|
|||
|
||||
ut_assertok(bootstd_test_drop_bootdev_order(uts));
|
||||
|
||||
console_record_reset_enable();
|
||||
ut_assertok(run_command("bootflow scan -l mmc1", 0));
|
||||
ut_assert_nextline("Scanning for bootflows with label 'mmc1'");
|
||||
ut_assert_skip_to_line("(1 bootflow, 1 valid)");
|
||||
|
@ -790,7 +780,8 @@ static int bootflow_cmd_hunt_single(struct unit_test_state *uts)
|
|||
|
||||
return 0;
|
||||
}
|
||||
BOOTSTD_TEST(bootflow_cmd_hunt_single, UTF_DM | UTF_SCAN_FDT);
|
||||
BOOTSTD_TEST(bootflow_cmd_hunt_single, UTF_DM | UTF_SCAN_FDT |
|
||||
UTF_CONSOLE);
|
||||
|
||||
/* Check searching for a uclass label using the hunters */
|
||||
static int bootflow_cmd_hunt_label(struct unit_test_state *uts)
|
||||
|
@ -804,7 +795,6 @@ static int bootflow_cmd_hunt_label(struct unit_test_state *uts)
|
|||
test_set_eth_enable(false);
|
||||
ut_assertok(bootstd_test_drop_bootdev_order(uts));
|
||||
|
||||
console_record_reset_enable();
|
||||
ut_assertok(run_command("bootflow scan -l mmc", 0));
|
||||
|
||||
/* check that the hunter was used */
|
||||
|
@ -827,7 +817,7 @@ static int bootflow_cmd_hunt_label(struct unit_test_state *uts)
|
|||
|
||||
return 0;
|
||||
}
|
||||
BOOTSTD_TEST(bootflow_cmd_hunt_label, UTF_DM | UTF_SCAN_FDT);
|
||||
BOOTSTD_TEST(bootflow_cmd_hunt_label, UTF_DM | UTF_SCAN_FDT | UTF_CONSOLE);
|
||||
|
||||
/**
|
||||
* check_font() - Check that the font size for an item matches expectations
|
||||
|
@ -887,7 +877,7 @@ static int bootflow_menu_theme(struct unit_test_state *uts)
|
|||
|
||||
return 0;
|
||||
}
|
||||
BOOTSTD_TEST(bootflow_menu_theme, UTF_DM | UTF_SCAN_FDT);
|
||||
BOOTSTD_TEST(bootflow_menu_theme, UTF_DM | UTF_SCAN_FDT | UTF_CONSOLE);
|
||||
|
||||
/**
|
||||
* check_arg() - Check both the normal case and the buffer-overflow case
|
||||
|
@ -1123,7 +1113,6 @@ static int bootflow_cmdline(struct unit_test_state *uts)
|
|||
{
|
||||
ut_assertok(run_command("bootflow scan mmc", 0));
|
||||
ut_assertok(run_command("bootflow sel 0", 0));
|
||||
console_record_reset_enable();
|
||||
|
||||
ut_asserteq(1, run_command("bootflow cmdline get fred", 0));
|
||||
ut_assert_nextline("Argument not found");
|
||||
|
@ -1151,7 +1140,7 @@ static int bootflow_cmdline(struct unit_test_state *uts)
|
|||
|
||||
return 0;
|
||||
}
|
||||
BOOTSTD_TEST(bootflow_cmdline, 0);
|
||||
BOOTSTD_TEST(bootflow_cmdline, UTF_CONSOLE);
|
||||
|
||||
/* test a few special changes to a long command line */
|
||||
static int bootflow_cmdline_special(struct unit_test_state *uts)
|
||||
|
@ -1192,7 +1181,7 @@ static int bootflow_cros(struct unit_test_state *uts)
|
|||
|
||||
return 0;
|
||||
}
|
||||
BOOTSTD_TEST(bootflow_cros, 0);
|
||||
BOOTSTD_TEST(bootflow_cros, UTF_CONSOLE);
|
||||
|
||||
/* Test Android bootmeth */
|
||||
static int bootflow_android(struct unit_test_state *uts)
|
||||
|
@ -1215,4 +1204,4 @@ static int bootflow_android(struct unit_test_state *uts)
|
|||
|
||||
return 0;
|
||||
}
|
||||
BOOTSTD_TEST(bootflow_android, 0);
|
||||
BOOTSTD_TEST(bootflow_android, UTF_CONSOLE);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue