Skip to contentSkip to conversation

log: syslog logging driver

PATCH New Heinrich Schuchardt 5 participants 19 messages Feb 26, 2020 – May 6, 2020

lore
Share & tools
lore
#0 lore raw

v5 cover log: syslog logging driver

This patch series provides a logging driver to send syslog messages via UDP port 514 to a syslog server and a unit test for the syslog driver. For testing LOG_SYSLOG is enabled on the sandbox.

For CONFIG_LOG=n a patch enables printf() or debug() output for log_* functions. A unit test for this use case is provided.

v5:
do not build syslog driver in SPL
v4:
correct syslog test (expect 'uboot:' not 'uboot[1]:') provide more comments for syslog test

*** BLURB HERE ***

Heinrich Schuchardt (6):
log: correct CONFIG_LOG_TEST prerequisites
log: syslog driver
log: output for CONFIG_LOG=n
test: log functions with CONFIG_LOG=n
test: log: test syslog logging driver
configs: sandbox: enable LOG_SYSLOG

 MAINTAINERS                        |   4 +-
 common/Kconfig                     |   9 +-
 common/Makefile                    |   1 +
 common/log_syslog.c                | 117 ++++++++++++
 configs/sandbox64_defconfig        |   1 +
 configs/sandbox_defconfig          |   1 +
 configs/sandbox_flattree_defconfig |   1 +
 doc/README.log                     |   3 +
 include/log.h                      |  10 +-
 include/test/log.h                 |  16 ++
 include/test/suites.h              |   1 +
 test/Kconfig                       |   9 +
 test/Makefile                      |   2 +-
 test/cmd_ut.c                      |   6 +
 test/log/Makefile                  |  14 ++
 test/log/nolog_test.c              | 135 ++++++++++++++
 test/log/syslog_test.c             | 280 +++++++++++++++++++++++++++++
 test/log/test-main.c               |  20 +++
 18 files changed, 621 insertions(+), 9 deletions(-)
 create mode 100644 common/log_syslog.c
 create mode 100644 include/test/log.h
 create mode 100644 test/log/nolog_test.c
 create mode 100644 test/log/syslog_test.c
 create mode 100644 test/log/test-main.c

--
2.25.0

#1 lore raw

PATCH v5 1/6 log: correct CONFIG_LOG_TEST prerequisites

An error

