]>
Commit | Line | Data |
---|---|---|
d9a64523 A |
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 | #include <tests/ktest.h> | |
30 | #include <stdint.h> | |
31 | #include <kern/misc_protos.h> | |
32 | #include <tests/ktest_internal.h> | |
33 | ||
34 | unsigned int ktest_current_line = 0; | |
35 | const char * ktest_current_file = NULL; | |
36 | const char * ktest_current_func = NULL; | |
37 | uint64_t ktest_current_time = 0; | |
38 | ||
39 | const char * ktest_test_name = ""; | |
40 | ||
41 | char ktest_current_msg[KTEST_MAXLEN] = ""; | |
42 | char ktest_current_expr[KTEST_MAXOUTLEN] = ""; | |
43 | char ktest_current_var_names[KTEST_MAXVARS][KTEST_MAXLEN] = { "", "", "" }; | |
44 | char ktest_current_var_values[KTEST_MAXVARS][KTEST_MAXLEN] = { "", "", "" }; | |
45 | unsigned int ktest_expression_index = 0; | |
46 | unsigned int ktest_current_var_index = 0; | |
47 | unsigned int ktest_test_index = 0; | |
48 | unsigned int ktest_passcount = 0; | |
49 | unsigned int ktest_failcount = 0; | |
50 | unsigned int ktest_xpasscount = 0; | |
51 | unsigned int ktest_xfailcount = 0; | |
52 | int ktest_expectfail = 0; | |
53 | int ktest_quiet = 0; | |
54 | ||
55 | int ktest_testcase_result = T_RESULT_FAIL; | |
56 | int ktest_test_result = T_STATE_UNRESOLVED; | |
57 | int ktest_testcase_mode = T_MAIN; | |
58 | ||
59 | ktest_temp ktest_temp1, ktest_temp2, ktest_temp3; | |
60 | ||
61 | char ktest_output_buf[KTEST_MAXLEN] = ""; | |
62 | ||
63 | int | |
0a7de745 A |
64 | ktest_test_result_statetab[KTEST_NUM_TEST_STATES] |
65 | [KTEST_NUM_TESTCASE_STATES] | |
66 | [KTEST_NUM_TESTCASE_MODES] = { | |
d9a64523 A |
67 | [T_STATE_UNRESOLVED][T_RESULT_PASS][T_MAIN] = T_STATE_PASS, |
68 | [T_STATE_UNRESOLVED][T_RESULT_FAIL][T_MAIN] = T_STATE_FAIL, | |
69 | [T_STATE_UNRESOLVED][T_RESULT_UXPASS][T_MAIN] = T_STATE_FAIL, | |
70 | [T_STATE_UNRESOLVED][T_RESULT_XFAIL][T_MAIN] = T_STATE_PASS, | |
71 | ||
72 | [T_STATE_PASS][T_RESULT_PASS][T_MAIN] = T_STATE_PASS, | |
73 | [T_STATE_PASS][T_RESULT_FAIL][T_MAIN] = T_STATE_FAIL, | |
74 | [T_STATE_PASS][T_RESULT_UXPASS][T_MAIN] = T_STATE_FAIL, | |
75 | [T_STATE_PASS][T_RESULT_XFAIL][T_MAIN] = T_STATE_PASS, | |
76 | ||
77 | [T_STATE_FAIL][T_RESULT_PASS][T_MAIN] = T_STATE_FAIL, | |
78 | [T_STATE_FAIL][T_RESULT_FAIL][T_MAIN] = T_STATE_FAIL, | |
79 | [T_STATE_FAIL][T_RESULT_UXPASS][T_MAIN] = T_STATE_FAIL, | |
80 | [T_STATE_FAIL][T_RESULT_XFAIL][T_MAIN] = T_STATE_FAIL, | |
81 | ||
82 | [T_STATE_SETUPFAIL][T_RESULT_PASS][T_MAIN] = T_STATE_SETUPFAIL, | |
83 | [T_STATE_SETUPFAIL][T_RESULT_FAIL][T_MAIN] = T_STATE_SETUPFAIL, | |
84 | [T_STATE_SETUPFAIL][T_RESULT_UXPASS][T_MAIN] = T_STATE_SETUPFAIL, | |
85 | [T_STATE_SETUPFAIL][T_RESULT_XFAIL][T_MAIN] = T_STATE_SETUPFAIL, | |
86 | ||
87 | [T_STATE_UNRESOLVED][T_RESULT_PASS][T_SETUP] = T_STATE_UNRESOLVED, | |
88 | [T_STATE_UNRESOLVED][T_RESULT_FAIL][T_SETUP] = T_STATE_SETUPFAIL, | |
89 | [T_STATE_UNRESOLVED][T_RESULT_UXPASS][T_SETUP] = T_STATE_SETUPFAIL, | |
90 | [T_STATE_UNRESOLVED][T_RESULT_XFAIL][T_SETUP] = T_STATE_UNRESOLVED, | |
91 | ||
92 | [T_STATE_PASS][T_RESULT_PASS][T_SETUP] = T_STATE_PASS, | |
93 | [T_STATE_PASS][T_RESULT_FAIL][T_SETUP] = T_STATE_SETUPFAIL, | |
94 | [T_STATE_PASS][T_RESULT_UXPASS][T_SETUP] = T_STATE_SETUPFAIL, | |
95 | [T_STATE_PASS][T_RESULT_XFAIL][T_SETUP] = T_STATE_PASS, | |
96 | ||
97 | [T_STATE_FAIL][T_RESULT_PASS][T_SETUP] = T_STATE_FAIL, | |
98 | [T_STATE_FAIL][T_RESULT_FAIL][T_SETUP] = T_STATE_FAIL, | |
99 | [T_STATE_FAIL][T_RESULT_UXPASS][T_SETUP] = T_STATE_FAIL, | |
100 | [T_STATE_FAIL][T_RESULT_XFAIL][T_SETUP] = T_STATE_FAIL, | |
101 | ||
102 | [T_STATE_SETUPFAIL][T_RESULT_PASS][T_SETUP] = T_STATE_SETUPFAIL, | |
103 | [T_STATE_SETUPFAIL][T_RESULT_FAIL][T_SETUP] = T_STATE_SETUPFAIL, | |
104 | [T_STATE_SETUPFAIL][T_RESULT_UXPASS][T_SETUP] = T_STATE_SETUPFAIL, | |
105 | [T_STATE_SETUPFAIL][T_RESULT_XFAIL][T_SETUP] = T_STATE_SETUPFAIL, | |
106 | }; | |
107 | ||
108 | const char * ktest_testcase_result_tokens[KTEST_NUM_TESTCASE_MODES] | |
0a7de745 | 109 | [KTEST_NUM_TESTCASE_STATES] = { |
d9a64523 A |
110 | [T_MAIN][T_RESULT_PASS] = "PASS", |
111 | [T_MAIN][T_RESULT_FAIL] = "FAIL", | |
112 | [T_MAIN][T_RESULT_UXPASS] = "UXPASS", | |
113 | [T_MAIN][T_RESULT_XFAIL] = "XFAIL", | |
114 | [T_SETUP][T_RESULT_PASS] = "SETUP_PASS", | |
115 | [T_SETUP][T_RESULT_FAIL] = "SETUP_FAIL", | |
116 | [T_SETUP][T_RESULT_UXPASS] = "SETUP_UXPASS", | |
117 | [T_SETUP][T_RESULT_XFAIL] = "SETUP_XFAIL", | |
118 | }; |