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 <sjg@chromium.org>
Fixes: 25c8b9f298 ("test: add first autoboot unit tests")
Reviewed-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
This commit is contained in:
Simon Glass
2021-07-24 15:14:39 -06:00
parent ea40b20431
commit cb8970092f
6 changed files with 73 additions and 3 deletions

View File

@@ -4,6 +4,7 @@
*/
#include <common.h>
#include <autoboot.h>
#include <bloblist.h>
#include <errno.h>
#include <fdtdec.h>
@@ -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;