summaryrefslogtreecommitdiff
path: root/common/chipset.c
diff options
context:
space:
mode:
authorTristan Honscheid <honscheid@google.com>2022-11-11 14:21:24 -0700
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-11-16 00:33:48 +0000
commit495bc21060631797a9ac93bc0327b1152e0748b4 (patch)
tree4ad1b83e3ca57f93837ef42b5675fdfaec991eb2 /common/chipset.c
parentd504c8cf98d76c501b0979b98954540ef4ae581b (diff)
downloadchrome-ec-495bc21060631797a9ac93bc0327b1152e0748b4.tar.gz
zephyr: test: Add test for get_ap_reset_stats() in common/chipset.c
Add tests for get_ap_reset_stats() as well as some test-only helper functions in chipset.c BRANCH=None BUG=None TEST=./twister Signed-off-by: Tristan Honscheid <honscheid@google.com> Change-Id: Iaf990727cef1e9ef4e7155ee25e423731908952c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4027084 Reviewed-by: Aaron Massey <aaronmassey@google.com> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
Diffstat (limited to 'common/chipset.c')
-rw-r--r--common/chipset.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/common/chipset.c b/common/chipset.c
index 55964e4ba9..5a699bfe25 100644
--- a/common/chipset.c
+++ b/common/chipset.c
@@ -134,3 +134,21 @@ enum chipset_shutdown_reason chipset_get_shutdown_reason(void)
}
#endif /* !CONFIG_AP_RESET_LOG */
+
+#ifdef TEST_BUILD
+uint32_t test_chipset_get_ap_resets_since_ec_boot(void)
+{
+ uint32_t count;
+
+ mutex_lock(&reset_log_mutex);
+ count = ap_resets_since_ec_boot;
+ mutex_unlock(&reset_log_mutex);
+
+ return count;
+}
+
+void test_chipset_corrupt_reset_log_checksum(void)
+{
+ reset_log_checksum = ~reset_log_checksum;
+}
+#endif /* TEST_BUILD */