VirtualBox

Ignore:
Timestamp:
Aug 25, 2021 6:00:11 PM (3 years ago)
Author:
vboxsync
Message:

Audio/VKAT: Context for self-test is only needed to be available in the module itself. bugref:10008

Location:
trunk/src/VBox/ValidationKit/utils/audio
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/utils/audio/vkatCmdSelfTest.cpp

    r90887 r90894  
    5959#include "vkatInternal.h"
    6060
     61
     62/*********************************************************************************************************************************
     63*   Internal structures                                                                                                          *
     64*********************************************************************************************************************************/
     65
     66/**
     67 * Structure for keeping a VKAT self test context.
     68 */
     69typedef 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. */
     107typedef SELFTESTCTX *PSELFTESTCTX;
     108
     109
     110/*********************************************************************************************************************************
     111*   Global Variables                                                                                                             *
     112*********************************************************************************************************************************/
     113
     114/** The global self-text context. */
     115static SELFTESTCTX g_Ctx = { 0 };
     116
     117
     118/*********************************************************************************************************************************
     119*   Self-test implementation                                                                                                     *
     120*********************************************************************************************************************************/
    61121
    62122/**
     
    273333DECLCALLBACK(RTEXITCODE) audioTestCmdSelftestHandler(PRTGETOPTSTATE pGetState)
    274334{
    275     SELFTESTCTX Ctx;
    276     RT_ZERO(Ctx);
    277 
    278335    /* Argument processing loop: */
    279336    int           rc;
     
    284341        {
    285342            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);
    287344                break;
    288345
    289346            case VKAT_SELFTEST_OPT_GUEST_ATS_PORT:
    290                 Ctx.Host.uGuestAtsPort = ValueUnion.u32;
     347                g_Ctx.Host.uGuestAtsPort = ValueUnion.u32;
    291348                break;
    292349
    293350            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);
    295352                break;
    296353
    297354            case VKAT_SELFTEST_OPT_HOST_ATS_PORT:
    298                 Ctx.Host.uValKitAtsPort = ValueUnion.u32;
     355                g_Ctx.Host.uValKitAtsPort = ValueUnion.u32;
    299356                break;
    300357
     
    305362
    306363            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)
    309366                    return RTEXITCODE_SYNTAX;
    310367                break;
    311368
    312369            case 'd':
    313                 Ctx.fWithDrvAudio = true;
     370                g_Ctx.fWithDrvAudio = true;
    314371                break;
    315372
     
    334391
    335392    /* 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");
    338395
    339396    /*
     
    346403     * Choosing any other backend than the Validation Kit above *will* break this self-test!
    347404     */
    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);
    350407    if (RT_FAILURE(rc))
    351408        return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Unable to init driver stack: %Rrc\n", rc);
     
    356413    RTTestBanner(g_hTest);
    357414
    358     int rc2 = audioTestDoSelftest(&Ctx);
     415    int rc2 = audioTestDoSelftest(&g_Ctx);
    359416    if (RT_FAILURE(rc2))
    360417        RTTestFailed(g_hTest, "Self test failed with rc=%Rrc", rc2);
    361418
    362     audioTestDriverStackDelete(&Ctx.DrvStack);
     419    audioTestDriverStackDelete(&g_Ctx.DrvStack);
    363420
    364421    /*
  • trunk/src/VBox/ValidationKit/utils/audio/vkatInternal.h

    r90891 r90894  
    289289
    290290/**
    291  * Structure for keeping a VKAT self test context.
    292  */
    293 typedef struct SELFTESTCTX
    294 {
    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     struct
    304     {
    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     struct
    314     {
    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 /**
    334291 * VKAT command table entry.
    335292 */
     
    483440/** @todo Test tone handling */
    484441int         audioTestPlayTone(PAUDIOTESTENV pTstEnv, PAUDIOTESTSTREAM pStream, PAUDIOTESTTONEPARMS pParms);
    485 /** @}  */
    486 
    487 /** @name Command handlers
    488  * @{ */
    489 RTEXITCODE   audioTestDoSelftest(PSELFTESTCTX pCtx);
    490442/** @}  */
    491443
Note: See TracChangeset for help on using the changeset viewer.

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