18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: MIT 28c2ecf20Sopenharmony_ci 38c2ecf20Sopenharmony_ci/* 48c2ecf20Sopenharmony_ci * Copyright © 2019 Intel Corporation 58c2ecf20Sopenharmony_ci */ 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci#ifndef __SELFTEST_H__ 88c2ecf20Sopenharmony_ci#define __SELFTEST_H__ 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci#include <linux/compiler.h> 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci#define selftest(name, func) int func(void); 138c2ecf20Sopenharmony_ci#include "selftests.h" 148c2ecf20Sopenharmony_ci#undef selftest 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_cistruct subtest { 178c2ecf20Sopenharmony_ci int (*func)(void *data); 188c2ecf20Sopenharmony_ci const char *name; 198c2ecf20Sopenharmony_ci}; 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_ciint __subtests(const char *caller, 228c2ecf20Sopenharmony_ci const struct subtest *st, 238c2ecf20Sopenharmony_ci int count, 248c2ecf20Sopenharmony_ci void *data); 258c2ecf20Sopenharmony_ci#define subtests(T, data) \ 268c2ecf20Sopenharmony_ci __subtests(__func__, T, ARRAY_SIZE(T), data) 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_ci#define SUBTEST(x) { x, #x } 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_ci#endif /* __SELFTEST_H__ */ 31