diff options
author | Aaron Massey <aaronmassey@google.com> | 2022-07-19 15:05:02 -0600 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-08-02 22:37:19 +0000 |
commit | b62394fb4444883dd7bb2ff9a162ebff55d3ce8f (patch) | |
tree | 1f1830c6de90fe0ca3464faa1bec9be0539262e2 | |
parent | 26b6be150d0a4e691e4b66e94018cb2e660dd1d8 (diff) | |
download | chrome-ec-b62394fb4444883dd7bb2ff9a162ebff55d3ce8f.tar.gz |
test: EC_CMD_GPIO_GET version 0 host command
Test happy-path coverage on the EC_CMD_GPIO_GET version 0 host command.
BRANCH=none
BUG=b:239608056
TEST=zmake test test-drivers
Signed-off-by: Aaron Massey <aaronmassey@google.com>
Change-Id: Ia0be87104e70988107c0310d3d1ac69a96d35b27
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3780764
Reviewed-by: Keith Short <keithshort@chromium.org>
-rw-r--r-- | zephyr/test/drivers/default/src/espi.c | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/zephyr/test/drivers/default/src/espi.c b/zephyr/test/drivers/default/src/espi.c index f0e7a1e9e3..603605a6b0 100644 --- a/zephyr/test/drivers/default/src/espi.c +++ b/zephyr/test/drivers/default/src/espi.c @@ -4,11 +4,12 @@ */ #include <zephyr/zephyr.h> -#include <ztest.h> +#include <zephyr/ztest.h> #include "ec_commands.h" #include "host_command.h" #include "test/drivers/test_state.h" +#include "test/drivers/utils.h" #define PORT 0 @@ -75,4 +76,32 @@ ZTEST_USER(espi, test_host_command_usb_pd_get_amode) zassert_equal(args.response_size, sizeof(response.svid), NULL); } +ZTEST_USER(espi, test_host_command_gpio_get_v0) +{ + struct ec_params_gpio_get p = { + /* Checking for AC enabled */ + .name = "acok_od", + }; + struct ec_response_gpio_get response; + + struct host_cmd_handler_args args = + BUILD_HOST_COMMAND(EC_CMD_GPIO_GET, 0, response, p); + + /* Test true */ + set_ac_enabled(true); + + zassert_ok(host_command_process(&args), NULL); + zassert_ok(args.result, NULL); + zassert_equal(args.response_size, sizeof(response), NULL); + zassert_true(response.val, NULL); + + /* Test false */ + set_ac_enabled(false); + + zassert_ok(host_command_process(&args), NULL); + zassert_ok(args.result, NULL); + zassert_equal(args.response_size, sizeof(response), NULL); + zassert_false(response.val, NULL); +} + ZTEST_SUITE(espi, drivers_predicate_post_main, NULL, NULL, NULL, NULL); |