summaryrefslogtreecommitdiff
path: root/include/panic.h
diff options
context:
space:
mode:
authorTristan Honscheid <honscheid@google.com>2022-11-21 10:48:11 -0700
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-11-30 23:10:44 +0000
commitb6e76ee80d897db61684668978450207a7184367 (patch)
tree8d6132c5e6c2660b8c2025cca8c9663c68454e44 /include/panic.h
parentaa40b859b3a73e5a205bc561c1a29eff38485461 (diff)
downloadchrome-ec-b6e76ee80d897db61684668978450207a7184367.tar.gz
zephyr: test: Make get_panic_data_write mockable
The version of get_panic_data_write() that currently gets compiled in is controlled by an `#ifdef CONFIG_BOARD_NATIVE_POSIX` block, which means that the actual implementation used in device builds (over 30 SLOCs) is unreachable in testing, in favor of a stub that directly returns the pdata_ptr pointer. This CL removes the stub native posix version of the function and makes the real version test_mockable. Then, all test binaries that were relying on the removed stub definition are supplied with a mocked version of get_panic_data_write() that behaves the same way the stub did by returning pdata_ptr directly. This frees a new test binary to test the actual implementation. BRANCH=None BUG=None TEST=./twister Signed-off-by: Tristan Honscheid <honscheid@google.com> Change-Id: I8228acb0147b3b3843d302c272d8715d925fddd5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4052121 Commit-Queue: Aaron Massey <aaronmassey@google.com> Reviewed-by: Aaron Massey <aaronmassey@google.com> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Tested-by: Tristan Honscheid <honscheid@google.com> Auto-Submit: Tristan Honscheid <honscheid@google.com>
Diffstat (limited to 'include/panic.h')
-rw-r--r--include/panic.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/panic.h b/include/panic.h
index 25829017ea..efd3e4d86b 100644
--- a/include/panic.h
+++ b/include/panic.h
@@ -292,6 +292,15 @@ struct panic_data *panic_get_data(void);
*/
uintptr_t get_panic_data_start(void);
+#ifdef CONFIG_BOARD_NATIVE_POSIX
+/**
+ * @brief Test-only function for accessing the pdata_ptr object.
+ *
+ * @return struct panic_data* pdata_ptr
+ */
+struct panic_data *test_get_panic_data_pointer(void);
+#endif
+
/*
* Return a pointer to panic_data structure that can be safely written.
* Please note that this function can move jump data and jump tags.