From cb8970092f2cd5f1eaadf7d15d28cb905067e07f Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 24 Jul 2021 15:14:39 -0600 Subject: sandbox: Reduce keyed autoboot delay The autoboot tests are a recent addition to U-Boot, providing much-needed coverage in this area. A side effect of the keyed autoboot test is that this feature is enabled in sandbox always. This changes the autoboot prompt and confuses the pytests. Some tests become slower, for example the vboot tests take about 27s now instead of 3s. We don't actually need this feature enabled to be able to run the tests. Add a switch to allow sandbox to turn it on and off as needed. Use this in the one test that needs it. Add a command-line flag in case this is desired in normal use. Signed-off-by: Simon Glass Fixes: 25c8b9f298e ("test: add first autoboot unit tests") Reviewed-by: Steffen Jaeckel --- arch/sandbox/cpu/state.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'arch/sandbox/cpu/state.c') diff --git a/arch/sandbox/cpu/state.c b/arch/sandbox/cpu/state.c index a4d99bade4..4e822538ba 100644 --- a/arch/sandbox/cpu/state.c +++ b/arch/sandbox/cpu/state.c @@ -4,6 +4,7 @@ */ #include +#include #include #include #include @@ -378,6 +379,23 @@ void state_reset_for_test(struct sandbox_state *state) state->next_tag = state->ram_size; } +bool autoboot_keyed(void) +{ + struct sandbox_state *state = state_get_current(); + + return IS_ENABLED(CONFIG_AUTOBOOT_KEYED) && state->autoboot_keyed; +} + +bool autoboot_set_keyed(bool autoboot_keyed) +{ + struct sandbox_state *state = state_get_current(); + bool old_val = state->autoboot_keyed; + + state->autoboot_keyed = autoboot_keyed; + + return old_val; +} + int state_init(void) { state = &main_state; -- cgit v1.2.3