VirtualBox

source: vbox/trunk/src/VBox/Runtime/r3/testi.cpp@ 92258

Last change on this file since 92258 was 88311, checked in by vboxsync, 4 years ago

IPRT/test: Added RTTestErrContext (with variations) for setting a print-once-on-failure message to help put a failure in context w/o needing to get verbose on successful runs. bugref:9890

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.9 KB
Line 
1/* $Id: testi.cpp 88311 2021-03-29 12:59:22Z vboxsync $ */
2/** @file
3 * IPRT - Testcase Framework, the implicit test handle API variation.
4 */
5
6/*
7 * Copyright (C) 2009-2020 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
28/*********************************************************************************************************************************
29* Header Files *
30*********************************************************************************************************************************/
31#include <iprt/test.h>
32#include <iprt/stdarg.h>
33
34
35RTR3DECL(int) RTTestIPrintfV(RTTESTLVL enmLevel, const char *pszFormat, va_list va)
36{
37 return RTTestPrintfV(NIL_RTTEST, enmLevel, pszFormat, va);
38}
39
40
41RTR3DECL(int) RTTestIPrintf(RTTESTLVL enmLevel, const char *pszFormat, ...)
42{
43 va_list va;
44 va_start(va, pszFormat);
45 int cch = RTTestPrintfV(NIL_RTTEST, enmLevel, pszFormat, va);
46 va_end(va);
47 return cch;
48}
49
50
51RTR3DECL(int) RTTestISub(const char *pszSubTest)
52{
53 return RTTestSub(NIL_RTTEST, pszSubTest);
54}
55
56
57RTR3DECL(int) RTTestISubF(const char *pszSubTestFmt, ...)
58{
59 va_list va;
60 va_start(va, pszSubTestFmt);
61 int cch = RTTestSubV(NIL_RTTEST, pszSubTestFmt, va);
62 va_end(va);
63 return cch;
64}
65
66
67RTR3DECL(int) RTTestISubV(const char *pszSubTestFmt, va_list va)
68{
69 return RTTestSubV(NIL_RTTEST, pszSubTestFmt, va);
70}
71
72
73RTR3DECL(int) RTTestISubDone(void)
74{
75 return RTTestSubDone(NIL_RTTEST);
76}
77
78
79RTR3DECL(int) RTTestIPassedV(const char *pszFormat, va_list va)
80{
81 return RTTestPassedV(NIL_RTTEST, pszFormat, va);
82}
83
84
85RTR3DECL(int) RTTestIPassed(const char *pszFormat, ...)
86{
87 va_list va;
88 va_start(va, pszFormat);
89 int cch = RTTestPassedV(NIL_RTTEST, pszFormat, va);
90 va_end(va);
91 return cch;
92}
93
94
95RTR3DECL(int) RTTestIValue(const char *pszName, uint64_t u64Value, RTTESTUNIT enmUnit)
96{
97 return RTTestValue(NIL_RTTEST, pszName, u64Value, enmUnit);
98}
99
100
101RTR3DECL(int) RTTestIValueF(uint64_t u64Value, RTTESTUNIT enmUnit, const char *pszNameFmt, ...)
102{
103 va_list va;
104 va_start(va, pszNameFmt);
105 int rc = RTTestValueV(NIL_RTTEST, u64Value, enmUnit, pszNameFmt, va);
106 va_end(va);
107 return rc;
108}
109
110
111RTR3DECL(int) RTTestIValueV(uint64_t u64Value, RTTESTUNIT enmUnit, const char *pszNameFmt, va_list va)
112{
113 return RTTestValueV(NIL_RTTEST, u64Value, enmUnit, pszNameFmt, va);
114}
115
116
117RTR3DECL(int) RTTestIErrorInc(void)
118{
119 return RTTestErrorInc(NIL_RTTEST);
120}
121
122
123RTR3DECL(uint32_t) RTTestIErrorCount(void)
124{
125 return RTTestErrorCount(NIL_RTTEST);
126}
127
128
129RTR3DECL(int) RTTestIFailedV(const char *pszFormat, va_list va)
130{
131 return RTTestFailedV(NIL_RTTEST, pszFormat, va);
132}
133
134
135RTR3DECL(int) RTTestIFailed(const char *pszFormat, ...)
136{
137 va_list va;
138 va_start(va, pszFormat);
139 int cch = RTTestFailedV(NIL_RTTEST, pszFormat, va);
140 va_end(va);
141 return cch;
142}
143
144
145RTR3DECL(int) RTTestIFailedRcV(int rcRet, const char *pszFormat, va_list va)
146{
147 RTTestFailedV(NIL_RTTEST, pszFormat, va);
148 return rcRet;
149}
150
151
152RTR3DECL(int) RTTestIFailedRc(int rcRet, const char *pszFormat, ...)
153{
154 va_list va;
155 va_start(va, pszFormat);
156 RTTestFailedV(NIL_RTTEST, pszFormat, va);
157 va_end(va);
158 return rcRet;
159}
160
161
162RTR3DECL(int) RTTestIFailureDetailsV(const char *pszFormat, va_list va)
163{
164 return RTTestFailureDetails(NIL_RTTEST, pszFormat, va);
165}
166
167
168RTR3DECL(int) RTTestIFailureDetails(const char *pszFormat, ...)
169{
170 va_list va;
171 va_start(va, pszFormat);
172 int cch = RTTestFailureDetailsV(NIL_RTTEST, pszFormat, va);
173 va_end(va);
174 return cch;
175}
176
177
178RTR3DECL(int) RTTestIErrContextV(const char *pszFormat, va_list va)
179{
180 return RTTestErrContextV(NIL_RTTEST, pszFormat, va);
181}
182
183
184RTR3DECL(int) RTTestErrContext(const char *pszFormat, ...)
185{
186 va_list va;
187 va_start(va, pszFormat);
188 int rc = RTTestIErrContextV(pszFormat, va);
189 va_end(va);
190 return rc;
191}
192
193
194RTR3DECL(int) RTTestIDisableAssertions(void)
195{
196 return RTTestDisableAssertions(NIL_RTTEST);
197}
198
199
200RTR3DECL(int) RTTestIRestoreAssertions(void)
201{
202 return RTTestRestoreAssertions(NIL_RTTEST);
203}
204
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette