Repository navigation
Expand file tree
/
Copy pathboot_test.h
More file actions
67 lines (58 loc) · 1.43 KB
/
Copy pathboot_test.h
File metadata and controls
67 lines (58 loc) · 1.43 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
56
57
58
59
60
61
62
63
64
65
66
67
/* 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);
/**
* ZTEST_SUITE() predicate for standalone test suites that run themselves
* from a SYS_INIT hook with ztest_run_test_suite(). That call does not
* check the predicate, but ztest_run_all() in sof_run_boot_tests() does,
* so the suite is not run a second time.
*/
static inline bool sof_boot_test_standalone_predicate(const void *state)
{
(void)state;
return false;
}
/**
* 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