1 | /* $Id: bs3-cmn-test.h 76531 2018-12-30 06:03:11Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * BS3Kit - Bs3Test internal header.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2007-2017 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | *
|
---|
17 | * The contents of this file may alternatively be used under the terms
|
---|
18 | * of the Common Development and Distribution License Version 1.0
|
---|
19 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
20 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
21 | * CDDL are applicable instead of those of the GPL.
|
---|
22 | *
|
---|
23 | * You may elect to license modified versions of this file under the
|
---|
24 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
25 | */
|
---|
26 |
|
---|
27 | #ifndef ___bs3_cmn_test_h
|
---|
28 | #define ___bs3_cmn_test_h
|
---|
29 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
30 | # pragma once
|
---|
31 | #endif
|
---|
32 |
|
---|
33 | #include "bs3kit.h"
|
---|
34 | #include <VBox/VMMDevTesting.h>
|
---|
35 |
|
---|
36 |
|
---|
37 | /** Indicates whether the VMMDev is operational. */
|
---|
38 | #ifndef DOXYGEN_RUNNING
|
---|
39 | # define g_fbBs3VMMDevTesting BS3_DATA_NM(g_fbBs3VMMDevTesting)
|
---|
40 | #endif
|
---|
41 | extern bool g_fbBs3VMMDevTesting;
|
---|
42 |
|
---|
43 | /** The number of tests that have failed. */
|
---|
44 | #ifndef DOXYGEN_RUNNING
|
---|
45 | # define g_cusBs3TestErrors BS3_DATA_NM(g_cusBs3TestErrors)
|
---|
46 | #endif
|
---|
47 | extern uint16_t g_cusBs3TestErrors;
|
---|
48 |
|
---|
49 | /** The start error count of the current subtest. */
|
---|
50 | #ifndef DOXYGEN_RUNNING
|
---|
51 | # define g_cusBs3SubTestAtErrors BS3_DATA_NM(g_cusBs3SubTestAtErrors)
|
---|
52 | #endif
|
---|
53 | extern uint16_t g_cusBs3SubTestAtErrors;
|
---|
54 |
|
---|
55 | /** Whether we've reported the sub-test result or not. */
|
---|
56 | #ifndef DOXYGEN_RUNNING
|
---|
57 | # define g_fbBs3SubTestReported BS3_DATA_NM(g_fbBs3SubTestReported)
|
---|
58 | #endif
|
---|
59 | extern bool g_fbBs3SubTestReported;
|
---|
60 | /** Whether the sub-test has been skipped or not. */
|
---|
61 | #ifndef DOXYGEN_RUNNING
|
---|
62 | # define g_fbBs3SubTestSkipped BS3_DATA_NM(g_fbBs3SubTestSkipped)
|
---|
63 | #endif
|
---|
64 | extern bool g_fbBs3SubTestSkipped;
|
---|
65 |
|
---|
66 | /** The number of sub tests. */
|
---|
67 | #ifndef DOXYGEN_RUNNING
|
---|
68 | # define g_cusBs3SubTests BS3_DATA_NM(g_cusBs3SubTests)
|
---|
69 | #endif
|
---|
70 | extern uint16_t g_cusBs3SubTests;
|
---|
71 |
|
---|
72 | /** The number of sub tests that failed. */
|
---|
73 | #ifndef DOXYGEN_RUNNING
|
---|
74 | # define g_cusBs3SubTestsFailed BS3_DATA_NM(g_cusBs3SubTestsFailed)
|
---|
75 | #endif
|
---|
76 | extern uint16_t g_cusBs3SubTestsFailed;
|
---|
77 |
|
---|
78 | /** VMMDEV_TESTING_UNIT_XXX -> string */
|
---|
79 | #ifndef DOXYGEN_RUNNING
|
---|
80 | # define g_aszBs3TestUnitNames BS3_DATA_NM(g_aszBs3TestUnitNames)
|
---|
81 | #endif
|
---|
82 | extern char const g_aszBs3TestUnitNames[][16];
|
---|
83 |
|
---|
84 | /** The test name. */
|
---|
85 | extern const char BS3_FAR *g_pszBs3Test_c16;
|
---|
86 | extern const char *g_pszBs3Test_c32;
|
---|
87 | extern const char *g_pszBs3Test_c64;
|
---|
88 |
|
---|
89 | /** The subtest name. */
|
---|
90 | #ifndef DOXYGEN_RUNNING
|
---|
91 | # define g_szBs3SubTest BS3_DATA_NM(g_szBs3SubTest)
|
---|
92 | #endif
|
---|
93 | extern char g_szBs3SubTest[64];
|
---|
94 |
|
---|
95 |
|
---|
96 | /**
|
---|
97 | * Sends a command to VMMDev followed by a single string.
|
---|
98 | *
|
---|
99 | * If the VMMDev is not present or is not being used, this function will
|
---|
100 | * do nothing.
|
---|
101 | *
|
---|
102 | * @param uCmd The command.
|
---|
103 | * @param pszString The string.
|
---|
104 | */
|
---|
105 | #ifndef DOXYGEN_RUNNING
|
---|
106 | # define bs3TestSendCmdWithStr BS3_CMN_NM(bs3TestSendCmdWithStr)
|
---|
107 | #endif
|
---|
108 | BS3_DECL(void) bs3TestSendCmdWithStr(uint32_t uCmd, const char BS3_FAR *pszString);
|
---|
109 |
|
---|
110 | /**
|
---|
111 | * Sends a command to VMMDev followed by a 32-bit unsigned integer value.
|
---|
112 | *
|
---|
113 | * If the VMMDev is not present or is not being used, this function will
|
---|
114 | * do nothing.
|
---|
115 | *
|
---|
116 | * @param uCmd The command.
|
---|
117 | * @param uValue The value.
|
---|
118 | */
|
---|
119 | #ifndef DOXYGEN_RUNNING
|
---|
120 | # define bs3TestSendCmdWithU32 BS3_CMN_NM(bs3TestSendCmdWithU32)
|
---|
121 | #endif
|
---|
122 | BS3_DECL(void) bs3TestSendCmdWithU32(uint32_t uCmd, uint32_t uValue);
|
---|
123 |
|
---|
124 | /**
|
---|
125 | * Checks if the VMMDev is configured for testing.
|
---|
126 | *
|
---|
127 | * @returns true / false.
|
---|
128 | */
|
---|
129 | #ifndef DOXYGEN_RUNNING
|
---|
130 | # define bs3TestIsVmmDevTestingPresent BS3_CMN_NM(bs3TestIsVmmDevTestingPresent)
|
---|
131 | #endif
|
---|
132 | BS3_DECL(bool) bs3TestIsVmmDevTestingPresent(void);
|
---|
133 |
|
---|
134 | /**
|
---|
135 | * Similar to rtTestSubCleanup.
|
---|
136 | */
|
---|
137 | #ifndef DOXYGEN_RUNNING
|
---|
138 | # define bs3TestSubCleanup BS3_CMN_NM(bs3TestSubCleanup)
|
---|
139 | #endif
|
---|
140 | BS3_DECL(void) bs3TestSubCleanup(void);
|
---|
141 |
|
---|
142 | /**
|
---|
143 | * @callback_method_impl{FNBS3STRFORMATOUTPUT,
|
---|
144 | * Used by Bs3TestFailedV and Bs3TestSkippedV.
|
---|
145 | *
|
---|
146 | * The @a pvUser parameter must point a BS3TESTFAILEDBUF structure. }
|
---|
147 | */
|
---|
148 | #ifndef DOXYGEN_RUNNING
|
---|
149 | # define bs3TestFailedStrOutput BS3_CMN_NM(bs3TestFailedStrOutput)
|
---|
150 | #endif
|
---|
151 | BS3_DECL_CALLBACK(size_t) bs3TestFailedStrOutput(char ch, void BS3_FAR *pvUser);
|
---|
152 |
|
---|
153 | /**
|
---|
154 | * Output buffering for bs3TestFailedStrOutput.
|
---|
155 | */
|
---|
156 | typedef struct BS3TESTFAILEDBUF
|
---|
157 | {
|
---|
158 | /** Initialize to false. */
|
---|
159 | bool fNewLine;
|
---|
160 | /** Initialize to zero. */
|
---|
161 | uint8_t cchBuf;
|
---|
162 | /** Buffer, uninitialized. */
|
---|
163 | char achBuf[128];
|
---|
164 | } BS3TESTFAILEDBUF;
|
---|
165 | /** Pointer to a bs3TestFailedStrOutput buffer. */
|
---|
166 | typedef BS3TESTFAILEDBUF BS3_FAR *PBS3TESTFAILEDBUF;
|
---|
167 |
|
---|
168 | #endif
|
---|
169 |
|
---|