]> git.saurik.com Git - apple/xnu.git/blame_incremental - osfmk/tests/ktest_internal.h
xnu-4903.221.2.tar.gz
[apple/xnu.git] / osfmk / tests / ktest_internal.h
... / ...
CommitLineData
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
46extern unsigned int ktest_current_line;
47extern const char * ktest_current_file;
48extern const char * ktest_current_func;
49extern uint64_t ktest_current_time;
50
51extern const char * ktest_test_name;
52
53extern char ktest_current_msg[KTEST_MAXLEN];
54extern char ktest_current_expr[KTEST_MAXOUTLEN];
55extern char ktest_current_var_names[KTEST_MAXVARS][KTEST_MAXLEN];
56extern char ktest_current_var_values[KTEST_MAXVARS][KTEST_MAXLEN];
57extern unsigned int ktest_expression_index;
58extern unsigned int ktest_current_var_index;
59extern unsigned int ktest_test_index;
60extern unsigned int ktest_passcount;
61extern unsigned int ktest_failcount;
62extern unsigned int ktest_xpasscount;
63extern unsigned int ktest_xfailcount;
64extern int ktest_expectfail;
65
66extern int ktest_testcase_result;
67extern int ktest_test_result;
68extern int ktest_testcase_mode;
69
70extern ktest_temp ktest_temp1, ktest_temp2, ktest_temp3;
71
72extern char ktest_output_buf[KTEST_MAXLEN];
73
74extern int ktest_test_result_statetab[KTEST_NUM_TEST_STATES]
75 [KTEST_NUM_TESTCASE_STATES]
76 [KTEST_NUM_TESTCASE_MODES];
77
78extern const char * ktest_testcase_result_tokens[KTEST_NUM_TESTCASE_MODES]
79 [KTEST_NUM_TESTCASE_STATES];
80
81
82void ktest_emit_start(void);
83void ktest_emit_finish(void);
84void ktest_emit_testbegin(const char * test_name);
85void ktest_emit_testskip(const char * skip_msg, va_list args);
86void ktest_emit_testend(void);
87void ktest_emit_log(const char * log_msg, va_list args);
88void ktest_emit_perfdata(const char * metric, const char * unit, double value, const char * desc);
89void ktest_emit_testcase(void);
90
91#endif /* _TESTS_KTEST_INTERNAL_H */
92