From 1e06a1ebefb93a37086807c11206ffde9ee614f0 Mon Sep 17 00:00:00 2001 From: Keith Short Date: Mon, 22 Aug 2022 11:48:49 -0600 Subject: 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 Change-Id: I00ee895d6341b7af7378268bc64c60d422a672c2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3862147 Code-Coverage: Zoss Reviewed-by: Fabio Baltieri --- zephyr/test/drivers/default/src/console_cmd/hostevent.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'zephyr') 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); -- cgit v1.2.1