Changeset 63258 in vbox for trunk/src/VBox/Main/testcase
- Timestamp:
- Aug 10, 2016 12:23:00 PM (8 years ago)
- Location:
- trunk/src/VBox/Main/testcase
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/testcase/tstGuestCtrlParseBuffer.cpp
r63161 r63258 51 51 uint32_t uMapElements; 52 52 int iResult; 53 } aTestBlock[] =53 } g_aTestBlock[] = 54 54 { 55 55 /* … … 103 103 /** Overall result when done parsing. */ 104 104 int iResult; 105 } aTestStream[] =105 } g_aTestStream[] = 106 106 { 107 107 /* No blocks. */ … … 125 125 uint32_t uMapElements; 126 126 int iResult; 127 } aTest[] =127 } s_aTest[] = 128 128 { 129 129 { "test5=test5\0t51=t51", sizeof("test5=test5\0t51=t51"), 0, sizeof("test5=test5\0") - 1, 1, VERR_MORE_DATA }, … … 131 131 }; 132 132 133 for (unsigned iTest = 0; iTest < RT_ELEMENTS( aTest); iTest++)133 for (unsigned iTest = 0; iTest < RT_ELEMENTS(s_aTest); iTest++) 134 134 { 135 135 RTTestIPrintf(RTTESTLVL_DEBUG, "Manual test #%d\n", iTest); 136 136 137 137 GuestProcessStream stream; 138 rc = stream.AddData((BYTE*) aTest[iTest].pbData,aTest[iTest].cbData);138 rc = stream.AddData((BYTE*)s_aTest[iTest].pbData, s_aTest[iTest].cbData); 139 139 140 140 for (;;) … … 189 189 190 190 unsigned iTest; 191 for (iTest = 0; iTest < RT_ELEMENTS( aTestBlock); iTest++)191 for (iTest = 0; iTest < RT_ELEMENTS(g_aTestBlock); iTest++) 192 192 { 193 193 RTTestIPrintf(RTTESTLVL_DEBUG, "=> Test #%u\n", iTest); 194 194 195 195 GuestProcessStream stream; 196 int iResult = stream.AddData((BYTE*) aTestBlock[iTest].pbData,aTestBlock[iTest].cbData);196 int iResult = stream.AddData((BYTE*)g_aTestBlock[iTest].pbData, g_aTestBlock[iTest].cbData); 197 197 if (RT_SUCCESS(iResult)) 198 198 { 199 199 GuestProcessStreamBlock curBlock; 200 200 iResult = stream.ParseBlock(curBlock); 201 if (iResult != aTestBlock[iTest].iResult)201 if (iResult != g_aTestBlock[iTest].iResult) 202 202 { 203 203 RTTestFailed(hTest, "\tReturned %Rrc, expected %Rrc\n", 204 iResult, aTestBlock[iTest].iResult);205 } 206 else if (stream.GetOffset() != aTestBlock[iTest].uOffsetAfter)204 iResult, g_aTestBlock[iTest].iResult); 205 } 206 else if (stream.GetOffset() != g_aTestBlock[iTest].uOffsetAfter) 207 207 { 208 208 RTTestFailed(hTest, "\tOffset %zu wrong, expected %u\n", 209 stream.GetOffset(), aTestBlock[iTest].uOffsetAfter);209 stream.GetOffset(), g_aTestBlock[iTest].uOffsetAfter); 210 210 } 211 211 else if (iResult == VERR_MORE_DATA) … … 217 217 || iResult == VERR_MORE_DATA)) 218 218 { 219 if (curBlock.GetCount() != aTestBlock[iTest].uMapElements)219 if (curBlock.GetCount() != g_aTestBlock[iTest].uMapElements) 220 220 { 221 221 RTTestFailed(hTest, "\tMap has %u elements, expected %u\n", 222 curBlock.GetCount(), aTestBlock[iTest].uMapElements);222 curBlock.GetCount(), g_aTestBlock[iTest].uMapElements); 223 223 } 224 224 } … … 226 226 /* There is remaining data left in the buffer (which needs to be merged 227 227 * with a following buffer) -- print it. */ 228 size_t uOffset = stream.GetOffset(); 229 size_t uToWrite = aTestBlock[iTest].cbData - uOffset; 230 if (uToWrite) 231 { 232 const char *pszRemaining = aTestBlock[iTest].pbData; 233 RTTestIPrintf(RTTESTLVL_DEBUG, "\tRemaining (%u):\n", uToWrite); 228 size_t off = stream.GetOffset(); 229 size_t cbToWrite = g_aTestBlock[iTest].cbData - off; 230 if (cbToWrite) 231 { 232 RTTestIPrintf(RTTESTLVL_DEBUG, "\tRemaining (%u):\n", cbToWrite); 234 233 235 234 /* How to properly get the current RTTESTLVL (aka IPRT_TEST_MAX_LEVEL) here? 236 235 * Hack alert: Using RTEnvGet for now. */ 237 236 if (!RTStrICmp(RTEnvGet("IPRT_TEST_MAX_LEVEL"), "debug")) 238 RTStrmWriteEx(g_pStdOut, & aTestBlock[iTest].pbData[uOffset], uToWrite - 1, NULL);237 RTStrmWriteEx(g_pStdOut, &g_aTestBlock[iTest].pbData[off], cbToWrite - 1, NULL); 239 238 } 240 239 } … … 243 242 RTTestIPrintf(RTTESTLVL_INFO, "Doing block tests ...\n"); 244 243 245 for (iTest = 0; iTest < RT_ELEMENTS( aTestStream); iTest++)244 for (iTest = 0; iTest < RT_ELEMENTS(g_aTestStream); iTest++) 246 245 { 247 246 RTTestIPrintf(RTTESTLVL_DEBUG, "=> Block test #%u\n", iTest); 248 247 249 248 GuestProcessStream stream; 250 int iResult = stream.AddData((BYTE*) aTestStream[iTest].pbData,aTestStream[iTest].cbData);249 int iResult = stream.AddData((BYTE*)g_aTestStream[iTest].pbData, g_aTestStream[iTest].cbData); 251 250 if (RT_SUCCESS(iResult)) 252 251 { … … 268 267 } while (RT_SUCCESS(iResult)); 269 268 270 if (iResult != aTestStream[iTest].iResult)269 if (iResult != g_aTestStream[iTest].iResult) 271 270 { 272 271 RTTestFailed(hTest, "\tReturned %Rrc, expected %Rrc\n", 273 iResult, aTestStream[iTest].iResult);274 } 275 else if (uNumBlocks != aTestStream[iTest].uNumBlocks)272 iResult, g_aTestStream[iTest].iResult); 273 } 274 else if (uNumBlocks != g_aTestStream[iTest].uNumBlocks) 276 275 { 277 276 RTTestFailed(hTest, "\tReturned %u blocks, expected %u\n", 278 uNumBlocks, aTestStream[iTest].uNumBlocks);277 uNumBlocks, g_aTestStream[iTest].uNumBlocks); 279 278 } 280 279 } -
trunk/src/VBox/Main/testcase/tstVBoxAPI.cpp
r62485 r63258 354 354 355 355 356 int main( int argc, char **argv)356 int main() 357 357 { 358 358 /* -
trunk/src/VBox/Main/testcase/tstVBoxAPIPerf.cpp
r60924 r63258 196 196 197 197 198 int main( int argc, char **argv)198 int main() 199 199 { 200 200 /* -
trunk/src/VBox/Main/testcase/tstVBoxMultipleVM.cpp
r63177 r63258 337 337 static int tstClean(IVirtualBox *pVBox, IVirtualBoxClient *pClient) 338 338 { 339 NOREF(pClient); 339 340 HRESULT rc = S_OK; 340 341 … … 380 381 381 382 382 static DECLCALLBACK(int) tstThreadRun(RTTHREAD thread, void *pvUser) 383 { 383 static DECLCALLBACK(int) tstThreadRun(RTTHREAD hThreadSelf, void *pvUser) 384 { 385 RT_NOREF(hThreadSelf); 384 386 TestThreadArgs* args = (TestThreadArgs*)pvUser; 385 387 Assert(args != NULL);
Note:
See TracChangeset
for help on using the changeset viewer.