[U-Boot] [PATCH 04/15] test: unit tests for Unicode functions

Alexander Graf agraf at suse.de
Sun Aug 26 18:02:49 UTC 2018



On 11.08.18 17:28, Heinrich Schuchardt wrote:
> Provide unit tests for Unicode functions.
> 
> Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
> ---
>  MAINTAINERS           |   1 +
>  include/test/suites.h |   3 +-
>  test/Kconfig          |   8 +
>  test/Makefile         |   1 +
>  test/cmd_ut.c         |  14 +-
>  test/unicode_ut.c     | 470 ++++++++++++++++++++++++++++++++++++++++++
>  6 files changed, 493 insertions(+), 4 deletions(-)
>  create mode 100644 test/unicode_ut.c
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 51a1472cf8..a324139471 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -374,6 +374,7 @@ F:	include/asm-generic/pe.h
>  F:	lib/charset.c
>  F:	lib/efi*/
>  F:	test/py/tests/test_efi*
> +F:	test/unicode_ut.c
>  F:	cmd/bootefi.c
>  F:	tools/file2include.c
>  
> diff --git a/include/test/suites.h b/include/test/suites.h
> index b5019a7cd2..8e4eac60eb 100644
> --- a/include/test/suites.h
> +++ b/include/test/suites.h
> @@ -23,10 +23,11 @@ struct unit_test;
>  int cmd_ut_category(const char *name, struct unit_test *tests, int n_ents,
>  		    int argc, char * const argv[]);
>  
> +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_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[]);
> -int do_ut_compression(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]);
> +int do_ut_unicode(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
>  
>  #endif /* __TEST_SUITES_H__ */
> diff --git a/test/Kconfig b/test/Kconfig
> index 3643761bc6..de16d179d0 100644
> --- a/test/Kconfig
> +++ b/test/Kconfig
> @@ -15,6 +15,14 @@ config UT_TIME
>  	  problems. But if you are having problems with udelay() and the like,
>  	  this is a good place to start.
>  
> +config UT_UNICODE

You probably want to move the hunk that actually builds charset.o with
CONFIG_UT_UNICODE set to this patch as well ;).

> +	bool "Unit tests for Unicode functions"
> +	depends on UNIT_TEST
> +	default y
> +	help
> +	  Enables the 'ut unicode' command which tests that the functions for
> +	  manipulating Unicode strings work correctly.
> +
>  source "test/dm/Kconfig"
>  source "test/env/Kconfig"
>  source "test/overlay/Kconfig"
> diff --git a/test/Makefile b/test/Makefile
> index 1092011fdb..a5f52fd5ad 100644
> --- a/test/Makefile
> +++ b/test/Makefile
> @@ -8,4 +8,5 @@ obj-$(CONFIG_SANDBOX) += command_ut.o
>  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/
> diff --git a/test/cmd_ut.c b/test/cmd_ut.c
> index 934a5a931b..d6a2593850 100644
> --- a/test/cmd_ut.c
> +++ b/test/cmd_ut.c
> @@ -49,6 +49,10 @@ static cmd_tbl_t cmd_ut_sub[] = {
>  #ifdef CONFIG_UT_TIME
>  	U_BOOT_CMD_MKENT(time, CONFIG_SYS_MAXARGS, 1, do_ut_time, "", ""),
>  #endif
> +#if defined(CONFIG_UT_UNICODE) && \
> +	!defined(CONFIG_SPL_BUILD) && !defined(API_BUILD)

CONFIG_IS_ENABLED()

Alex


More information about the U-Boot mailing list