selftest.h 549 B

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