sandox: test: activate tests for the command LOG
cover sandox: test: activate tests for the command LOG
This patches activate the command LOG and the associated tests in sandbox with CONFIG_CMD_LOG=y and solve the associated issues when these tests are executed.
Patrick
Patrick Delaunay (3):
dm: fix up documentation for uclass_get_by_name_len
dm: compare full name in uclass_get_by_name
sandox: test: activate tests for the command LOG
configs/sandbox_defconfig | 2 +- drivers/core/uclass.c | 11 ++++++++++- include/dm/uclass.h | 4 ++-- test/py/tests/test_log.py | 8 ++++---- 4 files changed, 17 insertions(+), 8 deletions(-)
Signature · 1 line
2.25.1
PATCH 1/3 dm: fix up documentation for uclass_get_by_name_len
Fix up the comment for uclass_get_by_name_len() to avoid confusion.
---
include/dm/uclass.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/dm/uclass.h +2 -2
@@ -173,10 +173,10 @@ int uclass_get(enum uclass_id key, struct uclass **ucp);const char *uclass_get_name (enum uclass_id id);/** -* uclass_get_by_name() - Look up a uclass by its driver name +* uclass_get_by_name_len() - Look up a uclass by its partial driver name * * @name: Name to look up -* @len: Length of name +* @len: Length of the partial name * @returns the associated uclass ID, or UCLASS_INVALID if not found */ enum uclass_id uclass_get_by_name_len (const char *name,int len);
Signature · 1 line
2.25.1
PATCH 2/3 dm: compare full name in uclass_get_by_name
In reply to Patrick DelaunayChange uclass_get_by_name to use a strict string compare function "strcmp" with the parameter 'name'.
This patch avoids issues when strlen(name)<strlen(uc_drv->name) as the function uclass_get_by_name() no more use uclass_get_by_name_len(), which limit the check with "strncmp" and length of name.
This problem is detected by the sandbox test for log filter:
in log_get_cat_by_name(), uclass_get_by_name("spi") = UCLASS_SPI_EMUL for "spi_emul", it is not the expected result = UCLASS_SPI for a search by name.
But it is the expected result for search with partial name uclass_get_by_name_len("spi", 3).
---
drivers/core/uclass.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/core/uclass.c +10 -1
@@ -196,7 +196,16 @@ enum uclass_id uclass_get_by_name_len(const char *name, int len)enum uclass_id uclass_get_by_name (const char *name) { -return uclass_get_by_name_len (name,strlen (name)); +int i; + +for (i =0 ; i <UCLASS_COUNT ; i++) { +struct uclass_driver *uc_drv =lists_uclass_lookup (i); + +if (uc_drv && !strcmp (uc_drv->name, name)) +return i; + } + +return UCLASS_INVALID ; }int dev_get_uclass_index (struct udevice *dev,struct uclass **ucp)
Signature · 1 line
2.25.1
PATCH 3/3 sandox: test: activate tests for the command LOG
In reply to Patrick DelaunayActivate the CONFIG_CMD_LOG in sandbox to execute the LOG tests by default and correct the test log format after 72fa1ad8d9 ("log: Allow padding of the function name").
---
configs/sandbox_defconfig | 2 +- test/py/tests/test_log.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-)
configs/sandbox_defconfig +1 -1
@@ -30,7 +30,6 @@ CONFIG_AUTOBOOT_STOP_STR_CRYPT="$5$rounds=640000$HrpE65IkB8CM5nCL$BKT3QdF98Bo8fJ CONFIG_CONSOLE_RECORD=y CONFIG_CONSOLE_RECORD_OUT_SIZE=0x1000 CONFIG_PRE_CONSOLE_BUFFER=y -CONFIG_LOG=y CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_MISC_INIT_F=y CONFIG_STACKPROTECTOR=y
@@ -108,6 +107,7 @@ CONFIG_CMD_CRAMFS=y CONFIG_CMD_EXT4_WRITE=y CONFIG_CMD_SQUASHFS=y CONFIG_CMD_MTDPARTS=y +CONFIG_CMD_LOG=y CONFIG_CMD_STACKPROTECTOR_TEST=y CONFIG_MAC_PARTITION=y CONFIG_AMIGA_PARTITION=y
test/py/tests/test_log.py +4 -4
@@ -27,13 +27,13 @@ def test_log_format(u_boot_console): cons = u_boot_console with cons.log.section('format'): - run_with_format('all', 'NOTICE.arch,file.c:123-func() msg') + run_with_format('all', 'NOTICE.arch,file.c:123- func() msg') output = cons.run_command('log format') assert output == 'Log format: clFLfm' - run_with_format('fm', 'func() msg') - run_with_format('clfm', 'NOTICE.arch,func() msg') - run_with_format('FLfm', 'file.c:123-func() msg') + run_with_format('fm', ' func() msg') + run_with_format('clfm', 'NOTICE.arch, func() msg') + run_with_format('FLfm', 'file.c:123- func() msg') run_with_format('lm', 'NOTICE. msg') run_with_format('m', 'msg')
Signature · 1 line
2.25.1
Quoted 5 lines · Patrick Delaunay
This patches activate the command LOG and the associated tests in sandbox with
CONFIG_CMD_LOG=yand solve the associated issues when these tests are executed.
Quoted 7 lines
Patrick
Patrick Delaunay (3):
dm: fix up documentation foruclass_get_by_name_len
dm: compare full name inuclass_get_by_name
sandox: test: activate tests for the command LOG
Probably should read sandbox. Same for this cover-letter's subject ;-p.
Quoted 5 lines
configs/sandbox_defconfig | 2 +-
drivers/core/uclass.c | 11 ++++++++++-
include/dm/uclass.h | 4 ++--
test/py/tests/test_log.py | 8 ++++----4 files changed, 17 insertions(+), 8 deletions(-)
Quoted 5 lines · Patrick Delaunay
This patches activate the command LOG and the associated tests in sandbox with
CONFIG_CMD_LOG=yand solve the associated issues when these tests are executed.
Quoted 7 lines
Patrick
Patrick Delaunay (3):
dm: fix up documentation foruclass_get_by_name_len
dm: compare full name inuclass_get_by_name
sandox: test: activate tests for the command LOG
Probably should read sandbox. Same for this cover-letter's subject ;-p.
Quoted 5 lines
configs/sandbox_defconfig | 2 +-
drivers/core/uclass.c | 11 ++++++++++-
include/dm/uclass.h | 4 ++--
test/py/tests/test_log.py | 8 ++++----4 files changed, 17 insertions(+), 8 deletions(-)
Quoted 5 lines · Marcel Ziswiler
Quoted 4 lines · Patrick Delaunay
This patches activate the command LOG and the associated tests in sandbox with
CONFIG_CMD_LOG=yand solve the associated issues when these tests are executed.
Quoted 8 lines
Quoted 7 lines
Patrick
Patrick Delaunay (3):
dm: fix up documentation foruclass_get_by_name_len
dm: compare full name inuclass_get_by_name
sandox: test: activate tests for the command LOGProbably should read sandbox. Same for this cover-letter's subject ;-p.
oups, yes
Quoted 6 lines
Quoted 6 lines
configs/sandbox_defconfig | 2 +- drivers/core/uclass.c | 11 ++++++++++- include/dm/uclass.h | 4 ++-- test/py/tests/test_log.py | 8 ++++---- 4 files changed, 17 insertions(+), 8 deletions(-)