diff options
author | Jeremy Bettis <jbettis@google.com> | 2022-03-22 16:49:37 -0600 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-03-23 20:17:18 +0000 |
commit | 4ea3e478f43ccd3eb9efe3b565989ce969738ceb (patch) | |
tree | ae4869e80fb72126e5ceeee14ed6a15d64c8dad3 | |
parent | a308e0d074dd5800df39e16b1643f6e1bbb56308 (diff) | |
download | chrome-ec-4ea3e478f43ccd3eb9efe3b565989ce969738ceb.tar.gz |
zephyr: Add trivial test of vboot_hash
This only tests the host command EC_VBOOT_HASH_START, which doesn't
really do anything, but it is a stub for the next person to add more
test cases.
BRANCH=None
BUG=b:214256453
TEST=zmake test -a
Signed-off-by: Jeremy Bettis <jbettis@google.com>
Change-Id: Icdde811128b66c610eaa37b16d4626728273d287
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3543484
Tested-by: Jeremy Bettis <jbettis@chromium.org>
Auto-Submit: Jeremy Bettis <jbettis@chromium.org>
Reviewed-by: Aaron Massey <aaronmassey@google.com>
Commit-Queue: Jeremy Bettis <jbettis@chromium.org>
-rw-r--r-- | zephyr/test/drivers/CMakeLists.txt | 1 | ||||
-rw-r--r-- | zephyr/test/drivers/prj.conf | 1 | ||||
-rw-r--r-- | zephyr/test/drivers/src/vboot_hash.c | 32 |
3 files changed, 34 insertions, 0 deletions
diff --git a/zephyr/test/drivers/CMakeLists.txt b/zephyr/test/drivers/CMakeLists.txt index b2718ca08c..efcdf1f300 100644 --- a/zephyr/test/drivers/CMakeLists.txt +++ b/zephyr/test/drivers/CMakeLists.txt @@ -55,5 +55,6 @@ target_sources(app PRIVATE src/usb_mux.c src/usb_pd_host_cmd.c src/utils.c + src/vboot_hash.c src/watchdog.c ) diff --git a/zephyr/test/drivers/prj.conf b/zephyr/test/drivers/prj.conf index aa156388ab..8aea6c09c4 100644 --- a/zephyr/test/drivers/prj.conf +++ b/zephyr/test/drivers/prj.conf @@ -156,3 +156,4 @@ CONFIG_EMUL_KB_RAW=y CONFIG_EMUL_CROS_FLASH=y CONFIG_FLASH_SIMULATOR=y CONFIG_FLASH=y +CONFIG_PLATFORM_EC_VBOOT_HASH=y diff --git a/zephyr/test/drivers/src/vboot_hash.c b/zephyr/test/drivers/src/vboot_hash.c new file mode 100644 index 0000000000..841893c61b --- /dev/null +++ b/zephyr/test/drivers/src/vboot_hash.c @@ -0,0 +1,32 @@ +/* Copyright 2022 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include <zephyr.h> +#include <ztest.h> +#include <sha256.h> + +#include "ec_commands.h" +#include "host_command.h" +#include "test_state.h" + +ZTEST_USER(vboot_hash, test_hostcmd) +{ + struct ec_params_vboot_hash params = { + .cmd = EC_VBOOT_HASH_START, + .offset = 0, + .size = 0, + }; + struct ec_response_vboot_hash response; + struct host_cmd_handler_args args = + BUILD_HOST_COMMAND(EC_CMD_VBOOT_HASH, 0, response, params); + + zassert_ok(host_command_process(&args), NULL); + zassert_ok(args.result, NULL); + zassert_equal(args.response_size, sizeof(response), NULL); + zassert_equal(response.status, EC_VBOOT_HASH_STATUS_BUSY, + "response.status = %d", response.status); +} + +ZTEST_SUITE(vboot_hash, drivers_predicate_post_main, NULL, NULL, NULL, NULL); |