Changeset 46300 in vbox for trunk/src/VBox/Devices/VMMDev
- Timestamp:
- May 28, 2013 3:31:18 PM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 86048
- Location:
- trunk/src/VBox/Devices/VMMDev
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/VMMDev/VMMDev.cpp
r45025 r46300 3566 3566 * @interface_method_impl{PDMDEVREG,pfnDestruct} 3567 3567 */ 3568 static DECLCALLBACK(int) vmmdevDestr oy(PPDMDEVINS pDevIns)3568 static DECLCALLBACK(int) vmmdevDestruct(PPDMDEVINS pDevIns) 3569 3569 { 3570 3570 PVMMDEV pThis = PDMINS_2_DATA(pDevIns, PVMMDEV); … … 3580 3580 pThis->pCredentials = NULL; 3581 3581 } 3582 3583 #ifndef VBOX_WITHOUT_TESTING_FEATURES 3584 /* 3585 * Clean up the testing device. 3586 */ 3587 vmmdevTestingTerminate(pDevIns); 3588 #endif 3582 3589 3583 3590 return VINF_SUCCESS; … … 3672 3679 "GuestCoreDumpDir|" 3673 3680 "GuestCoreDumpCount|" 3674 "TestingEnabled" 3681 "TestingEnabled|" 3682 "TestintXmlOutputFile" 3675 3683 , 3676 3684 ""); … … 3730 3738 return PDMDEV_SET_ERROR(pDevIns, rc, 3731 3739 N_("Configuration error: Failed querying \"TestingEnabled\" as a boolean")); 3740 rc = CFGMR3QueryStringAllocDef(pCfg, "TestintXmlOutputFile", &pThis->pszTestingXmlOutput, NULL); 3741 if (RT_FAILURE(rc)) 3742 return PDMDEV_SET_ERROR(pDevIns, rc, N_("Configuration error: Failed querying \"TestintXmlOutputFile\" as a string")); 3732 3743 /** @todo image-to-load-filename? */ 3733 3744 #endif … … 3913 3924 vmmdevConstruct, 3914 3925 /* pfnDestruct */ 3915 NULL,3926 vmmdevDestruct, 3916 3927 /* pfnRelocate */ 3917 3928 vmmdevRelocate, -
trunk/src/VBox/Devices/VMMDev/VMMDevState.h
r44777 r46300 5 5 6 6 /* 7 * Copyright (C) 2006-201 2Oracle Corporation7 * Copyright (C) 2006-2013 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 22 22 #include <VBox/vmm/pdmdev.h> 23 23 #include <VBox/vmm/pdmifs.h> 24 #ifndef VBOX_WITHOUT_TESTING_FEATURES 25 # include <iprt/test.h> 26 #endif 24 27 25 28 #define VMMDEV_WITH_ALT_TIMESYNC … … 348 351 } Value; 349 352 } TestingData; 353 /** The XML output file name (can be a named pipe, doesn't matter to us). */ 354 R3PTRTYPE(char *) pszTestingXmlOutput; 355 /** Testing instance for dealing with the output. */ 356 RTTEST hTestingTest; 350 357 #endif /* !VBOX_WITHOUT_TESTING_FEATURES */ 351 358 } VMMDevState; -
trunk/src/VBox/Devices/VMMDev/VMMDevTesting.cpp
r44528 r46300 32 32 #include <iprt/string.h> 33 33 #include <iprt/time.h> 34 #ifdef IN_RING3 35 # include <iprt/stream.h> 36 #endif 34 #include <iprt/test.h> 37 35 38 36 #include "VMMDevState.h" … … 47 45 LogAlways(a);\ 48 46 LogRel(a);\ 49 RTPrintf a; \50 47 } while (0) 51 48 … … 235 232 { 236 233 #ifdef IN_RING3 234 pThis->TestingData.String.sz[off] = '\0'; 237 235 switch (uCmd) 238 236 { 239 237 case VMMDEV_TESTING_CMD_INIT: 240 VMMDEV_TESTING_OUTPUT(("testing: INIT '%.*s'\n", 241 sizeof(pThis->TestingData.String.sz) - 1, pThis->TestingData.String.sz)); 238 VMMDEV_TESTING_OUTPUT(("testing: INIT '%s'\n", pThis->TestingData.String.sz)); 239 RTTestChangeName(pThis->hTestingTest, pThis->TestingData.String.sz); 240 RTTestBanner(pThis->hTestingTest); 242 241 break; 243 242 case VMMDEV_TESTING_CMD_SUB_NEW: 244 VMMDEV_TESTING_OUTPUT(("testing: SUB_NEW '% .*s'\n",245 sizeof(pThis->TestingData.String.sz) - 1, pThis->TestingData.String.sz));243 VMMDEV_TESTING_OUTPUT(("testing: SUB_NEW '%s'\n", pThis->TestingData.String.sz)); 244 RTTestSub(pThis->hTestingTest, pThis->TestingData.String.sz); 246 245 break; 247 246 case VMMDEV_TESTING_CMD_FAILED: 248 VMMDEV_TESTING_OUTPUT(("testing: FAILED '%.*s'\n",249 sizeof(pThis->TestingData.String.sz) - 1, pThis->TestingData.String.sz));247 RTTestFailed(pThis->hTestingTest, "%s", pThis->TestingData.String.sz); 248 VMMDEV_TESTING_OUTPUT(("testing: FAILED '%s'\n", pThis->TestingData.String.sz)); 250 249 break; 251 250 case VMMDEV_TESTING_CMD_SKIPPED: 252 VMMDEV_TESTING_OUTPUT(("testing: SKIPPED '%.*s'\n", 253 sizeof(pThis->TestingData.String.sz) - 1, pThis->TestingData.String.sz)); 251 if (off) 252 RTTestSkipped(pThis->hTestingTest, "%s", pThis->TestingData.String.sz); 253 else 254 RTTestSkipped(pThis->hTestingTest, NULL); 255 VMMDEV_TESTING_OUTPUT(("testing: SKIPPED '%s'\n", pThis->TestingData.String.sz)); 254 256 break; 255 257 } … … 270 272 pThis->TestingData.Error.c = u32; 271 273 if (uCmd == VMMDEV_TESTING_CMD_TERM) 274 { 275 while (RTTestErrorCount(pThis->hTestingTest) < u32) 276 RTTestErrorInc(pThis->hTestingTest); /* A bit stupid, but does the trick. */ 277 RTTestSubDone(pThis->hTestingTest); 272 278 VMMDEV_TESTING_OUTPUT(("testing: TERM - %u errors\n", u32)); 279 } 273 280 else 281 { 282 while (RTTestSubErrorCount(pThis->hTestingTest) < u32) 283 RTTestErrorInc(pThis->hTestingTest); /* A bit stupid, but does the trick. */ 284 RTTestSubDone(pThis->hTestingTest); 274 285 VMMDEV_TESTING_OUTPUT(("testing: SUB_DONE - %u errors\n", u32)); 286 } 275 287 return VINF_SUCCESS; 276 288 #else … … 296 308 if ( off >= 12 297 309 && cb == 1 298 && off < sizeof(pThis->TestingData.Value.szName) - 1 - 12)310 && off - 12 < sizeof(pThis->TestingData.Value.szName) - 1) 299 311 { 300 312 if (u32) … … 306 318 { 307 319 #ifdef IN_RING3 308 VMMDEV_TESTING_OUTPUT(("testing: VALUE '%.*s'%*s: %'9llu (%#llx) [%u]\n", 309 sizeof(pThis->TestingData.Value.szName) - 1, pThis->TestingData.Value.szName, 320 pThis->TestingData.Value.szName[off - 12] = '\0'; 321 322 RTTESTUNIT enmUnit = (RTTESTUNIT)pThis->TestingData.Value.u32Unit; 323 if (enmUnit <= RTTESTUNIT_INVALID || enmUnit >= RTTESTUNIT_END) 324 { 325 VMMDEV_TESTING_OUTPUT(("Invalid log value unit %#x\n", pThis->TestingData.Value.u32Unit)); 326 enmUnit = RTTESTUNIT_NONE; 327 } 328 RTTestValue(pThis->hTestingTest, pThis->TestingData.Value.szName, 329 pThis->TestingData.Value.u64Value.u, enmUnit); 330 331 VMMDEV_TESTING_OUTPUT(("testing: VALUE '%s'%*s: %'9llu (%#llx) [%u]\n", 332 pThis->TestingData.Value.szName, 310 333 off - 12 > 48 ? 0 : 48 - (off - 12), "", 311 334 pThis->TestingData.Value.u64Value.u, pThis->TestingData.Value.u64Value.u, … … 316 339 } 317 340 return VINF_SUCCESS; 318 319 #ifdef IN_RING3320 pThis->TestingData.Error.c = u32;321 if (uCmd == VMMDEV_TESTING_CMD_TERM)322 VMMDEV_TESTING_OUTPUT(("testing: TERM - %u errors\n", u32));323 else324 VMMDEV_TESTING_OUTPUT(("testing: SUB_DONE - %u errors\n", u32));325 return VINF_SUCCESS;326 #else327 return VINF_IOM_R3_IOPORT_WRITE;328 #endif329 341 } 330 342 break; … … 443 455 * @param pDevIns The VMMDev device instance. 444 456 */ 457 void vmmdevTestingTerminate(PPDMDEVINS pDevIns) 458 { 459 VMMDevState *pThis = PDMINS_2_DATA(pDevIns, VMMDevState *); 460 if (!pThis->fTestingEnabled) 461 return; 462 463 if (pThis->hTestingTest != NIL_RTTEST) 464 { 465 RTTestSummaryAndDestroy(pThis->hTestingTest); 466 pThis->hTestingTest = NIL_RTTEST; 467 } 468 } 469 470 471 /** 472 * Initializes the testing part of the VMMDev if enabled. 473 * 474 * @returns VBox status code. 475 * @param pDevIns The VMMDev device instance. 476 */ 445 477 int vmmdevTestingInitialize(PPDMDEVINS pDevIns) 446 478 { … … 496 528 } 497 529 530 /* 531 * Open the XML output file(/pipe/whatever) if specfied. 532 */ 533 rc = RTTestCreateEx("VMMDevTesting", RTTEST_C_USE_ENV | RTTEST_C_NO_TLS | RTTEST_C_XML_DELAY_TOP_TEST, 534 RTTESTLVL_INVALID, -1 /*iNativeTestPipe*/, pThis->pszTestingXmlOutput, &pThis->hTestingTest); 535 if (RT_FAILURE(rc)) 536 return PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS, "Error creating testing instance"); 537 498 538 return VINF_SUCCESS; 499 539 } -
trunk/src/VBox/Devices/VMMDev/VMMDevTesting.h
r30724 r46300 25 25 RT_C_DECLS_BEGIN 26 26 27 int vmmdevTestingInitialize(PPDMDEVINS pDevIns); 27 int vmmdevTestingInitialize(PPDMDEVINS pDevIns); 28 void vmmdevTestingTerminate(PPDMDEVINS pDevIns); 28 29 29 30 RT_C_DECLS_END
Note:
See TracChangeset
for help on using the changeset viewer.