Zephyr API Documentation  3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
ztest_error_hook.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020 Intel Corporation
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef ZEPHYR_INCLUDE_ZTEST_FATAL_HOOK_H_
8#define ZEPHYR_INCLUDE_ZTEST_FATAL_HOOK_H_
9
10#include <zephyr/kernel.h>
11
12#ifdef __cplusplus
13extern "C" {
14#endif
15
16#if defined(CONFIG_ZTEST_FATAL_HOOK)
27__syscall void ztest_set_fault_valid(bool valid);
28
29/* @brief A hook after fatal error handler
30 *
31 * @details This is a test case hook that can run code from test case, in
32 * order to deal with some special case when catching the expected fatal
33 * error.
34 *
35 * Usage: Define your own hook function in your test case code, and do what
36 * you want to do after fatal error handler.
37 *
38 * By default, it will do nothing before leaving error handler.
39 */
40void ztest_post_fatal_error_hook(unsigned int reason,
41 const z_arch_esf_t *pEsf);
42
43#endif
44
45
46#if defined(CONFIG_ZTEST_ASSERT_HOOK)
57__syscall void ztest_set_assert_valid(bool valid);
58
59/* @brief A hook after assert fault handler
60 *
61 * @details This is a test case hook that can run code from test case, in
62 * order to deal with some special case when catching the expected assert
63 * failed.
64 *
65 * Usage: Define your own hook function in your test case code, and do what
66 * you want to do after assert handler.
67 *
68 * By default, it will abort the thread which assert failed.
69 */
70void ztest_post_assert_fail_hook(void);
71
72#endif
73
74#ifdef __cplusplus
75}
76#endif
77
78#if defined(CONFIG_ZTEST_FATAL_HOOK) || defined(CONFIG_ZTEST_ASSERT_HOOK)
79#include <syscalls/ztest_error_hook.h>
80#endif
81
82#endif /* ZEPHYR_INCLUDE_ZTEST_FATAL_HOOK_H_ */
Public kernel APIs.