1 | /* $Id: bs3-cmn-test.h 60311 2016-04-04 17:01:14Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * BS3Kit - Bs3Test internal header.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2007-2015 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 |
|
---|
30 | #include "bs3kit.h"
|
---|
31 | #include <VBox/VMMDevTesting.h>
|
---|
32 |
|
---|
33 |
|
---|
34 | /** Indicates whether the VMMDev is operational. */
|
---|
35 | #ifndef DOXYGEN_RUNNING
|
---|
36 | # define g_fbBs3VMMDevTesting BS3_DATA_NM(g_fbBs3VMMDevTesting)
|
---|
37 | #endif
|
---|
38 | extern bool g_fbBs3VMMDevTesting;
|
---|
39 |
|
---|
40 | /** The number of tests that have failed. */
|
---|
41 | #ifndef DOXYGEN_RUNNING
|
---|
42 | # define g_cusBs3TestErrors BS3_DATA_NM(g_cusBs3TestErrors)
|
---|
43 | #endif
|
---|
44 | extern uint16_t g_cusBs3TestErrors;
|
---|
45 |
|
---|
46 | /** The start error count of the current subtest. */
|
---|
47 | #ifndef DOXYGEN_RUNNING
|
---|
48 | # define g_cusBs3SubTestAtErrors BS3_DATA_NM(g_cusBs3SubTestAtErrors)
|
---|
49 | #endif
|
---|
50 | extern uint16_t g_cusBs3SubTestAtErrors;
|
---|
51 |
|
---|
52 | /** Whether we've reported the sub-test result or not. */
|
---|
53 | #ifndef DOXYGEN_RUNNING
|
---|
54 | # define g_fbBs3SubTestReported BS3_DATA_NM(g_fbBs3SubTestReported)
|
---|
55 | #endif
|
---|
56 | extern bool g_fbBs3SubTestReported;
|
---|
57 | /** Whether the sub-test has been skipped or not. */
|
---|
58 | #ifndef DOXYGEN_RUNNING
|
---|
59 | # define g_fbBs3SubTestSkipped BS3_DATA_NM(g_fbBs3SubTestSkipped)
|
---|
60 | #endif
|
---|
61 | extern bool g_fbBs3SubTestSkipped;
|
---|
62 |
|
---|
63 | /** The number of sub tests. */
|
---|
64 | #ifndef DOXYGEN_RUNNING
|
---|
65 | # define g_cusBs3SubTests BS3_DATA_NM(g_cusBs3SubTests)
|
---|
66 | #endif
|
---|
67 | extern uint16_t g_cusBs3SubTests;
|
---|
68 |
|
---|
69 | /** The number of sub tests that failed. */
|
---|
70 | #ifndef DOXYGEN_RUNNING
|
---|
71 | # define g_cusBs3SubTestsFailed BS3_DATA_NM(g_cusBs3SubTestsFailed)
|
---|
72 | #endif
|
---|
73 | extern uint16_t g_cusBs3SubTestsFailed;
|
---|
74 |
|
---|
75 | /** VMMDEV_TESTING_UNIT_XXX -> string */
|
---|
76 | #ifndef DOXYGEN_RUNNING
|
---|
77 | # define g_aszBs3TestUnitNames BS3_DATA_NM(g_aszBs3TestUnitNames)
|
---|
78 | #endif
|
---|
79 | extern char const g_aszBs3TestUnitNames[][16];
|
---|
80 |
|
---|
81 | /** The test name. */
|
---|
82 | extern const char BS3_FAR *g_pszBs3Test_c16;
|
---|
83 | extern const char *g_pszBs3Test_c32;
|
---|
84 | extern const char *g_pszBs3Test_c64;
|
---|
85 |
|
---|
86 | /** The subtest name. */
|
---|
87 | #ifndef DOXYGEN_RUNNING
|
---|
88 | # define g_szBs3SubTest BS3_DATA_NM(g_szBs3SubTest)
|
---|
89 | #endif
|
---|
90 | extern char g_szBs3SubTest[64];
|
---|
91 |
|
---|
92 |
|
---|
93 | /**
|
---|
94 | * Sends a command to VMMDev followed by a single string.
|
---|
95 | *
|
---|
96 | * If the VMMDev is not present or is not being used, this function will
|
---|
97 | * do nothing.
|
---|
98 | *
|
---|
99 | * @param uCmd The command.
|
---|
100 | * @param pszString The string.
|
---|
101 | */
|
---|
102 | BS3_DECL(void) bs3TestSendCmdWithStr_c16(uint32_t uCmd, const char BS3_FAR *pszString);
|
---|
103 | BS3_DECL(void) bs3TestSendCmdWithStr_c32(uint32_t uCmd, const char BS3_FAR *pszString); /**< @copydoc bs3TestSendCmdWithStr_c16 */
|
---|
104 | BS3_DECL(void) bs3TestSendCmdWithStr_c64(uint32_t uCmd, const char BS3_FAR *pszString); /**< @copydoc bs3TestSendCmdWithStr_c16 */
|
---|
105 | #define bs3TestSendCmdWithStr BS3_CMN_NM(bs3TestSendCmdWithStr) /**< Selects #bs3TestSendCmdWithStr_c16, #bs3TestSendCmdWithStr_c32 or #bs3TestSendCmdWithStr_c64. */
|
---|
106 |
|
---|
107 | /**
|
---|
108 | * Sends a command to VMMDev followed by a 32-bit unsigned integer value.
|
---|
109 | *
|
---|
110 | * If the VMMDev is not present or is not being used, this function will
|
---|
111 | * do nothing.
|
---|
112 | *
|
---|
113 | * @param uCmd The command.
|
---|
114 | * @param uValue The value.
|
---|
115 | */
|
---|
116 | BS3_DECL(void) bs3TestSendCmdWithU32_c16(uint32_t uCmd, uint32_t uValue);
|
---|
117 | BS3_DECL(void) bs3TestSendCmdWithU32_c32(uint32_t uCmd, uint32_t uValue); /**< @copydoc bs3TestSendCmdWithU32_c16 */
|
---|
118 | BS3_DECL(void) bs3TestSendCmdWithU32_c64(uint32_t uCmd, uint32_t uValue); /**< @copydoc bs3TestSendCmdWithU32_c16 */
|
---|
119 | #define bs3TestSendCmdWithU32 BS3_CMN_NM(bs3TestSendCmdWithU32) /**< Selects #bs3TestSendCmdWithU32_c16, #bs3TestSendCmdWithU32_c32 or #bs3TestSendCmdWithU32_c64. */
|
---|
120 |
|
---|
121 | /**
|
---|
122 | * Checks if the VMMDev is configured for testing.
|
---|
123 | *
|
---|
124 | * @returns true / false.
|
---|
125 | */
|
---|
126 | BS3_DECL(bool) bs3TestIsVmmDevTestingPresent_c16(void);
|
---|
127 | BS3_DECL(bool) bs3TestIsVmmDevTestingPresent_c32(void); /**< @copydoc bs3TestIsVmmDevTestingPresent_c16 */
|
---|
128 | BS3_DECL(bool) bs3TestIsVmmDevTestingPresent_c64(void); /**< @copydoc bs3TestIsVmmDevTestingPresent_c16 */
|
---|
129 | #define bs3TestIsVmmDevTestingPresent BS3_CMN_NM(bs3TestIsVmmDevTestingPresent) /**< Selects #bs3TestIsVmmDevTestingPresent_c16, #bs3TestIsVmmDevTestingPresent_c32 or #bs3TestIsVmmDevTestingPresent_c64. */
|
---|
130 |
|
---|
131 | /**
|
---|
132 | * Similar to rtTestSubCleanup.
|
---|
133 | */
|
---|
134 | BS3_DECL(void) bs3TestSubCleanup_c16(void);
|
---|
135 | BS3_DECL(void) bs3TestSubCleanup_c32(void); /**< @copydoc bs3TestSubCleanup_c16 */
|
---|
136 | BS3_DECL(void) bs3TestSubCleanup_c64(void); /**< @copydoc bs3TestSubCleanup_c16 */
|
---|
137 | #define bs3TestSubCleanup BS3_CMN_NM(bs3TestSubCleanup) /**< Selects #bs3TestSubCleanup_c16, #bs3TestSubCleanup_c32 or #bs3TestSubCleanup_c64. */
|
---|
138 |
|
---|
139 | /**
|
---|
140 | * @impl_callback_method{FNBS3STRFORMATOUTPUT,
|
---|
141 | * Used by Bs3TestFailedV and Bs3TestSkippedV.
|
---|
142 | *
|
---|
143 | * The @a pvUser parameter must point to a boolean that was initialized to false. }
|
---|
144 | */
|
---|
145 | BS3_DECL_CALLBACK(size_t) bs3TestFailedStrOutput_c16(char ch, void BS3_FAR *pvUser);
|
---|
146 | BS3_DECL_CALLBACK(size_t) bs3TestFailedStrOutput_c32(char ch, void BS3_FAR *pvUser);
|
---|
147 | BS3_DECL_CALLBACK(size_t) bs3TestFailedStrOutput_c64(char ch, void BS3_FAR *pvUser);
|
---|
148 | #define bs3TestFailedStrOutput BS3_CMN_NM(bs3TestFailedStrOutput) /**< Selects #bs3TestFailedStrOutput_c16, #bs3TestFailedStrOutput_c32 or #bs3TestFailedStrOutput_c64. */
|
---|
149 |
|
---|
150 | #endif
|
---|
151 |
|
---|