mbox series

[0/4] log: Fix the syslog spam when running tests

Message ID 20200912182850.3909182-1-sjg@chromium.org
Headers show
Series log: Fix the syslog spam when running tests | expand

Message

Simon Glass Sept. 12, 2020, 6:28 p.m. UTC
At present running some sandbox tests produces unwanted ethernet errors
from the syslog driver, e.g.:

$ ./u-boot -c "ut bloblist"

Running 5 bloblist tests
Test: bloblist_test_bad_blob
Test: bloblist_test_blob
Test: bloblist_test_blob_ensure
Failed to allocate e0 bytes size=100, need size=130
No ethernet found.
bloblist add: returning err=-28
No ethernet found.
Test: bloblist_test_checksum
Checksum f3129fae != 338fbdc
No ethernet found.
Bad checksum: returning err=-5
No ethernet found.
...

This series fixes this by making the syslog driver disabled by default. It
can be enabled with a function call.


Simon Glass (4):
  log: Add a flag to enable log drivers
  log: Drop #ifdef in log_test
  log: Add a way to enable/disable a log device
  log: Disable the syslog driver by default

 common/log.c                  | 42 ++++++++++++++++++++++++++++++++++-
 common/log_console.c          |  1 +
 include/log.h                 | 28 ++++++++++++++++++++++-
 test/log/log_test.c           |  9 ++++++--
 test/log/syslog_test.c        | 24 ++++++++++++++++++++
 test/log/syslog_test.h        | 16 +++++++++++++
 test/log/syslog_test_ndebug.c |  2 ++
 test/py/tests/test_log.py     |  8 +++++++
 8 files changed, 126 insertions(+), 4 deletions(-)

Comments

Heinrich Schuchardt Sept. 14, 2020, 8:24 a.m. UTC | #1
On 9/12/20 8:28 PM, Simon Glass wrote:
> At present running some sandbox tests produces unwanted ethernet errors
> from the syslog driver, e.g.:
>
> $ ./u-boot -c "ut bloblist"
>
> Running 5 bloblist tests
> Test: bloblist_test_bad_blob
> Test: bloblist_test_blob
> Test: bloblist_test_blob_ensure
> Failed to allocate e0 bytes size=100, need size=130
> No ethernet found.
> bloblist add: returning err=-28
> No ethernet found.
> Test: bloblist_test_checksum
> Checksum f3129fae != 338fbdc
> No ethernet found.
> Bad checksum: returning err=-5
> No ethernet found.
> ...
>
> This series fixes this by making the syslog driver disabled by default. It
> can be enabled with a function call.

Hello Simon,

in log_syslog_emit() I already set processing_msg = 1 to fend of
messages from the network driver when writing messages to syslog.

The idea was right but not in the right place. This logic should be
moved to log_dispatch() to securely avoid that writing messages creates
new messages which even might lead to endless recursion.

See
[PATCH 1/1] log: mute messages generated by log drivers
https://lists.denx.de/pipermail/u-boot/2020-September/426418.html

Best regards

Heinrich

>
>
> Simon Glass (4):
>   log: Add a flag to enable log drivers
>   log: Drop #ifdef in log_test
>   log: Add a way to enable/disable a log device
>   log: Disable the syslog driver by default
>
>  common/log.c                  | 42 ++++++++++++++++++++++++++++++++++-
>  common/log_console.c          |  1 +
>  include/log.h                 | 28 ++++++++++++++++++++++-
>  test/log/log_test.c           |  9 ++++++--
>  test/log/syslog_test.c        | 24 ++++++++++++++++++++
>  test/log/syslog_test.h        | 16 +++++++++++++
>  test/log/syslog_test_ndebug.c |  2 ++
>  test/py/tests/test_log.py     |  8 +++++++
>  8 files changed, 126 insertions(+), 4 deletions(-)
>