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