]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
test: add test for dropped trace before log_init
authorPatrick Delaunay <patrick.delaunay@st.com>
Fri, 27 Nov 2020 10:20:55 +0000 (11:20 +0100)
committerTom Rini <trini@konsulko.com>
Fri, 15 Jan 2021 19:36:11 +0000 (14:36 -0500)
Add test for dropped trace before log_init, displayed by debug uart.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
arch/sandbox/cpu/start.c
test/py/tests/test_log.py

index 8322ed7a1fe135ddab0edfa386c61f7eb1e917f7..2d18d9debcde3ce0359ab077b5b480ab60bebf1c 100644 (file)
@@ -9,6 +9,7 @@
 #include <efi_loader.h>
 #include <errno.h>
 #include <init.h>
+#include <log.h>
 #include <os.h>
 #include <cli.h>
 #include <sort.h>
@@ -486,6 +487,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__);
+
        /* Do pre- and post-relocation init */
        board_init_f(0);
 
index 387b392ce9e73a8b2fc4f132c1364c05b5dc5a3b..f889120f2b3dd9e2263fb67e2c57ee11fd99e4e6 100644 (file)
@@ -36,3 +36,14 @@ def test_log_format(u_boot_console):
         run_with_format('FLfm', 'file.c:123-func() msg')
         run_with_format('lm', 'NOTICE. msg')
         run_with_format('m', 'msg')
+
+@pytest.mark.buildconfigspec('debug_uart')
+@pytest.mark.boardspec('sandbox')
+def test_log_dropped(u_boot_console):
+    """Test dropped 'log' message when debug_uart is activated"""
+
+    cons = u_boot_console
+    cons.restart_uboot()
+    output = cons.get_spawn_output().replace('\r', '')
+    assert 'sandbox: starting...' in output
+    assert (not 'debug: main' in output)