]>
git.saurik.com Git - apple/xnu.git/blob - bsd/kern/kern_tests.c
1 /***************************************************************
2 * Test Declarations Go Here *
3 ***************************************************************/
4 #include <pexpert/pexpert.h>
5 #include <sys/sysctl.h>
6 #include <kern/debug.h>
7 #include <sys/kern_tests.h>
9 /***************************************************************
10 * End Test Declarations *
11 ***************************************************************/
12 typedef int (*xnu_test_func_t
)(void);
14 typedef struct xnu_test
{
15 xnu_test_func_t t_func
;
19 #define DEFINE_XNU_TEST(func) { func, #func }
21 xnu_test_t xnu_tests
[] = {
24 #define NUM_XNU_TESTS (sizeof(xnu_tests) / sizeof(xnu_test_t))
28 (struct sysctl_oid
*oidp
, __unused
void *arg1
, __unused
int arg2
, struct sysctl_req
*req
)
33 for (i
= 0; i
< NUM_XNU_TESTS
; i
++) {
34 result
= xnu_tests
[i
].t_func();
36 kprintf("xnu_tests: %s passed.\n", xnu_tests
[i
].t_name
);
38 panic("xnu_tests: %s failed.\n", xnu_tests
[i
].t_name
);
42 return sysctl_handle_int(oidp
, NULL
, 0, req
);
45 SYSCTL_PROC(_kern
, OID_AUTO
, kern_tests
,
46 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
47 0, 0, run_xnu_tests
, "I", "");