Changeset 90894 in vbox for trunk/src/VBox/ValidationKit/utils
- Timestamp:
- Aug 25, 2021 6:00:11 PM (3 years ago)
- Location:
- trunk/src/VBox/ValidationKit/utils/audio
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/utils/audio/vkatCmdSelfTest.cpp
r90887 r90894 59 59 #include "vkatInternal.h" 60 60 61 62 /********************************************************************************************************************************* 63 * Internal structures * 64 *********************************************************************************************************************************/ 65 66 /** 67 * Structure for keeping a VKAT self test context. 68 */ 69 typedef struct SELFTESTCTX 70 { 71 /** Common tag for guest and host side. */ 72 char szTag[AUDIOTEST_TAG_MAX]; 73 /** Whether to use DrvAudio in the driver stack or not. */ 74 bool fWithDrvAudio; 75 AUDIOTESTDRVSTACK DrvStack; 76 /** Audio driver to use. 77 * Defaults to the platform's default driver. */ 78 PCPDMDRVREG pDrvReg; 79 struct 80 { 81 AUDIOTESTENV TstEnv; 82 /** Where to bind the address of the guest ATS instance to. 83 * Defaults to localhost (127.0.0.1) if empty. */ 84 char szAtsAddr[64]; 85 /** Port of the guest ATS instance. 86 * Defaults to ATS_ALT_PORT if not set. */ 87 uint32_t uAtsPort; 88 } Guest; 89 struct 90 { 91 AUDIOTESTENV TstEnv; 92 /** Address of the guest ATS instance. 93 * Defaults to localhost (127.0.0.1) if not set. */ 94 char szGuestAtsAddr[64]; 95 /** Port of the guest ATS instance. 96 * Defaults to ATS_DEFAULT_PORT if not set. */ 97 uint32_t uGuestAtsPort; 98 /** Address of the Validation Kit audio driver ATS instance. 99 * Defaults to localhost (127.0.0.1) if not set. */ 100 char szValKitAtsAddr[64]; 101 /** Port of the Validation Kit audio driver ATS instance. 102 * Defaults to ATS_ALT_PORT if not set. */ 103 uint32_t uValKitAtsPort; 104 } Host; 105 } SELFTESTCTX; 106 /** Pointer to a VKAT self test context. */ 107 typedef SELFTESTCTX *PSELFTESTCTX; 108 109 110 /********************************************************************************************************************************* 111 * Global Variables * 112 *********************************************************************************************************************************/ 113 114 /** The global self-text context. */ 115 static SELFTESTCTX g_Ctx = { 0 }; 116 117 118 /********************************************************************************************************************************* 119 * Self-test implementation * 120 *********************************************************************************************************************************/ 61 121 62 122 /** … … 273 333 DECLCALLBACK(RTEXITCODE) audioTestCmdSelftestHandler(PRTGETOPTSTATE pGetState) 274 334 { 275 SELFTESTCTX Ctx;276 RT_ZERO(Ctx);277 278 335 /* Argument processing loop: */ 279 336 int rc; … … 284 341 { 285 342 case VKAT_SELFTEST_OPT_GUEST_ATS_ADDR: 286 rc = RTStrCopy( Ctx.Host.szGuestAtsAddr, sizeof(Ctx.Host.szGuestAtsAddr), ValueUnion.psz);343 rc = RTStrCopy(g_Ctx.Host.szGuestAtsAddr, sizeof(g_Ctx.Host.szGuestAtsAddr), ValueUnion.psz); 287 344 break; 288 345 289 346 case VKAT_SELFTEST_OPT_GUEST_ATS_PORT: 290 Ctx.Host.uGuestAtsPort = ValueUnion.u32;347 g_Ctx.Host.uGuestAtsPort = ValueUnion.u32; 291 348 break; 292 349 293 350 case VKAT_SELFTEST_OPT_HOST_ATS_ADDR: 294 rc = RTStrCopy( Ctx.Host.szValKitAtsAddr, sizeof(Ctx.Host.szValKitAtsAddr), ValueUnion.psz);351 rc = RTStrCopy(g_Ctx.Host.szValKitAtsAddr, sizeof(g_Ctx.Host.szValKitAtsAddr), ValueUnion.psz); 295 352 break; 296 353 297 354 case VKAT_SELFTEST_OPT_HOST_ATS_PORT: 298 Ctx.Host.uValKitAtsPort = ValueUnion.u32;355 g_Ctx.Host.uValKitAtsPort = ValueUnion.u32; 299 356 break; 300 357 … … 305 362 306 363 case 'b': 307 Ctx.pDrvReg = AudioTestFindBackendOpt(ValueUnion.psz);308 if ( Ctx.pDrvReg == NULL)364 g_Ctx.pDrvReg = AudioTestFindBackendOpt(ValueUnion.psz); 365 if (g_Ctx.pDrvReg == NULL) 309 366 return RTEXITCODE_SYNTAX; 310 367 break; 311 368 312 369 case 'd': 313 Ctx.fWithDrvAudio = true;370 g_Ctx.fWithDrvAudio = true; 314 371 break; 315 372 … … 334 391 335 392 /* Go with the Validation Kit audio backend if nothing else is specified. */ 336 if ( Ctx.pDrvReg == NULL)337 Ctx.pDrvReg = AudioTestFindBackendOpt("valkit");393 if (g_Ctx.pDrvReg == NULL) 394 g_Ctx.pDrvReg = AudioTestFindBackendOpt("valkit"); 338 395 339 396 /* … … 346 403 * Choosing any other backend than the Validation Kit above *will* break this self-test! 347 404 */ 348 rc = audioTestDriverStackInitEx(& Ctx.DrvStack,Ctx.pDrvReg,349 true /* fEnabledIn */, true /* fEnabledOut */, Ctx.fWithDrvAudio);405 rc = audioTestDriverStackInitEx(&g_Ctx.DrvStack, g_Ctx.pDrvReg, 406 true /* fEnabledIn */, true /* fEnabledOut */, g_Ctx.fWithDrvAudio); 350 407 if (RT_FAILURE(rc)) 351 408 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Unable to init driver stack: %Rrc\n", rc); … … 356 413 RTTestBanner(g_hTest); 357 414 358 int rc2 = audioTestDoSelftest(& Ctx);415 int rc2 = audioTestDoSelftest(&g_Ctx); 359 416 if (RT_FAILURE(rc2)) 360 417 RTTestFailed(g_hTest, "Self test failed with rc=%Rrc", rc2); 361 418 362 audioTestDriverStackDelete(& Ctx.DrvStack);419 audioTestDriverStackDelete(&g_Ctx.DrvStack); 363 420 364 421 /* -
trunk/src/VBox/ValidationKit/utils/audio/vkatInternal.h
r90891 r90894 289 289 290 290 /** 291 * Structure for keeping a VKAT self test context.292 */293 typedef struct SELFTESTCTX294 {295 /** Common tag for guest and host side. */296 char szTag[AUDIOTEST_TAG_MAX];297 /** Whether to use DrvAudio in the driver stack or not. */298 bool fWithDrvAudio;299 AUDIOTESTDRVSTACK DrvStack;300 /** Audio driver to use.301 * Defaults to the platform's default driver. */302 PCPDMDRVREG pDrvReg;303 struct304 {305 AUDIOTESTENV TstEnv;306 /** Where to bind the address of the guest ATS instance to.307 * Defaults to localhost (127.0.0.1) if empty. */308 char szAtsAddr[64];309 /** Port of the guest ATS instance.310 * Defaults to ATS_ALT_PORT if not set. */311 uint32_t uAtsPort;312 } Guest;313 struct314 {315 AUDIOTESTENV TstEnv;316 /** Address of the guest ATS instance.317 * Defaults to localhost (127.0.0.1) if not set. */318 char szGuestAtsAddr[64];319 /** Port of the guest ATS instance.320 * Defaults to ATS_DEFAULT_PORT if not set. */321 uint32_t uGuestAtsPort;322 /** Address of the Validation Kit audio driver ATS instance.323 * Defaults to localhost (127.0.0.1) if not set. */324 char szValKitAtsAddr[64];325 /** Port of the Validation Kit audio driver ATS instance.326 * Defaults to ATS_ALT_PORT if not set. */327 uint32_t uValKitAtsPort;328 } Host;329 } SELFTESTCTX;330 /** Pointer to a VKAT self test context. */331 typedef SELFTESTCTX *PSELFTESTCTX;332 333 /**334 291 * VKAT command table entry. 335 292 */ … … 483 440 /** @todo Test tone handling */ 484 441 int audioTestPlayTone(PAUDIOTESTENV pTstEnv, PAUDIOTESTSTREAM pStream, PAUDIOTESTTONEPARMS pParms); 485 /** @} */486 487 /** @name Command handlers488 * @{ */489 RTEXITCODE audioTestDoSelftest(PSELFTESTCTX pCtx);490 442 /** @} */ 491 443
Note:
See TracChangeset
for help on using the changeset viewer.