Message ID | 20201127112000.v2.5.Ic62431f5da403756a2cdf753ce3656555a4263af@changeid |
---|---|
State | Accepted |
Delegated to: | Tom Rini |
Headers | show |
Series | log: don't build the trace buffer when log is not ready | expand |
On Fri, 27 Nov 2020 at 03:21, Patrick Delaunay <patrick.delaunay@st.com> wrote: > > Add test for dropped trace before log_init, displayed by debug uart. > > Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> > --- > > Changes in v2: > - Add test of displayed messages requested before log_init (NEW) > > arch/sandbox/cpu/start.c | 5 +++++ > test/py/tests/test_log.py | 11 +++++++++++ > 2 files changed, 16 insertions(+) Reviewed-by: Simon Glass <sjg@chromium.org>
On Fri, Nov 27, 2020 at 11:20:55AM +0100, Patrick Delaunay wrote: > 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> Applied to u-boot/master, thanks!
diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c index a03e5aa0b3..c5184d59be 100644 --- a/arch/sandbox/cpu/start.c +++ b/arch/sandbox/cpu/start.c @@ -8,6 +8,7 @@ #include <dm/root.h> #include <errno.h> #include <init.h> +#include <log.h> #include <os.h> #include <cli.h> #include <sort.h> @@ -465,6 +466,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); diff --git a/test/py/tests/test_log.py b/test/py/tests/test_log.py index 387b392ce9..f889120f2b 100644 --- a/test/py/tests/test_log.py +++ b/test/py/tests/test_log.py @@ -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)
Add test for dropped trace before log_init, displayed by debug uart. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> --- Changes in v2: - Add test of displayed messages requested before log_init (NEW) arch/sandbox/cpu/start.c | 5 +++++ test/py/tests/test_log.py | 11 +++++++++++ 2 files changed, 16 insertions(+)