summaryrefslogtreecommitdiff
path: root/test/chipset.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/chipset.c')
-rw-r--r--test/chipset.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/chipset.c b/test/chipset.c
new file mode 100644
index 0000000000..6c9031e3f0
--- /dev/null
+++ b/test/chipset.c
@@ -0,0 +1,32 @@
+/* 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.
+ *
+ * Test chipset
+ */
+
+#define CONFIG_CMD_AP_RESET_LOG
+
+#include "chipset.h"
+#include "test_util.h"
+
+static int test_get_shutdown_reason(void)
+{
+ enum chipset_shutdown_reason reason = chipset_get_shutdown_reason();
+
+ TEST_ASSERT(reason == 0);
+ report_ap_reset(CHIPSET_SHUTDOWN_POWERFAIL);
+ reason = chipset_get_shutdown_reason();
+ TEST_ASSERT(reason == CHIPSET_SHUTDOWN_POWERFAIL);
+
+ return EC_SUCCESS;
+}
+
+void run_test(int argc, const char **argv)
+{
+ test_reset();
+
+ RUN_TEST(test_get_shutdown_reason);
+
+ test_print_result();
+}