Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
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.h>
11
12
13#if defined(CONFIG_ZTEST_FATAL_HOOK)
24__syscall void ztest_set_fault_valid(bool valid);
25
26/* @brief A hook after fatal error handler
27 *
28 * @details This is a test case hook that can run code from test case, in
29 * order to deal with some special case when catching the expected fatal
30 * error.
31 *
32 * Usage: Define your own hook function in your test case code, and do what
33 * you want to do after fatal error handler.
34 *
35 * By default, it will do nothing before leaving error handler.
36 */
37void ztest_post_fatal_error_hook(unsigned int reason,
38 const z_arch_esf_t *pEsf);
39
40#endif
41
42
43#if defined(CONFIG_ZTEST_ASSERT_HOOK)
54__syscall void ztest_set_assert_valid(bool valid);
55
56/* @brief A hook after assert fault handler
57 *
58 * @details This is a test case hook that can run code from test case, in
59 * order to deal with some special case when catching the expected assert
60 * failed.
61 *
62 * Usage: Define your own hook function in your test case code, and do what
63 * you want to do after assert handler.
64 *
65 * By default, it will abort the thread which assert failed.
66 */
67void ztest_post_assert_fail_hook(void);
68
69#endif
70
71#if defined(CONFIG_ZTEST_FATAL_HOOK) || defined(CONFIG_ZTEST_ASSERT_HOOK)
72#include <syscalls/ztest_error_hook.h>
73#endif
74
75#endif /* ZEPHYR_INCLUDE_ZTEST_FATAL_HOOK_H_ */
void ztest_post_fatal_error_hook(unsigned int reason, const z_arch_esf_t *pEsf)
Definition: test_mutex_error.c:40