Skip to content

Commit bb8704a

Browse files
committed
tests: ztest: pass csf to ztest_post_fatal_error_hook()
`ztest_post_fatal_error_hook()` now accepts an additional `struct arch_csf *pCsf` argument. Signed-off-by: Yong Cong Sin <[email protected]> Signed-off-by: Yong Cong Sin <[email protected]>
1 parent 3d5f38f commit bb8704a

File tree

5 files changed

+19
-5
lines changed

5 files changed

+19
-5
lines changed

doc/releases/migration-guide-4.0.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,11 @@ Modem
251251
Shell
252252
=====
253253

254+
Ztest
255+
=====
256+
257+
* ``ztest_post_fatal_error_hook`` now accepts an additional ``struct arch_csf *pCsf``.
258+
254259
* ``kernel threads`` and ``kernel stacks`` shell command have been renamed to
255260
``kernel thread list`` & ``kernel thread stacks``
256261

subsys/testsuite/ztest/include/zephyr/ztest_error_hook.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ __syscall void ztest_set_fault_valid(bool valid);
3838
* By default, it will do nothing before leaving error handler.
3939
*/
4040
void ztest_post_fatal_error_hook(unsigned int reason,
41-
const struct arch_esf *pEsf);
41+
const struct arch_esf *pEsf, const struct arch_csf *pCsf);
4242

4343
#endif
4444

subsys/testsuite/ztest/src/ztest_error_hook.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,11 @@ static inline void z_vrfy_ztest_set_fault_valid(bool valid)
4242
#endif
4343

4444
__weak void ztest_post_fatal_error_hook(unsigned int reason,
45-
const struct arch_esf *pEsf)
45+
const struct arch_esf *pEsf, const struct arch_csf *pCsf)
4646
{
47+
ARG_UNUSED(reason);
48+
ARG_UNUSED(pEsf);
49+
ARG_UNUSED(pCsf);
4750
}
4851

4952
void k_sys_fatal_error_handler(unsigned int reason, const struct arch_esf *pEsf,
@@ -61,7 +64,7 @@ void k_sys_fatal_error_handler(unsigned int reason, const struct arch_esf *pEsf,
6164
reset_stored_fault_status();
6265

6366
/* do some action after expected fatal error happened */
64-
ztest_post_fatal_error_hook(reason, pEsf);
67+
ztest_post_fatal_error_hook(reason, pEsf, pCsf);
6568
} else {
6669
printk("Fatal error was unexpected, aborting...\n");
6770
k_fatal_halt(reason);

tests/kernel/mutex/mutex_error_case/src/test_mutex_error.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,12 @@ extern struct k_sem offload_sem;
3838

3939
/* A call back function which is hooked in default assert handler. */
4040
void ztest_post_fatal_error_hook(unsigned int reason,
41-
const struct arch_esf *pEsf)
41+
const struct arch_esf *pEsf, const struct arch_csf *pCsf)
4242

4343
{
44+
ARG_UNUSED(pEsf);
45+
ARG_UNUSED(pCsf);
46+
4447
/* check if expected error */
4548
zassert_equal(reason, K_ERR_KERNEL_OOPS);
4649
}

tests/ztest/error_hook/src/main.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,11 @@ static void release_offload_sem(void)
154154
* default one.
155155
*/
156156
void ztest_post_fatal_error_hook(unsigned int reason,
157-
const struct arch_esf *pEsf)
157+
const struct arch_esf *pEsf, const struct arch_csf *pCsf)
158158
{
159+
ARG_UNUSED(pEsf);
160+
ARG_UNUSED(pCsf);
161+
159162
switch (case_type) {
160163
case ZTEST_CATCH_FATAL_ACCESS:
161164
case ZTEST_CATCH_FATAL_ILLEAGAL_INSTRUCTION:

0 commit comments

Comments
 (0)