VirtualBox

Ignore:
Timestamp:
Aug 23, 2021 8:16:58 AM (3 years ago)
Author:
vboxsync
Message:

Audio/VKAT: Implemented "--probe-backends" commands to auto-probe all (available) backends. Needed for Linux hosts/guests which might or might not have certain backends installed/enabled; also nice for regression testing of backends which aren't available on certain platforms. bugref:10008

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

Legend:

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

    r90766 r90776  
    127127    VKAT_TEST_OPT_PCM_CHAN,
    128128    VKAT_TEST_OPT_PCM_SIGNED,
     129    VKAT_TEST_OPT_PROBE_BACKENDS,
    129130    VKAT_TEST_OPT_TAG,
    130131    VKAT_TEST_OPT_TEMPDIR,
     
    175176    { "--pcm-hz",            VKAT_TEST_OPT_PCM_HZ,         RTGETOPT_REQ_UINT16  },
    176177    { "--pcm-signed",        VKAT_TEST_OPT_PCM_SIGNED,     RTGETOPT_REQ_BOOL    },
     178    { "--probe-backends",    VKAT_TEST_OPT_PROBE_BACKENDS, RTGETOPT_REQ_NOTHING },
    177179    { "--mode",              VKAT_TEST_OPT_MODE,           RTGETOPT_REQ_STRING  },
    178180    { "--no-verify",         VKAT_TEST_OPT_NO_VERIFY,      RTGETOPT_REQ_NOTHING },
     
    693695        case VKAT_TEST_OPT_PCM_SIGNED:     return "Specifies whether to use signed (true) or unsigned (false) samples\n"
    694696                                                  "    Default: true";
     697        case VKAT_TEST_OPT_PROBE_BACKENDS:  return "Specifies whether to probe all (available) backends until a working one is found\n"
     698                                                  "    Default: false";
    695699        case VKAT_TEST_OPT_TAG:            return "Specifies the test set tag to use";
    696700        case VKAT_TEST_OPT_TEMPDIR:        return "Specifies the temporary directory to use";
     
    722726    uint32_t    uPcmHz        = 0;
    723727    bool        fPcmSigned    = true;
     728    bool        fProbeBackends = false;
    724729
    725730    const char *pszGuestTcpAddr  = NULL;
     
    821826                break;
    822827
     828            case VKAT_TEST_OPT_PROBE_BACKENDS:
     829                fProbeBackends = ValueUnion.f;
     830                break;
     831
    823832            case VKAT_TEST_OPT_TAG:
    824833                pszTag = ValueUnion.psz;
     
    858867
    859868    AUDIOTESTDRVSTACK DrvStack;
    860     rc = audioTestDriverStackInitEx(&DrvStack, pDrvReg,
    861                                     true /* fEnabledIn */, true /* fEnabledOut */, fWithDrvAudio); /** @todo Make in/out configurable, too. */
     869    for (size_t i = 0; i < RT_ELEMENTS(g_aBackends); i++)
     870    {
     871        if (fProbeBackends)
     872        {
     873            pDrvReg = g_aBackends[i].pDrvReg;
     874            RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Probing for backend '%s' ...\n", g_aBackends[i].pszName);
     875        }
     876        rc = audioTestDriverStackInitEx(&DrvStack, pDrvReg,
     877                                        true /* fEnabledIn */, true /* fEnabledOut */, fWithDrvAudio); /** @todo Make in/out configurable, too. */
     878        if (RT_SUCCESS(rc))
     879        {
     880            if (fProbeBackends)
     881                RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Probing backend '%s' successful\n", g_aBackends[i].pszName);
     882            break;
     883        }
     884        if (fProbeBackends)
     885        {
     886            RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Probing backend '%s' failed with %Rrc, trying next one\n",
     887                         g_aBackends[i].pszName, rc);
     888            continue;
     889        }
     890        return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Unable to init driver stack: %Rrc\n", rc);
     891    }
     892
    862893    if (RT_FAILURE(rc))
    863         return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Unable to init driver stack: %Rrc\n", rc);
     894        return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Probing all backends failed, unable to continue\n");
    864895
    865896    PPDMAUDIOHOSTDEV pDev;
  • trunk/src/VBox/ValidationKit/utils/audio/vkatDriverStack.cpp

    r90766 r90776  
    418418    }
    419419
    420     RTTestFailed(g_hTest, "Failed to construct audio driver '%s': %Rrc", pDrvReg->szName, rc);
    421420    if (pDrvReg->pfnDestruct)
    422421        pDrvReg->pfnDestruct(pDrvIns);
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