summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2020-11-06 11:27:14 -0500
committerTom Rini <trini@konsulko.com>2020-11-06 11:27:14 -0500
commit22ad69b7987eb4b10221330661db4427e40174fb (patch)
treeb13bc4ba708907cd76a0ec09c4599b55cb586953 /test
parent896cc5aa4a8fc0c28036b9615a37f0034addad44 (diff)
parentdc4b2a9770b5b932cd6d98c33ebff6dc46de6849 (diff)
Merge tag 'dm-pull5nov20' of git://git.denx.de/u-boot-dm
patman status subcommand to collect tags from Patchwork patman showing email replies from Patchwork sandbox poweroff command minor fixes in binman, tests
Diffstat (limited to 'test')
-rw-r--r--test/Kconfig9
-rw-r--r--test/Makefile4
-rw-r--r--test/dm/sysreset.c11
-rw-r--r--test/py/tests/test_sandbox_exit.py8
4 files changed, 24 insertions, 8 deletions
diff --git a/test/Kconfig b/test/Kconfig
index 2646e7d825..ab3ac54a1b 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 1c930b3148..8296734eb3 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -2,11 +2,13 @@
#
# (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
-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
diff --git a/test/dm/sysreset.c b/test/dm/sysreset.c
index aec97b1cbb..691683c567 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;
diff --git a/test/py/tests/test_sandbox_exit.py b/test/py/tests/test_sandbox_exit.py
index a301f4b559..2d242ae0f6 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')