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:02:56 +0000 |
commit | 05c5700a6b6c76efc34506c2f254ccad5b5b5660 (patch) | |
tree | 6bfa0949c4999bec8a548ba20966e8aef7ca0060 /zephyr/test/drivers/default/src/console_cmd/hostevent.c | |
parent | 04ed1e6f6d128043e442b3155fc57171ab8b6c40 (diff) | |
download | chrome-ec-05c5700a6b6c76efc34506c2f254ccad5b5b5660.tar.gz |
zephyr test: test hostevent console command
Test the "hostevent" command with no arguments.
BUG=b:236074810
BRANCH=none
TEST=./twister -T zephyr/test/drivers
Signed-off-by: Keith Short <keithshort@chromium.org>
Change-Id: Ie8f3e67c4039a78d697ce326f17b3212da477855
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3862146
Reviewed-by: Al Semjonovs <asemjonovs@google.com>
Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
Diffstat (limited to 'zephyr/test/drivers/default/src/console_cmd/hostevent.c')
-rw-r--r-- | zephyr/test/drivers/default/src/console_cmd/hostevent.c | 49 |
1 files changed, 49 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 new file mode 100644 index 0000000000..f8da417cc0 --- /dev/null +++ b/zephyr/test/drivers/default/src/console_cmd/hostevent.c @@ -0,0 +1,49 @@ +/* Copyright 2022 The ChromiumOS Authors. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include <zephyr/shell/shell.h> +#include <zephyr/ztest.h> + +#include "console.h" +#include "ec_commands.h" +#include "include/lpc.h" +#include "test/drivers/test_state.h" +#include "test/drivers/utils.h" + +struct console_cmd_hostevent_fixture { + struct host_events_ctx ctx; +}; + +static void *console_cmd_hostevent_setup(void) +{ + static struct console_cmd_hostevent_fixture fixture = { 0 }; + + return &fixture; +} + +static void console_cmd_hostevent_before(void *fixture) +{ + struct console_cmd_hostevent_fixture *f = fixture; + + host_events_save(&f->ctx); +} + +static void console_cmd_hostevent_after(void *fixture) +{ + struct console_cmd_hostevent_fixture *f = fixture; + + host_events_restore(&f->ctx); +} + +/* hostevent with no arguments */ +ZTEST_USER(console_cmd_hostevent, test_hostevent) +{ + zassert_ok(shell_execute_cmd(get_ec_shell(), "hostevent"), + "Failed default print"); +} + +ZTEST_SUITE(console_cmd_hostevent, drivers_predicate_post_main, + console_cmd_hostevent_setup, console_cmd_hostevent_before, + console_cmd_hostevent_after, NULL); |