diff options
author | Keith Short <keithshort@chromium.org> | 2022-08-22 11:48:49 -0600 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-09-02 22:03:01 +0000 |
commit | 1e06a1ebefb93a37086807c11206ffde9ee614f0 (patch) | |
tree | c76ccac61941c58d0262d6dc1d6018bf62a88a7a | |
parent | 05c5700a6b6c76efc34506c2f254ccad5b5b5660 (diff) | |
download | chrome-ec-1e06a1ebefb93a37086807c11206ffde9ee614f0.tar.gz |
zephyr test: hostevent console with invalid arguments
Test the "hostevent" command with invalid arguments.
BUG=b:236074810
BRANCH=none
TEST=./twister -T zephyr/test/drivers
Signed-off-by: Keith Short <keithshort@chromium.org>
Change-Id: I00ee895d6341b7af7378268bc64c60d422a672c2
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3862147
Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com>
-rw-r--r-- | zephyr/test/drivers/default/src/console_cmd/hostevent.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/zephyr/test/drivers/default/src/console_cmd/hostevent.c b/zephyr/test/drivers/default/src/console_cmd/hostevent.c index f8da417cc0..bcce2ff568 100644 --- a/zephyr/test/drivers/default/src/console_cmd/hostevent.c +++ b/zephyr/test/drivers/default/src/console_cmd/hostevent.c @@ -44,6 +44,22 @@ ZTEST_USER(console_cmd_hostevent, test_hostevent) "Failed default print"); } +/* hostevent with invalid arguments */ +ZTEST_USER(console_cmd_hostevent, test_hostevent_invalid) +{ + int rv; + + /* Test invalid sub-command */ + rv = shell_execute_cmd(get_ec_shell(), "hostevent invalid 0xFFFF"); + zassert_equal(rv, EC_ERROR_PARAM1, "Expected %d, but got %d", + EC_ERROR_PARAM1, rv); + + /* Test invalid mask */ + rv = shell_execute_cmd(get_ec_shell(), "hostevent set invalid-mask"); + zassert_equal(rv, EC_ERROR_PARAM2, "Expected %d, but got %d", + EC_ERROR_PARAM2, rv); +} + ZTEST_SUITE(console_cmd_hostevent, drivers_predicate_post_main, console_cmd_hostevent_setup, console_cmd_hostevent_before, console_cmd_hostevent_after, NULL); |