1 /* 2 * This file and its contents are supplied under the terms of the 3 * Common Development and Distribution License ("CDDL"), version 1.0. 4 * You may only use this file in accordance with the terms of version 5 * 1.0 of the CDDL. 6 * 7 * A full copy of the text of the CDDL should have accompanied this 8 * source. A copy of the CDDL is also available via the Internet at 9 * http://www.illumos.org/license/CDDL. 10 */ 11 12 /* 13 * Copyright 2023 Oxide Computer Company 14 */ 15 16 /* 17 * This file contains the private implementation details of the ktest 18 * facility -- which is limited strictly to the kernel. Neither 19 * userspace nor ktest modules should include this file or rely on any 20 * definitions herein. Rather, userspace programs and ktest modules 21 * should include sys/ktest.h for access to the appropriate APIs. 22 */ 23 #ifndef _SYS_KTEST_IMPL_H 24 #define _SYS_KTEST_IMPL_H 25 26 #include <sys/ktest.h> 27 #include <sys/list.h> 28 #include <sys/types.h> 29 30 #ifdef __cplusplus 31 extern "C" { 32 #endif 33 34 #ifdef _KERNEL 35 36 typedef struct ktest_module { 37 list_node_t km_node; 38 char km_name[KTEST_MAX_NAME_LEN]; 39 uint64_t km_num_suites; 40 uint64_t km_num_tests; 41 list_t km_suites; 42 } ktest_module_t; 43 44 typedef struct ktest_suite { 45 list_node_t ks_node; 46 ktest_module_t *ks_module; 47 char ks_name[KTEST_MAX_NAME_LEN]; 48 uint64_t ks_num_tests; 49 list_t ks_tests; 50 } ktest_suite_t; 51 52 typedef struct ktest_test { 53 list_node_t kt_node; 54 ktest_suite_t *kt_suite; 55 char kt_name[KTEST_MAX_NAME_LEN]; 56 ktest_fn_t kt_fn; 57 boolean_t kt_requires_input; 58 } ktest_test_t; 59 60 typedef struct ktest_ctx { 61 const ktest_test_t *ktc_test; 62 ktest_result_t *ktc_res; 63 uchar_t *ktc_input; 64 uint64_t ktc_input_len; 65 } ktest_ctx_t; 66 67 #endif /* _KERNEL */ 68 69 #ifdef __cplusplus 70 } 71 #endif 72 73 #endif /* _SYS_KTEST_IMPL_H */ 74