From: Simon Glass <sjg@chromium.org>
Add a new -V flag to sandbox which accepts a delay in milliseconds. This
causes video tests to pause after each assertion, allowing the display
output to be visually inspected.
This is useful for debugging video tests and understanding what is being
drawn at each step.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
---
arch/sandbox/cpu/start.c | 10 ++++++++++
arch/sandbox/include/asm/state.h | 1 +
doc/arch/sandbox/sandbox.rst | 4 ++++
test/dm/video.c | 7 +++++--
4 files changed, 20 insertions(+), 2 deletions(-)
@@ -365,6 +365,16 @@ static int sandbox_cmdline_cb_double_lcd(struct sandbox_state *state,
SANDBOX_CMDLINE_OPT_SHORT(double_lcd, 'K', 0,
"Double the LCD display size in each direction");
+static int sandbox_cmdline_cb_video_test(struct sandbox_state *state,
+ const char *arg)
+{
+ state->video_test = simple_strtol(arg, NULL, 10);
+
+ return 0;
+}
+SANDBOX_CMDLINE_OPT_SHORT(video_test, 'V', 1,
+ "Enable video test mode (ms delay between asserts)");
+
static const char *term_args[STATE_TERM_COUNT] = {
"raw-with-sigs",
"raw",
@@ -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 */
+ int video_test; /* ms to wait before next assert */
/* Pointer to information for each SPI bus/cs */
struct sandbox_spi_info spi[CONFIG_SANDBOX_SPI_MAX_BUS]
@@ -252,6 +252,10 @@ available options. Some of these are described below:
-v, --verbose
Show console output from tests. Normally this is suppressed.
+-V, --video_test <ms>
+ Enable video test mode with a delay (in milliseconds) between assertions. This
+ allows time to examine the display during testing.
+
-w, --write
Write driver state to state file on exit. In conjunction with `-r`, this allows
sandbox to save and restore emulated hardware state (such as a TPM) across
@@ -50,6 +50,7 @@ DM_TEST(dm_test_video_base, UTF_SCAN_PDATA | UTF_SCAN_FDT);
int video_compress_fb(struct unit_test_state *uts, struct udevice *dev,
bool use_copy)
{
+ struct sandbox_state *state = state_get_current();
struct video_priv *priv = dev_get_uclass_priv(dev);
uint destlen;
void *dest;
@@ -70,8 +71,10 @@ int video_compress_fb(struct unit_test_state *uts, struct udevice *dev,
if (ret)
return ret;
- /* provide a useful delay if #define LOG_DEBUG at the top of file */
- if (_DEBUG)
+ /* provide a useful delay if -V flag is used or LOG_DEBUG is set */
+ if (state->video_test)
+ mdelay(state->video_test);
+ else if (_DEBUG)
mdelay(300);
return destlen;