forked from thesofproject/sof
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathboot_test.h
More file actions
55 lines (47 loc) · 1.07 KB
/
Copy pathboot_test.h
File metadata and controls
55 lines (47 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright(c) 2023 Intel Corporation. All rights reserved.
*/
#ifndef __SOF_BOOT_TEST_H__
#define __SOF_BOOT_TEST_H__
#if !CONFIG_LIBRARY
#include <zephyr/logging/log.h>
#else
#define LOG_ERR(...) do {} while (0)
#endif
#include <stdbool.h>
struct k_thread;
#if CONFIG_SOF_BOOT_TEST
#define TEST_RUN_ONCE(fn, ...) do { \
static bool once; \
if (!once) { \
once = true; \
fn(__VA_ARGS__); \
} \
} while (0)
#else
#define TEST_RUN_ONCE(fn, ...) do {} while (0)
#endif
#define TEST_CHECK_RET(ret, testname) do { \
if ((ret) < 0) { \
LOG_ERR(testname " failed: %d", (ret)); \
ztest_test_fail(); \
} else { \
ztest_test_pass(); \
} \
} while (0)
void sof_run_boot_tests(void);
/**
* Mark a boot-test thread as expected to trigger a fatal error.
*
* @param thread Thread that is allowed to fault once, or NULL to clear.
*/
#if CONFIG_SOF_BOOT_TEST
void sof_boot_test_set_fault_valid(struct k_thread *thread);
#else
static inline void sof_boot_test_set_fault_valid(struct k_thread *thread)
{
(void)thread;
}
#endif
#endif