sandbox: Add --quiet_vidconsole option to speed up output
When running sandbox with lots of console output, the vidconsole slows things down significantly since it renders truetype fonts to the internal framebuffer. Add a -Q/--quiet_vidconsole command-line option that removes vidconsole from stdout and stderr, using only the serial console. This can provide a ~300x speedup for output-heavy operations. Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: Simon Glass <simon.glass@canonical.com>
This commit is contained in:
@@ -476,6 +476,16 @@ static int sandbox_cmdline_cb_no_term_present(struct sandbox_state *state,
|
||||
SANDBOX_CMDLINE_OPT_SHORT(no_term_present, 'A', 0,
|
||||
"Assume no terminal present (for pager testing)");
|
||||
|
||||
static int sandbox_cmdline_cb_quiet_vidconsole(struct sandbox_state *state,
|
||||
const char *arg)
|
||||
{
|
||||
state->quiet_vidconsole = true;
|
||||
|
||||
return 0;
|
||||
}
|
||||
SANDBOX_CMDLINE_OPT_SHORT(quiet_vidconsole, 'Q', 0,
|
||||
"Don't use vidconsole for stdout/stderr");
|
||||
|
||||
static int sandbox_cmdline_cb_upl(struct sandbox_state *state, const char *arg)
|
||||
{
|
||||
state->upl = true;
|
||||
|
||||
@@ -177,6 +177,7 @@ struct sandbox_state {
|
||||
bool soft_fail; /* Continue on failure */
|
||||
bool pager_bypass; /* Enable pager-bypass mode */
|
||||
bool no_term_present; /* Assume no terminal present */
|
||||
bool quiet_vidconsole; /* Don't use vidconsole for stdout */
|
||||
int video_test; /* ms to wait before next assert */
|
||||
const char *video_frames_dir; /* Directory to write video frames */
|
||||
int video_frame_count; /* Number of frames written */
|
||||
|
||||
@@ -10,7 +10,9 @@
|
||||
#include <dm.h>
|
||||
#include <efi.h>
|
||||
#include <efi_loader.h>
|
||||
#include <env.h>
|
||||
#include <env_internal.h>
|
||||
#include <event.h>
|
||||
#include <extension_board.h>
|
||||
#include <init.h>
|
||||
#include <led.h>
|
||||
@@ -19,6 +21,7 @@
|
||||
#include <os.h>
|
||||
#include <acpi/acpi_table.h>
|
||||
#include <asm/global_data.h>
|
||||
#include <asm/state.h>
|
||||
#include <asm/test.h>
|
||||
#include <asm/u-boot-sandbox.h>
|
||||
#include <linux/kernel.h>
|
||||
@@ -185,3 +188,16 @@ void fwu_plat_get_bootidx(uint *boot_idx)
|
||||
*boot_idx = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int sandbox_settings(void)
|
||||
{
|
||||
struct sandbox_state *state = state_get_current();
|
||||
|
||||
if (state->quiet_vidconsole) {
|
||||
env_set("stdout", "serial");
|
||||
env_set("stderr", "serial");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
EVENT_SPY_SIMPLE(EVT_SETTINGS_R, sandbox_settings);
|
||||
|
||||
@@ -208,6 +208,13 @@ available options. Some of these are described below:
|
||||
-P, --pager_bypass
|
||||
Enable pager bypass mode for testing.
|
||||
|
||||
-Q, --quiet_vidconsole
|
||||
Don't use vidconsole for stdout/stderr. By default, sandbox outputs to both
|
||||
serial and vidconsole. This can be slow when there is a lot of output, due to
|
||||
truetype font rendering to the internal framebuffer. Use this option to use
|
||||
only serial output, which can provide a significant speedup for output-heavy
|
||||
operations.
|
||||
|
||||
-r, --read
|
||||
Read driver state from a dtb file. In conjunction with `-w`, this allows
|
||||
sandbox to save and restore emulated hardware state (such as a TPM) across
|
||||
|
||||
@@ -22,5 +22,6 @@ EVT_LAST_STAGE_INIT efi_block_device_create .*lib/efi_driver/efi_block
|
||||
EVT_LAST_STAGE_INIT install_smbios_table .*lib/efi_loader/efi_smbios.c:.*
|
||||
EVT_LAST_STAGE_INIT last_stage_init .*arch/sandbox/cpu/start.c:.*
|
||||
EVT_MISC_INIT_F sandbox_early_getopt_check .*arch/sandbox/cpu/start.c:.*
|
||||
EVT_SETTINGS_R sandbox_settings .*board/sandbox/sandbox.c:.*
|
||||
EVT_TEST h_adder_simple .*test/common/event.c:'''
|
||||
assert re.match(expect, out, re.MULTILINE) is not None
|
||||
|
||||
Reference in New Issue
Block a user