summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAl Semjonovs <asemjonovs@google.com>2022-10-11 15:22:50 -0600
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-10-12 02:10:57 +0000
commit9b112272813c9e87440cece62e31ef9bab984b2f (patch)
tree91fa3e0a3ce4bbf9070d7314c301269039082c45
parent4ab534c3ce1cfda9153e1fa488f5476b1ab62a5d (diff)
downloadchrome-ec-9b112272813c9e87440cece62e31ef9bab984b2f.tar.gz
zephyr: Test ec_feature 'feat' console command
Validate 'feat' console command output BUG=None BRANCH=NONE TEST=./twister -T zephyr/test Signed-off-by: Al Semjonovs <asemjonovs@google.com> Change-Id: If8c5c102e3e1da6b8f0ce284a674e61ea88fe16c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3947528 Reviewed-by: Simon Glass <sjg@chromium.org> Commit-Queue: Simon Glass <sjg@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
-rw-r--r--zephyr/test/drivers/default/CMakeLists.txt1
-rw-r--r--zephyr/test/drivers/default/src/console_cmd/ec_features.c25
2 files changed, 26 insertions, 0 deletions
diff --git a/zephyr/test/drivers/default/CMakeLists.txt b/zephyr/test/drivers/default/CMakeLists.txt
index 73daf27c93..b4beea7e44 100644
--- a/zephyr/test/drivers/default/CMakeLists.txt
+++ b/zephyr/test/drivers/default/CMakeLists.txt
@@ -23,6 +23,7 @@ target_sources(app PRIVATE
src/console_cmd/button.c
src/console_cmd/crash.c
src/console_cmd/cutoff.c
+ src/console_cmd/ec_features.c
src/console_cmd/gpio.c
src/console_cmd/i2c_portmap.c
src/console_cmd/md.c
diff --git a/zephyr/test/drivers/default/src/console_cmd/ec_features.c b/zephyr/test/drivers/default/src/console_cmd/ec_features.c
new file mode 100644
index 0000000000..b33ca565bc
--- /dev/null
+++ b/zephyr/test/drivers/default/src/console_cmd/ec_features.c
@@ -0,0 +1,25 @@
+/* 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 "host_command.h"
+#include "test/drivers/test_state.h"
+#include "test/drivers/utils.h"
+
+ZTEST_SUITE(console_cmd_ec_features, drivers_predicate_post_main, NULL, NULL,
+ NULL, NULL);
+
+ZTEST_USER(console_cmd_ec_features, test_feat)
+{
+ char expected[32];
+
+ snprintf(expected, sizeof(expected), " 0-31: 0x%08x\r\n32-63: 0x%08x",
+ get_feature_flags0(), get_feature_flags1());
+
+ CHECK_CONSOLE_CMD("feat", expected, EC_SUCCESS);
+}