undefined reference to `do_log_test'

occurs for CONFIG_CMD_LOG=y, CONFIG_LOG_TEST=y, CONGIG_UNIT_TEST=n

Make CONFIG_UNIT_TEST a prerequisite.

---
v5:
no change
v4:
no change

---
 common/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/Kconfig +1 -1
index 46e4193fc8..cedd353e89 100644
@@ -776,7 +776,7 @@ config TPL_LOG_CONSOLE
 
 config LOG_TEST
 	bool "Provide a test for logging"
-	depends on LOG
+	depends on LOG && UNIT_TEST
 	default y if SANDBOX
 	help
 	  This enables a 'log test' command to test logging. It is normally

--
2.25.0

#3 lore raw

PATCH v5 2/6 log: syslog driver

In reply to Heinrich Schuchardt

Provide a log driver that broadcasts RFC 3164 messages to syslog servers. rsyslog is one implementation of such a server.

The messages are sent to the local broadcast address 255.255.255.255 on port 514.

The environment variable log_hostname can be used to provide the HOSTNAME field for the messages. The optional TIMESTAMP field of RFC 3164 is not provided.

---
v5:
do not build syslog driver in SPL
v4:
no change

---
 MAINTAINERS         |   2 +-
 common/Kconfig      |   7 +++
 common/Makefile     |   1 +
 common/log_syslog.c | 117 ++++++++++++++++++++++++++++++++++++++++++++
 doc/README.log      |   3 ++
 5 files changed, 129 insertions(+), 1 deletion(-)
 create mode 100644 common/log_syslog.c
MAINTAINERS +1 -1
index 1842569f24..c1ff620c4a 100644
@@ -631,7 +631,7 @@ LOGGING
 M:	Simon Glass <[email protected]>
 S:	Maintained
 T:	git https://gitlab.denx.de/u-boot/u-boot.git
-F:	common/log.c
+F:	common/log*
 F:	cmd/log.c
 F:	test/log/log_test.c
 F:	test/py/tests/test_log.py
common/Kconfig +7 -0
index cedd353e89..af0a009a8e 100644
@@ -774,6 +774,13 @@ config TPL_LOG_CONSOLE
 	  log message is shown - other details like level, category, file and
 	  line number are omitted.
 
+config LOG_SYSLOG
+	bool "Log output to syslog server"
+	depends on LOG && NET
+	help
+	  Enables a log driver which broadcasts log records via UDP port 514
+	  to syslog servers.
+
 config LOG_TEST
 	bool "Provide a test for logging"
 	depends on LOG && UNIT_TEST
common/Makefile +1 -0
index 896e4af91d..dd54118091 100644
@@ -131,6 +131,7 @@ obj-$(CONFIG_DFU_OVER_USB) += dfu.o
 obj-y += command.o
 obj-$(CONFIG_$(SPL_TPL_)LOG) += log.o
 obj-$(CONFIG_$(SPL_TPL_)LOG_CONSOLE) += log_console.o
+obj-$(CONFIG_$(SPL_TPL_)LOG_SYSLOG) += log_syslog.o
 obj-y += s_record.o
 obj-$(CONFIG_CMD_LOADB) += xyzModem.o
 obj-$(CONFIG_$(SPL_TPL_)YMODEM_SUPPORT) += xyzModem.o
common/log_syslog.c new file +117 -0

117 lines not on this page · raw message

doc/README.log +3 -0
index 19856d43da..1057981f45 100644
@@ -147,7 +147,10 @@ several possible determinations for logging information, all of which can be
 enabled or disabled independently:
 
    console - goes to stdout
+   syslog - broadcast RFC 3164 messages to syslog servers on UDP port 514
 
+The syslog driver sends the value of environmental variable 'log_hostname' as
+HOSTNAME if available.
 
 Log format
 ----------

--
2.25.0

#4 lore raw

PATCH v5 2/6 log: syslog driver

Quoted 17 lines · Heinrich Schuchardt

Provide a log driver that broadcasts RFC 3164 messages to syslog servers. rsyslog is one implementation of such a server.

The messages are sent to the local broadcast address 255.255.255.255 on port 514.

The environment variable log_hostname can be used to provide the HOSTNAME field for the messages. The optional TIMESTAMP field of RFC 3164 is not provided.

---
v5:
do not build syslog driver in SPL
v4:
no change

Quoted 9 lines
---
 MAINTAINERS         |   2 +-
 common/Kconfig      |   7 +++
 common/Makefile     |   1 +
 common/log_syslog.c | 117 ++++++++++++++++++++++++++++++++++++++++++++
 doc/README.log      |   3 ++
 5 files changed, 129 insertions(+), 1 deletion(-)
 create mode 100644 common/log_syslog.c
#5 lore raw

PATCH v5 2/6 log: syslog driver

Quoted 17 lines · Heinrich Schuchardt

Provide a log driver that broadcasts RFC 3164 messages to syslog servers. rsyslog is one implementation of such a server.

The messages are sent to the local broadcast address 255.255.255.255 on port 514.

The environment variable log_hostname can be used to provide the HOSTNAME field for the messages. The optional TIMESTAMP field of RFC 3164 is not provided.

---
v5:
do not build syslog driver in SPL
v4:
no change

Quoted 9 lines
---
 MAINTAINERS         |   2 +-
 common/Kconfig      |   7 +++
 common/Makefile     |   1 +
 common/log_syslog.c | 117 ++++++++++++++++++++++++++++++++++++++++++++
 doc/README.log      |   3 ++
 5 files changed, 129 insertions(+), 1 deletion(-)
 create mode 100644 common/log_syslog.c

Applied to u-boot-dm, thanks!

#6 lore raw

PATCH v5 3/6 log: output for CONFIG_LOG=n

In reply to Heinrich Schuchardt

If CONFIG_LOG=n, we should still output errors, warnings, notices, infos, and for DEBUG=1 also debug messages.

---
v5:
no change
v4:
no change

---
 include/log.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
include/log.h +5 -5
index 62fb8afbd0..0453876001 100644
@@ -115,11 +115,11 @@ static inline int _log_nop(enum log_category_t cat, enum log_level_t level,
 #define log_io(_fmt...)		log(LOG_CATEGORY, LOGL_DEBUG_IO, ##_fmt)
 #else
 #define _LOG_MAX_LEVEL LOGL_INFO
-#define log_err(_fmt...)	log_nop(LOG_CATEGORY, LOGL_ERR, ##_fmt)
-#define log_warning(_fmt...)	log_nop(LOG_CATEGORY, LOGL_WARNING, ##_fmt)
-#define log_notice(_fmt...)	log_nop(LOG_CATEGORY, LOGL_NOTICE, ##_fmt)
-#define log_info(_fmt...)	log_nop(LOG_CATEGORY, LOGL_INFO, ##_fmt)
-#define log_debug(_fmt...)	log_nop(LOG_CATEGORY, LOGL_DEBUG, ##_fmt)
+#define log_err(_fmt, ...)	printf(_fmt, ##__VA_ARGS__)
+#define log_warning(_fmt, ...)	printf(_fmt, ##__VA_ARGS__)
+#define log_notice(_fmt, ...)	printf(_fmt, ##__VA_ARGS__)
+#define log_info(_fmt, ...)	printf(_fmt, ##__VA_ARGS__)
+#define log_debug(_fmt, ...)	debug(_fmt, ##__VA_ARGS__)
 #define log_content(_fmt...)	log_nop(LOG_CATEGORY, \
 					LOGL_DEBUG_CONTENT, ##_fmt)
 #define log_io(_fmt...)		log_nop(LOG_CATEGORY, LOGL_DEBUG_IO, ##_fmt)

--
2.25.0

#8 lore raw

PATCH v5 3/6 log: output for CONFIG_LOG=n

In reply to Heinrich Schuchardt
Quoted 5 lines · Heinrich Schuchardt

If CONFIG_LOG=n, we should still output errors, warnings, notices, infos, and for DEBUG=1 also debug messages.

NAK

This patch grows SoCFPGA SPL size by more than 6 bytes, and considering the recent discussion, I believe it was made very clear that any growth in SPL size is not allowed. I am surprised that this was not caught earlier.

So, please revert this patch.

I see the following with socfpga_cyclone5_defconfig

   text    data     bss     dec     hex filename
- 52235    1916      16   54167    d397 spl/u-boot-spl
+ 52319    1916      16   54251    d3eb spl/u-boot-spl
Quoted 33 lines

---
v5:
no change
v4:
no change

---
 include/log.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
include/log.h +5 -6
index 62fb8afbd0..0453876001 100644
@@ -115,11 +115,11 @@ static inline int _log_nop(enum log_category_t cat, enum log_level_t level,
 #define log_io(_fmt...)		log(LOG_CATEGORY, LOGL_DEBUG_IO, ##_fmt)
 #else
 #define _LOG_MAX_LEVEL LOGL_INFO
-#define log_err(_fmt...)	log_nop(LOG_CATEGORY, LOGL_ERR, ##_fmt)
-#define log_warning(_fmt...)	log_nop(LOG_CATEGORY, LOGL_WARNING, ##_fmt)
-#define log_notice(_fmt...)	log_nop(LOG_CATEGORY, LOGL_NOTICE, ##_fmt)
-#define log_info(_fmt...)	log_nop(LOG_CATEGORY, LOGL_INFO, ##_fmt)
-#define log_debug(_fmt...)	log_nop(LOG_CATEGORY, LOGL_DEBUG, ##_fmt)
+#define log_err(_fmt, ...)	printf(_fmt, ##__VA_ARGS__)
+#define log_warning(_fmt, ...)	printf(_fmt, ##__VA_ARGS__)
+#define log_notice(_fmt, ...)	printf(_fmt, ##__VA_ARGS__)
+#define log_info(_fmt, ...)	printf(_fmt, ##__VA_ARGS__)
+#define log_debug(_fmt, ...)	debug(_fmt, ##__VA_ARGS__)
 #define log_content(_fmt...)	log_nop(LOG_CATEGORY, \
 					LOGL_DEBUG_CONTENT, ##_fmt)
 #define log_io(_fmt...)		log_nop(LOG_CATEGORY, LOGL_DEBUG_IO, ##_fmt)
--

2.25.0

#9 lore raw

PATCH v5 3/6 log: output for CONFIG_LOG=n

Quoted 13 lines · Marek Vasut
Quoted 5 lines · Heinrich Schuchardt

If CONFIG_LOG=n, we should still output errors, warnings, notices, infos, and for DEBUG=1 also debug messages.

NAK

This patch grows SoCFPGA SPL size by more than 6 bytes, and considering the recent discussion, I believe it was made very clear that any growth in SPL size is not allowed. I am surprised that this was not caught earlier.

Quoted 7 lines

So, please revert this patch.

I see the following with socfpga_cyclone5_defconfig

   text    data     bss     dec     hex filename
- 52235    1916      16   54167    d397 spl/u-boot-spl
+ 52319    1916      16   54251    d3eb spl/u-boot-spl

Bugfix of previously important prints being missing. Fix your patch and quit trolling please.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200422/ee3409db/attachment.sig>
#10 lore raw

PATCH v5 3/6 log: output for CONFIG_LOG=n

Quoted 16 lines · Tom Rini
Quoted 15 lines · Marek Vasut
Quoted 5 lines · Heinrich Schuchardt

If CONFIG_LOG=n, we should still output errors, warnings, notices, infos, and for DEBUG=1 also debug messages.

NAK

This patch grows SoCFPGA SPL size by more than 6 bytes, and considering the recent discussion, I believe it was made very clear that any growth in SPL size is not allowed. I am surprised that this was not caught earlier.

So, please revert this patch.

Quoted 7 lines
Quoted 5 lines

I see the following with socfpga_cyclone5_defconfig

   text    data     bss     dec     hex filename
- 52235    1916      16   54167    d397 spl/u-boot-spl
+ 52319    1916      16   54251    d3eb spl/u-boot-spl

Bugfix of previously important prints being missing.

So, can you please clarify what the rule for acceptable SPL growth is?

#11 lore raw

PATCH v5 4/6 test: log functions with CONFIG_LOG=n

In reply to Heinrich Schuchardt

If CONFIG_LOG=n, we still expect output for log_err(), log_warning(), log_notice(), log_info() and in case of DEBUG=1 also for log_debug().

Provide unit tests verifying this.

The tests depend on:

CONFIG_CONSOLE_RECORD=y
CONFIG_LOG=n
CONFIG_UT_LOG=y

It may be necessary to increase the value of CONFIG_SYS_MALLOC_F_LEN to accommodate CONFIG_CONSOLE_RECORD=y.

---
v5:
no change
v4:
no change

---
 MAINTAINERS           |   2 +-
 include/test/log.h    |  16 +++++
 include/test/suites.h |   1 +
 test/Kconfig          |   9 +++
 test/Makefile         |   2 +-
 test/cmd_ut.c         |   6 ++
 test/log/Makefile     |  10 ++++
 test/log/nolog_test.c | 135 ++++++++++++++++++++++++++++++++++++++++++
 test/log/test-main.c  |  20 +++++++
 9 files changed, 199 insertions(+), 2 deletions(-)
 create mode 100644 include/test/log.h
 create mode 100644 test/log/nolog_test.c
 create mode 100644 test/log/test-main.c
MAINTAINERS +1 -1
index c1ff620c4a..9c2b7bf4c2 100644
@@ -633,7 +633,7 @@ S:	Maintained
 T:	git https://gitlab.denx.de/u-boot/u-boot.git
 F:	common/log*
 F:	cmd/log.c
-F:	test/log/log_test.c
+F:	test/log/
 F:	test/py/tests/test_log.py
 
 MALI DISPLAY PROCESSORS
include/test/log.h new file +16 -0
new file mode 100644
index 0000000000..c661cde75a
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2020, Heinrich Schuchardt <[email protected]>
+ *
+ * Tests for logging functions
+ */
+
+#ifndef __TEST_LOG_H__
+#define __TEST_LOG_H__
+
+#include <test/test.h>
+
+/* Declare a new logging test */
+#define LOG_TEST(_name) UNIT_TEST(_name, 0, log_test)
+
+#endif /* __TEST_LOG_H__ */
include/test/suites.h +1 -0
index 0748185eaf..39ad81a90f 100644
@@ -30,6 +30,7 @@ int do_ut_compression(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]);
 int do_ut_dm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
 int do_ut_env(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
 int do_ut_lib(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
+int do_ut_log(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
 int do_ut_optee(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
 int do_ut_overlay(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
 int do_ut_time(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
test/Kconfig +9 -0
index cb51b46721..32e6197dca 100644
@@ -30,6 +30,15 @@ config UT_LIB_ASN1
 
 endif
 
+config UT_LOG
+	bool "Unit tests for logging functions"
+	depends on UNIT_TEST
+	default y
+	help
+	  Enables the 'ut log' command which tests logging functions like
+	  log_err().
+	  See also CONFIG_LOG_TEST which provides the 'log test' command.
+
 config UT_TIME
 	bool "Unit tests for time functions"
 	depends on UNIT_TEST
test/Makefile +1 -1
index 2fe41f489c..2971d0d87f 100644
@@ -10,5 +10,5 @@ obj-$(CONFIG_SANDBOX) += compression.o
 obj-$(CONFIG_SANDBOX) += print_ut.o
 obj-$(CONFIG_UT_TIME) += time_ut.o
 obj-$(CONFIG_UT_UNICODE) += unicode_ut.o
-obj-$(CONFIG_$(SPL_)LOG) += log/
+obj-y += log/
 obj-$(CONFIG_UNIT_TEST) += lib/
test/cmd_ut.c +6 -0
index a3a9d49f7e..7fdcdbb1a6 100644
@@ -60,6 +60,9 @@ static cmd_tbl_t cmd_ut_sub[] = {
 #ifdef CONFIG_UT_LIB
 	U_BOOT_CMD_MKENT(lib, CONFIG_SYS_MAXARGS, 1, do_ut_lib, "", ""),
 #endif
+#ifdef CONFIG_UT_LOG
+	U_BOOT_CMD_MKENT(log, CONFIG_SYS_MAXARGS, 1, do_ut_log, "", ""),
+#endif
 #ifdef CONFIG_UT_TIME
 	U_BOOT_CMD_MKENT(time, CONFIG_SYS_MAXARGS, 1, do_ut_time, "", ""),
 #endif
@@ -125,6 +128,9 @@ static char ut_help_text[] =
 #ifdef CONFIG_UT_LIB
 	"ut lib [test-name] - test library functions\n"
 #endif
+#ifdef CONFIG_UT_LOG
+	"ut log [test-name] - test logging functions\n"
+#endif
 #ifdef CONFIG_UT_OPTEE
 	"ut optee [test-name]\n"
 #endif
test/log/Makefile +10 -0
index e0d0a4745f..98178f5e2b 100644
@@ -3,3 +3,13 @@
 # Copyright (c) 2017 Google, Inc
 
 obj-$(CONFIG_LOG_TEST) += log_test.o
+
+ifdef CONFIG_UT_LOG
+
+obj-y += test-main.o
+
+ifndef CONFIG_LOG
+obj-$(CONFIG_CONSOLE_RECORD) += nolog_test.o
+endif
+
+endif # CONFIG_UT_LOG
test/log/nolog_test.c new file +135 -0

135 lines not on this page · raw message

test/log/test-main.c new file +20 -0
new file mode 100644
index 0000000000..855de47f33
@@ -0,0 +1,20 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (c) 2020, Heinrich Schuchardt <[email protected]>
+ *
+ * Logging function tests.
+ */
+
+#include <common.h>
+#include <console.h>
+#include <test/log.h>
+#include <test/suites.h>
+
+int do_ut_log(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+	struct unit_test *tests = ll_entry_start(struct unit_test, log_test);
+	const int n_ents = ll_entry_count(struct unit_test, log_test);
+
+	return cmd_ut_category("log", "log_test_",
+			       tests, n_ents, argc, argv);
+}

--
2.25.0

#12 lore raw

PATCH v5 4/6 test: log functions with CONFIG_LOG=n

If CONFIG_LOG=n, we still expect output for log_err(), log_warning(), log_notice(), log_info() and in case of DEBUG=1 also for log_debug().

Provide unit tests verifying this.

The tests depend on:

CONFIG_CONSOLE_RECORD=y
CONFIG_LOG=n
CONFIG_UT_LOG=y

It may be necessary to increase the value of CONFIG_SYS_MALLOC_F_LEN to accommodate CONFIG_CONSOLE_RECORD=y.

---
v5:
no change
v4:
no change

---
 MAINTAINERS           |   2 +-
 include/test/log.h    |  16 +++++
 include/test/suites.h |   1 +
 test/Kconfig          |   9 +++
 test/Makefile         |   2 +-
 test/cmd_ut.c         |   6 ++
 test/log/Makefile     |  10 ++++
 test/log/nolog_test.c | 135 ++++++++++++++++++++++++++++++++++++++++++
 test/log/test-main.c  |  20 +++++++
 9 files changed, 199 insertions(+), 2 deletions(-)
 create mode 100644 include/test/log.h
 create mode 100644 test/log/nolog_test.c
 create mode 100644 test/log/test-main.c

Applied to u-boot-dm, thanks!

#13 lore raw

PATCH v5 5/6 test: log: test syslog logging driver

In reply to Heinrich Schuchardt

Provide unit tests for the syslog logging driver.

---
v5:
no change
v4:
provide more comments
move uts and expected to a common structure expect 'uboot:' not 'uboot[1]:' in syslog message
v3:
new patch

---
 test/log/Makefile      |   4 +
 test/log/syslog_test.c | 280 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 284 insertions(+)
 create mode 100644 test/log/syslog_test.c
test/log/Makefile +4 -0
index 98178f5e2b..4c92550f6e 100644
@@ -8,6 +8,10 @@ ifdef CONFIG_UT_LOG
 
 obj-y += test-main.o
 
+ifdef CONFIG_SANDBOX
+obj-$(CONFIG_LOG_SYSLOG) += syslog_test.o
+endif
+
 ifndef CONFIG_LOG
 obj-$(CONFIG_CONSOLE_RECORD) += nolog_test.o
 endif
test/log/syslog_test.c new file +280 -0

280 lines not on this page · raw message

--
2.25.0

#14 lore raw

PATCH v5 5/6 test: log: test syslog logging driver

Quoted 13 lines · Heinrich Schuchardt

Provide unit tests for the syslog logging driver.

---
v5:
no change
v4:
provide more comments
move uts and expected to a common structure expect 'uboot:' not 'uboot[1]:' in syslog message
v3:
new patch

Quoted 5 lines
---
 test/log/Makefile      |   4 +
 test/log/syslog_test.c | 280 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 284 insertions(+)
 create mode 100644 test/log/syslog_test.c

See below

Quoted 26 lines
test/log/Makefile +4 -0
index 98178f5e2b..4c92550f6e 100644
@@ -8,6 +8,10 @@ ifdef CONFIG_UT_LOG
 
 obj-y += test-main.o
 
+ifdef CONFIG_SANDBOX
+obj-$(CONFIG_LOG_SYSLOG) += syslog_test.o
+endif
+
 ifndef CONFIG_LOG
 obj-$(CONFIG_CONSOLE_RECORD) += nolog_test.o
 endif
test/log/syslog_test.c new file +4 -0
new file mode 100644
index 0000000000..6ca5760eac
@@ -0,0 +1,280 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (c) 2020, Heinrich Schuchardt <[email protected]>
+ *

test/log/syslog_test.c line 14

Quoted 10 lines
test/log/syslog_test.c new file +10 -0
+ * Logging function tests for CONFIG_LOG_SYSLOG=y.
+ *
+ * Invoke the test with: ./u-boot -d arch/sandbox/dts/test.dtb
+ */
+
+/* Override CONFIG_LOG_MAX_LEVEL */
+#define LOG_DEBUG
+
+#include <common.h>
+#include <dm/device.h>

That should be at the end

test/log/syslog_test.c line 20

Quoted 6 lines
test/log/syslog_test.c new file +6 -0
+#include <hexdump.h>
+#include <test/log.h>
+#include <test/test.h>
+#include <test/suites.h>
+#include <test/ut.h>
+#include <asm/eth.h>

test/ comes after asm/

#15 lore raw

PATCH v5 5/6 test: log: test syslog logging driver

Quoted 13 lines · Heinrich Schuchardt

Provide unit tests for the syslog logging driver.

---
v5:
no change
v4:
provide more comments
move uts and expected to a common structure expect 'uboot:' not 'uboot[1]:' in syslog message
v3:
new patch

Quoted 5 lines
---
 test/log/Makefile      |   4 +
 test/log/syslog_test.c | 280 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 284 insertions(+)
 create mode 100644 test/log/syslog_test.c

See below

Quoted 1 line

Applied to u-boot-dm, thanks!

#16 lore raw

PATCH v5 5/6 test: log: test syslog logging driver

Hi Heinrich,

Quoted 21 lines · On Mon, 2 Mar 2020 at 19:45, <[email protected]> wrote:
Quoted 13 lines · Heinrich Schuchardt

Provide unit tests for the syslog logging driver.

---
v5:
no change
v4:
provide more comments
move uts and expected to a common structure expect 'uboot:' not 'uboot[1]:' in syslog message
v3:
new patch

Quoted 5 lines
---
 test/log/Makefile      |   4 +
 test/log/syslog_test.c | 280 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 284 insertions(+)
 create mode 100644 test/log/syslog_test.c
Quoted 1 line

Unfortunately this test does not run automatically with pytest at present. Can you please take a look?

Regards,
SImon

#17 lore raw

PATCH v5 6/6 configs: sandbox: enable LOG_SYSLOG

In reply to Heinrich Schuchardt

For testing purposes enable the syslog logging driver.

---
v5:
no change
v4:
no change

---
 configs/sandbox64_defconfig        | 1 +
 configs/sandbox_defconfig          | 1 +
 configs/sandbox_flattree_defconfig | 1 +
 3 files changed, 3 insertions(+)
configs/sandbox64_defconfig +1 -0
index 941b1fd2c7..035900eb42 100644
@@ -18,6 +18,7 @@ CONFIG_CONSOLE_RECORD_OUT_SIZE=0x1000
 CONFIG_SILENT_CONSOLE=y
 CONFIG_PRE_CONSOLE_BUFFER=y
 CONFIG_LOG_MAX_LEVEL=6
+CONFIG_LOG_SYSLOG=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_CMD_CPU=y
 CONFIG_CMD_LICENSE=y
configs/sandbox_defconfig +1 -0
index 7b02b8de7c..49610a2f76 100644
@@ -19,6 +19,7 @@ CONFIG_CONSOLE_RECORD_OUT_SIZE=0x1000
 CONFIG_SILENT_CONSOLE=y
 CONFIG_PRE_CONSOLE_BUFFER=y
 CONFIG_LOG_MAX_LEVEL=6
+CONFIG_LOG_SYSLOG=y
 CONFIG_LOG_ERROR_RETURN=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_ANDROID_AB=y
configs/sandbox_flattree_defconfig +1 -0
index 0049da3d48..22d54678e0 100644
@@ -15,6 +15,7 @@ CONFIG_CONSOLE_RECORD=y
 CONFIG_CONSOLE_RECORD_OUT_SIZE=0x1000
 CONFIG_SILENT_CONSOLE=y
 CONFIG_LOG_MAX_LEVEL=6
+CONFIG_LOG_SYSLOG=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_CMD_CPU=y
 CONFIG_CMD_LICENSE=y

--
2.25.0