| 1 |
// SPDX-License-Identifier: MIT |
| 2 |
|
| 3 |
/* |
| 4 |
* Copyright © 2019 Intel Corporation |
| 5 |
*/ |
| 6 |
|
| 7 |
#ifndef __SELFTEST_H__ |
| 8 |
#define __SELFTEST_H__ |
| 9 |
|
| 10 |
#include <linux/compiler.h> |
| 11 |
|
| 12 |
#define selftest(name, func) int func(void); |
| 13 |
#include "selftests.h" |
| 14 |
#undef selftest |
| 15 |
|
| 16 |
struct subtest { |
| 17 |
int (*func)(void *data); |
| 18 |
const char *name; |
| 19 |
}; |
| 20 |
|
| 21 |
int __subtests(const char *caller, |
| 22 |
const struct subtest *st, |
| 23 |
int count, |
| 24 |
void *data); |
| 25 |
#define subtests(T, data) \ |
| 26 |
__subtests(__func__, T, ARRAY_SIZE(T), data) |
| 27 |
|
| 28 |
#define SUBTEST(x) { x, #x } |
| 29 |
|
| 30 |
#endif /* __SELFTEST_H__ */ |