From 35d949222f5fc629cf89063a39998fbc39c2c4ca Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Tue, 27 Oct 2020 20:29:23 +0100 Subject: test/py: test poweroff It is the 'poweroff' and not the 'reset' command that should shut down the sandbox. Adjust the unit test accordingly Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- test/py/tests/test_sandbox_exit.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/py/tests/test_sandbox_exit.py b/test/py/tests/test_sandbox_exit.py index a301f4b..2d242ae 100644 --- a/test/py/tests/test_sandbox_exit.py +++ b/test/py/tests/test_sandbox_exit.py @@ -6,11 +6,11 @@ import pytest import signal @pytest.mark.boardspec('sandbox') -@pytest.mark.buildconfigspec('sysreset') -def test_reset(u_boot_console): - """Test that the "reset" command exits sandbox process.""" +@pytest.mark.buildconfigspec('sysreset_cmd_poweroff') +def test_poweroff(u_boot_console): + """Test that the "poweroff" command exits sandbox process.""" - u_boot_console.run_command('reset', wait_for_prompt=False) + u_boot_console.run_command('poweroff', wait_for_prompt=False) assert(u_boot_console.validate_exited()) @pytest.mark.boardspec('sandbox') -- cgit v1.1 From bf896a2f5a8c106c42186ed0a2bb4d2b2d9c6c58 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Tue, 27 Oct 2020 20:29:26 +0100 Subject: test: adjust sysreset tests As we have a working COLD_RESET on the sandbox the sysreset test has to be adjusted. Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- test/dm/sysreset.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/dm/sysreset.c b/test/dm/sysreset.c index aec97b1..691683c 100644 --- a/test/dm/sysreset.c +++ b/test/dm/sysreset.c @@ -37,7 +37,9 @@ static int dm_test_sysreset_base(struct unit_test_state *uts) /* Device 2 is the cold sysreset device */ ut_assertok(uclass_get_device(UCLASS_SYSRESET, 2, &dev)); ut_asserteq(-ENOSYS, sysreset_request(dev, SYSRESET_WARM)); + state->sysreset_allowed[SYSRESET_COLD] = false; ut_asserteq(-EACCES, sysreset_request(dev, SYSRESET_COLD)); + state->sysreset_allowed[SYSRESET_COLD] = true; state->sysreset_allowed[SYSRESET_POWER] = false; ut_asserteq(-EACCES, sysreset_request(dev, SYSRESET_POWER)); state->sysreset_allowed[SYSRESET_POWER] = true; @@ -71,22 +73,25 @@ static int dm_test_sysreset_walk(struct unit_test_state *uts) struct sandbox_state *state = state_get_current(); /* If we generate a power sysreset, we will exit sandbox! */ + state->sysreset_allowed[SYSRESET_WARM] = false; + state->sysreset_allowed[SYSRESET_COLD] = false; state->sysreset_allowed[SYSRESET_POWER] = false; state->sysreset_allowed[SYSRESET_POWER_OFF] = false; ut_asserteq(-EACCES, sysreset_walk(SYSRESET_WARM)); ut_asserteq(-EACCES, sysreset_walk(SYSRESET_COLD)); ut_asserteq(-EACCES, sysreset_walk(SYSRESET_POWER)); + ut_asserteq(-EACCES, sysreset_walk(SYSRESET_POWER_OFF)); /* * Enable cold system reset - this should make cold system reset work, * plus a warm system reset should be promoted to cold, since this is * the next step along. */ - state->sysreset_allowed[SYSRESET_COLD] = true; + state->sysreset_allowed[SYSRESET_WARM] = true; ut_asserteq(-EINPROGRESS, sysreset_walk(SYSRESET_WARM)); - ut_asserteq(-EINPROGRESS, sysreset_walk(SYSRESET_COLD)); + ut_asserteq(-EACCES, sysreset_walk(SYSRESET_COLD)); ut_asserteq(-EACCES, sysreset_walk(SYSRESET_POWER)); - state->sysreset_allowed[SYSRESET_COLD] = false; + state->sysreset_allowed[SYSRESET_COLD] = true; state->sysreset_allowed[SYSRESET_POWER] = true; return 0; -- cgit v1.1 From c961b1b594df3a9099afb425d46e820e07dfc315 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sat, 31 Oct 2020 08:38:06 +0100 Subject: test: test/bloblist.c depends on asm/state.h Building test/bloblist.c fails for non sandbox devices: test/bloblist.c:10:10: fatal error: asm/state.h: No such file or directory #include ^~~~~~~~~~~~~ Build the test only on the sandbox. Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- test/Makefile | 2 ++ 1 file changed, 2 insertions(+) (limited to 'test') diff --git a/test/Makefile b/test/Makefile index 1c930b3..39ae04a 100644 --- a/test/Makefile +++ b/test/Makefile @@ -2,7 +2,9 @@ # # (C) Copyright 2012 The Chromium Authors +ifneq ($(CONFIG_SANDBOX),) obj-$(CONFIG_$(SPL_)CMDLINE) += bloblist.o +endif obj-$(CONFIG_$(SPL_)CMDLINE) += cmd/ obj-$(CONFIG_$(SPL_)CMDLINE) += cmd_ut.o obj-$(CONFIG_$(SPL_)CMDLINE) += command_ut.o -- cgit v1.1 From de429d7b0962a91f91bbe921600745fb4608ece0 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sat, 31 Oct 2020 08:59:25 +0100 Subject: test: linking test/compression.c fails Building U-Boot with unit tests on a non-sandbox systems fails: ld.bfd: test/built-in.o: in function `compress_using_gzip': test/compression.c:138: undefined reference to `gzip' ld.bfd: test/built-in.o: in function `uncompress_using_bzip2': test/compression.c:187: undefined reference to `BZ2_bzBuffToBuffDecompress' ld.bfd: test/built-in.o: in function `uncompress_using_lzma': test/compression.c:222: undefined reference to `lzmaBuffToBuffDecompress' ld.bfd: test/built-in.o: in function `uncompress_using_lzo': test/compression.c:257: undefined reference to `lzop_decompress' ld.bfd: test/built-in.o: in function `uncompress_using_lz4': test/compression.c:292: undefined reference to `ulz4fn Add the missing dependencies. Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- test/Kconfig | 9 +++++++++ test/Makefile | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/Kconfig b/test/Kconfig index 2646e7d..ab3ac54 100644 --- a/test/Kconfig +++ b/test/Kconfig @@ -50,6 +50,15 @@ config UT_LIB_RSA endif +config UT_COMPRESSION + bool "Unit test for compression" + depends on UNIT_TEST + depends on CMDLINE && GZIP_COMPRESSED && BZIP2 && LZMA && LZO && LZ4 + default y + help + Enables tests for compression and decompression routines for simple + sanity and for buffer overflow conditions. + config UT_LOG bool "Unit tests for logging functions" depends on UNIT_TEST diff --git a/test/Makefile b/test/Makefile index 39ae04a..8296734 100644 --- a/test/Makefile +++ b/test/Makefile @@ -8,7 +8,7 @@ endif obj-$(CONFIG_$(SPL_)CMDLINE) += cmd/ obj-$(CONFIG_$(SPL_)CMDLINE) += cmd_ut.o obj-$(CONFIG_$(SPL_)CMDLINE) += command_ut.o -obj-$(CONFIG_$(SPL_)CMDLINE) += compression.o +obj-$(CONFIG_$(SPL_)UT_COMPRESSION) += compression.o obj-y += dm/ obj-$(CONFIG_$(SPL_)CMDLINE) += print_ut.o obj-$(CONFIG_$(SPL_)CMDLINE) += str_ut.o -- cgit v1.1