@@ -388,6 +388,15 @@ static int sandbox_cmdline_cb_select_unittests(struct sandbox_state *state,
}
SANDBOX_CMDLINE_OPT_SHORT(select_unittests, 'k', 1, "Select unit tests to run");
+static int sandbox_cmdline_cb_log_test(struct sandbox_state *state,
+ const char *arg)
+{
+ state->log_test = true;
+
+ return 0;
+}
+SANDBOX_CMDLINE_OPT(log_test, 0, "Show logging info on startup (for testing)");
+
static void setup_ram_buf(struct sandbox_state *state)
{
/* Zero the RAM buffer if we didn't read it, to keep valgrind happy */
@@ -488,8 +497,10 @@ int main(int argc, char *argv[])
gd->reloc_off = (ulong)gd->arch.text_base;
/* sandbox test: log functions called before log_init in board_init_f */
- log_info("sandbox: starting...\n");
- log_debug("debug: %s\n", __func__);
+ if (state->log_test) {
+ log_info("sandbox: starting...\n");
+ log_debug("debug: %s\n", __func__);
+ }
/* Do pre- and post-relocation init */
board_init_f(0);
@@ -105,6 +105,7 @@ struct sandbox_state {
struct list_head mapmem_head; /* struct sandbox_mapmem_entry */
bool hwspinlock; /* Hardware Spinlock status */
bool allow_memio; /* Allow readl() etc. to work */
+ bool log_test; /* Output some log info for testing */
/*
* This struct is getting large.
@@ -43,7 +43,7 @@ def test_log_dropped(u_boot_console):
"""Test dropped 'log' message when debug_uart is activated"""
cons = u_boot_console
- cons.restart_uboot()
+ cons.restart_uboot_with_flags(['--log_test'])
output = cons.get_spawn_output().replace('\r', '')
assert 'sandbox: starting...' in output
assert (not 'debug: main' in output)
This message is annoying since it is only useful for testing. Add a flag to control whether it is emitted or not, so it can be supressed by default. Signed-off-by: Simon Glass <sjg@chromium.org> --- (no changes since v1) arch/sandbox/cpu/start.c | 15 +++++++++++++-- arch/sandbox/include/asm/state.h | 1 + test/py/tests/test_log.py | 2 +- 3 files changed, 15 insertions(+), 3 deletions(-)