]> git.saurik.com Git - apple/xnu.git/blob - osfmk/tests/ktest_internal.h
fbe4147e71e098944bd3a97a912066eccbcfa195
[apple/xnu.git] / osfmk / tests / ktest_internal.h
1 /*
2 * Copyright (c) 2015 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28
29 #ifndef _TESTS_KTEST_INTERNAL_H
30 #define _TESTS_KTEST_INTERNAL_H
31
32 #include <tests/ktest.h>
33 #include <stdint.h>
34
35 #define KTEST_VERSION 1
36 #define KTEST_VERSION_STR T_TOSTRING(KTEST_VERSION)
37
38 #define KTEST_MAXLEN 1024
39 #define KTEST_MAXOUTLEN 4096
40 #define KTEST_MAXVARS 3
41
42 #define KTEST_NUM_TESTCASE_MODES 2
43 #define KTEST_NUM_TESTCASE_STATES 4
44 #define KTEST_NUM_TEST_STATES 4
45
46 extern unsigned int ktest_current_line;
47 extern const char * ktest_current_file;
48 extern const char * ktest_current_func;
49 extern uint64_t ktest_current_time;
50
51 extern const char * ktest_test_name;
52
53 extern char ktest_current_msg[KTEST_MAXLEN];
54 extern char ktest_current_expr[KTEST_MAXOUTLEN];
55 extern char ktest_current_var_names[KTEST_MAXVARS][KTEST_MAXLEN];
56 extern char ktest_current_var_values[KTEST_MAXVARS][KTEST_MAXLEN];
57 extern unsigned int ktest_expression_index;
58 extern unsigned int ktest_current_var_index;
59 extern unsigned int ktest_test_index;
60 extern unsigned int ktest_passcount;
61 extern unsigned int ktest_failcount;
62 extern unsigned int ktest_xpasscount;
63 extern unsigned int ktest_xfailcount;
64 extern int ktest_expectfail;
65
66 extern int ktest_testcase_result;
67 extern int ktest_test_result;
68 extern int ktest_testcase_mode;
69
70 extern ktest_temp ktest_temp1, ktest_temp2, ktest_temp3;
71
72 extern char ktest_output_buf[KTEST_MAXLEN];
73
74 extern int ktest_test_result_statetab[KTEST_NUM_TEST_STATES]
75 [KTEST_NUM_TESTCASE_STATES]
76 [KTEST_NUM_TESTCASE_MODES];
77
78 extern const char * ktest_testcase_result_tokens[KTEST_NUM_TESTCASE_MODES]
79 [KTEST_NUM_TESTCASE_STATES];
80
81
82 void ktest_emit_start(void);
83 void ktest_emit_finish(void);
84 void ktest_emit_testbegin(const char * test_name);
85 void ktest_emit_testskip(const char * skip_msg, va_list args);
86 void ktest_emit_testend(void);
87 void ktest_emit_log(const char * log_msg, va_list args);
88 void ktest_emit_perfdata(const char * metric, const char * unit, double value, const char * desc);
89 void ktest_emit_testcase(void);
90
91 #endif /* _TESTS_KTEST_INTERNAL_H */