summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--zephyr/test/system_common/src/system_is_locked.c31
-rw-r--r--zephyr/test/system_common/testcase.yaml9
2 files changed, 39 insertions, 1 deletions
diff --git a/zephyr/test/system_common/src/system_is_locked.c b/zephyr/test/system_common/src/system_is_locked.c
new file mode 100644
index 0000000000..2ea9f3038b
--- /dev/null
+++ b/zephyr/test/system_common/src/system_is_locked.c
@@ -0,0 +1,31 @@
+/* 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_dummy.h>
+#include <zephyr/ztest_assert.h>
+#include <zephyr/ztest_test_new.h>
+
+#include "system.h"
+
+ZTEST_USER(system_is_locked, test_syslock_console_cmd)
+{
+ /*
+ * Integration test that validates the syslock console command forces
+ * the system_is_locked command to return true
+ */
+
+ const struct shell *shell_zephyr = get_ec_shell();
+
+ shell_backend_dummy_clear_output(shell_zephyr);
+
+ zassert_false(system_is_locked());
+ /*
+ * TODO(b/249373175): Use CHECK_CONSOLE_CMD() macro
+ */
+ zassert_ok(shell_execute_cmd(shell_zephyr, "syslock"), NULL);
+ zassert_true(system_is_locked());
+}
+
+ZTEST_SUITE(system_is_locked, NULL, NULL, NULL, NULL, NULL);
diff --git a/zephyr/test/system_common/testcase.yaml b/zephyr/test/system_common/testcase.yaml
index d6977dbb6a..f30d0e52f1 100644
--- a/zephyr/test/system_common/testcase.yaml
+++ b/zephyr/test/system_common/testcase.yaml
@@ -1,4 +1,11 @@
common:
platform_allow: native_posix
tests:
- system.default: {}
+ system.default:
+ extra_configs:
+ - CONFIG_SHELL_BACKEND_DUMMY=y
+ - CONFIG_SHELL_BACKEND_DUMMY_BUF_SIZE=1000
+ - CONFIG_SHELL_BACKEND_SERIAL=n
+ tags:
+ common
+ system