[PATCH v4 04/42] sandbox: Drop the 'starting...' message unless testing
Heinrich Schuchardt
xypron.glpk at gmx.de
Thu Mar 4 16:38:06 CET 2021
On 3/4/21 2:50 PM, Simon Glass wrote:
> 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 at 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(-)
>
> diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c
> index c4c4128d465..3dcab6a0cc8 100644
> --- a/arch/sandbox/cpu/start.c
> +++ b/arch/sandbox/cpu/start.c
> @@ -389,6 +389,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 */
> @@ -491,8 +500,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__);
> + }
Why don't you drop the message entirely?
test_log_dropped() could live well without this message:
Just check that you after restarting you reach a prompt and 'debug:
main' is not in the output.
Best regards
Heinrich
>
> /* Do pre- and post-relocation init */
> board_init_f(0);
> diff --git a/arch/sandbox/include/asm/state.h b/arch/sandbox/include/asm/state.h
> index bca13069824..d0e7fdbd5b0 100644
> --- a/arch/sandbox/include/asm/state.h
> +++ b/arch/sandbox/include/asm/state.h
> @@ -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.
> diff --git a/test/py/tests/test_log.py b/test/py/tests/test_log.py
> index f889120f2b3..e2955ab0770 100644
> --- a/test/py/tests/test_log.py
> +++ b/test/py/tests/test_log.py
> @@ -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)
>
More information about the U-Boot
mailing list