diff options
author | Tom Rini <trini@konsulko.com> | 2025-04-22 12:26:44 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2025-04-22 12:54:53 -0600 |
commit | 9adeadfbf756a57922a68cdac147e416ca02f239 (patch) | |
tree | 7147ba721c951433a87c909b99dd9675409fdf12 | |
parent | b867932191860c060de509a45854f32266262f94 (diff) | |
parent | 753b7219c23191cb2a6468cd1acbfaeccf1380a2 (diff) |
Merge patch series "Enable UNIT_TEST for all qemu* generic targets"
Jerome Forissier <jerome.forissier@linaro.org> says:
Enable CONFIG_UNIT_TEST in most of the configs/qemu*_defconfig files
to increase test coverage in CI, and fix what needs to be fixed.
Link: https://lore.kernel.org/r/20250416135744.1995084-1-jerome.forissier@linaro.org
-rw-r--r-- | configs/qemu-arm-sbsa_defconfig | 1 | ||||
-rw-r--r-- | configs/qemu-ppce500_defconfig | 1 | ||||
-rw-r--r-- | configs/qemu-riscv32_defconfig | 1 | ||||
-rw-r--r-- | configs/qemu-riscv32_smode_defconfig | 1 | ||||
-rw-r--r-- | configs/qemu-riscv32_spl_defconfig | 1 | ||||
-rw-r--r-- | configs/qemu-riscv64_defconfig | 1 | ||||
-rw-r--r-- | configs/qemu-riscv64_smode_defconfig | 1 | ||||
-rw-r--r-- | configs/qemu-riscv64_spl_defconfig | 1 | ||||
-rw-r--r-- | configs/qemu-x86_64_defconfig | 1 | ||||
-rw-r--r-- | test/cmd/command.c | 31 |
10 files changed, 25 insertions, 15 deletions
diff --git a/configs/qemu-arm-sbsa_defconfig b/configs/qemu-arm-sbsa_defconfig index 8c5d3eb4be8..3819670defe 100644 --- a/configs/qemu-arm-sbsa_defconfig +++ b/configs/qemu-arm-sbsa_defconfig @@ -9,3 +9,4 @@ CONFIG_EFI_PARTITION=y CONFIG_PARTITION_TYPE_GUID=y CONFIG_EFI_MEDIA=y CONFIG_FS_FAT=y +CONFIG_UNIT_TEST=y diff --git a/configs/qemu-ppce500_defconfig b/configs/qemu-ppce500_defconfig index 9f20b3fcd73..a444899db33 100644 --- a/configs/qemu-ppce500_defconfig +++ b/configs/qemu-ppce500_defconfig @@ -66,3 +66,4 @@ CONFIG_VIRTIO_NET=y CONFIG_VIRTIO_BLK=y CONFIG_ADDR_MAP=y CONFIG_PANIC_HANG=y +CONFIG_UNIT_TEST=y diff --git a/configs/qemu-riscv32_defconfig b/configs/qemu-riscv32_defconfig index 1cd80f5769e..6f8f9827611 100644 --- a/configs/qemu-riscv32_defconfig +++ b/configs/qemu-riscv32_defconfig @@ -20,3 +20,4 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_DM_MTD=y CONFIG_FLASH_SHOW_PROGRESS=0 CONFIG_SYS_MAX_FLASH_BANKS=2 +CONFIG_UNIT_TEST=y diff --git a/configs/qemu-riscv32_smode_defconfig b/configs/qemu-riscv32_smode_defconfig index 6f871c83644..1d57b68086a 100644 --- a/configs/qemu-riscv32_smode_defconfig +++ b/configs/qemu-riscv32_smode_defconfig @@ -21,3 +21,4 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_DM_MTD=y CONFIG_FLASH_SHOW_PROGRESS=0 CONFIG_SYS_MAX_FLASH_BANKS=2 +CONFIG_UNIT_TEST=y diff --git a/configs/qemu-riscv32_spl_defconfig b/configs/qemu-riscv32_spl_defconfig index 9906f8b2dad..8d5f9d9f5cc 100644 --- a/configs/qemu-riscv32_spl_defconfig +++ b/configs/qemu-riscv32_spl_defconfig @@ -26,3 +26,4 @@ CONFIG_DM_MTD=y CONFIG_FLASH_SHOW_PROGRESS=0 CONFIG_SYS_MAX_FLASH_BANKS=2 # CONFIG_BINMAN_FDT is not set +CONFIG_UNIT_TEST=y diff --git a/configs/qemu-riscv64_defconfig b/configs/qemu-riscv64_defconfig index cdd511b0e72..e00050db4e1 100644 --- a/configs/qemu-riscv64_defconfig +++ b/configs/qemu-riscv64_defconfig @@ -20,3 +20,4 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_DM_MTD=y CONFIG_FLASH_SHOW_PROGRESS=0 CONFIG_SYS_MAX_FLASH_BANKS=2 +CONFIG_UNIT_TEST=y diff --git a/configs/qemu-riscv64_smode_defconfig b/configs/qemu-riscv64_smode_defconfig index 2f62f17bc8c..a424f978294 100644 --- a/configs/qemu-riscv64_smode_defconfig +++ b/configs/qemu-riscv64_smode_defconfig @@ -23,3 +23,4 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_DM_MTD=y CONFIG_FLASH_SHOW_PROGRESS=0 CONFIG_SYS_MAX_FLASH_BANKS=2 +CONFIG_UNIT_TEST=y diff --git a/configs/qemu-riscv64_spl_defconfig b/configs/qemu-riscv64_spl_defconfig index 27e092bd208..18b7e049d86 100644 --- a/configs/qemu-riscv64_spl_defconfig +++ b/configs/qemu-riscv64_spl_defconfig @@ -25,3 +25,4 @@ CONFIG_DM_MTD=y CONFIG_FLASH_SHOW_PROGRESS=0 CONFIG_SYS_MAX_FLASH_BANKS=2 # CONFIG_BINMAN_FDT is not set +CONFIG_UNIT_TEST=y diff --git a/configs/qemu-x86_64_defconfig b/configs/qemu-x86_64_defconfig index 58b1fbf132d..47075dc265a 100644 --- a/configs/qemu-x86_64_defconfig +++ b/configs/qemu-x86_64_defconfig @@ -93,3 +93,4 @@ CONFIG_SPL_VIDEO=y CONFIG_GENERATE_ACPI_TABLE=y CONFIG_CMD_DHRYSTONE=y # CONFIG_GZIP is not set +CONFIG_UNIT_TEST=y diff --git a/test/cmd/command.c b/test/cmd/command.c index 5ec93d490ba..5b1e5a77e5d 100644 --- a/test/cmd/command.c +++ b/test/cmd/command.c @@ -45,31 +45,32 @@ static int command_test(struct unit_test_state *uts) "setenv list ${list}3", strlen("setenv list 1"), 0); ut_assert(!strcmp("1", env_get("list"))); - ut_asserteq(1, run_command("false", 0)); ut_assertok(run_command("echo", 0)); - ut_asserteq(1, run_command_list("false", -1, 0)); ut_assertok(run_command_list("echo", -1, 0)); -#ifdef CONFIG_HUSH_PARSER - run_command("setenv foo 'setenv black 1\nsetenv adder 2'", 0); - run_command("run foo", 0); - ut_assertnonnull(env_get("black")); - ut_asserteq(0, strcmp("1", env_get("black"))); - ut_assertnonnull(env_get("adder")); - ut_asserteq(0, strcmp("2", env_get("adder"))); -#endif - - ut_assertok(run_command("", 0)); - ut_assertok(run_command(" ", 0)); + if (IS_ENABLED(CONFIG_HUSH_PARSER)) { + ut_asserteq(1, run_command("false", 0)); + ut_asserteq(1, run_command_list("false", -1, 0)); + run_command("setenv foo 'setenv black 1\nsetenv adder 2'", 0); + run_command("run foo", 0); + ut_assertnonnull(env_get("black")); + ut_asserteq(0, strcmp("1", env_get("black"))); + ut_assertnonnull(env_get("adder")); + ut_asserteq(0, strcmp("2", env_get("adder"))); + ut_assertok(run_command("", 0)); + ut_assertok(run_command(" ", 0)); + } ut_asserteq(1, run_command("'", 0)); /* Variadic function test-cases */ + if (IS_ENABLED(CONFIG_HUSH_PARSER)) { #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wformat-zero-length" - ut_assertok(run_commandf("")); + ut_assertok(run_commandf("")); #pragma GCC diagnostic pop - ut_assertok(run_commandf(" ")); + ut_assertok(run_commandf(" ")); + } ut_asserteq(1, run_commandf("'")); ut_assertok(run_commandf("env %s %s", "delete -f", "list")); |