VirtualBox

Changeset 91946 in vbox


Ignore:
Timestamp:
Oct 21, 2021 1:30:54 PM (3 years ago)
Author:
vboxsync
Message:

Audio/Validation Kit: Perform a quick audio driver stack self-test on start of the actual testing (guest + host), plus in self-test mode.​ bugref:10008

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

Legend:

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

    r91934 r91946  
    940940    }
    941941
     942    /* Do this first before everything else below. */
     943    rc = AudioTestDriverStackPerformSelftest();
     944    if (RT_FAILURE(rc))
     945        return RTMsgErrorExit(RTEXITCODE_FAILURE, "Testing driver stack failed: %Rrc\n", rc);
     946
    942947    AUDIOTESTDRVSTACK DrvStack;
    943948    if (fProbeBackends)
  • trunk/src/VBox/ValidationKit/utils/audio/vkatCmdSelfTest.cpp

    r91653 r91946  
    115115
    116116/*********************************************************************************************************************************
     117*   Driver stack self-test implementation                                                                                                     *
     118*********************************************************************************************************************************/
     119
     120/**
     121 * Performs a (quick) audio driver stack self test.
     122 *
     123 * Local only, no guest/host communication involved.
     124 *
     125 * @returns VBox status code.
     126 */
     127int AudioTestDriverStackPerformSelftest(void)
     128{
     129    PCPDMDRVREG pDrvReg = AudioTestGetDefaultBackend();
     130
     131    RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Testing driver stack started\n");
     132
     133    AUDIOTESTDRVSTACK DrvStack;
     134    int rc = audioTestDriverStackProbe(&DrvStack, pDrvReg,
     135                                       true /* fEnabledIn */, true /* fEnabledOut */, false /* fWithDrvAudio */);
     136    AssertRCReturn(rc, rc);
     137
     138    AUDIOTESTIOOPTS IoOpts;
     139    audioTestIoOptsInitDefaults(&IoOpts);
     140
     141    PPDMAUDIOSTREAM   pStream;
     142    PDMAUDIOSTREAMCFG CfgAcq;
     143    rc = audioTestDriverStackStreamCreateOutput(&DrvStack, &IoOpts.Props,
     144                                                IoOpts.cMsBufferSize, IoOpts.cMsPreBuffer, IoOpts.cMsSchedulingHint,
     145                                                &pStream, &CfgAcq);
     146    AssertRCReturn(rc, rc);
     147
     148    rc = audioTestDriverStackStreamEnable(&DrvStack, pStream);
     149    AssertRCReturn(rc, rc);
     150
     151    AssertReturn(audioTestDriverStackStreamIsOkay(&DrvStack, pStream), VERR_AUDIO_STREAM_NOT_READY);
     152
     153    uint8_t abBuf[_4K];
     154    memset(abBuf, 0x42, sizeof(abBuf));
     155
     156    uint32_t cbWritten;
     157    rc = audioTestDriverStackStreamPlay(&DrvStack, pStream, abBuf, sizeof(abBuf), &cbWritten);
     158    AssertRCReturn(rc, rc);
     159    AssertReturn(cbWritten == sizeof(abBuf), VERR_AUDIO_STREAM_NOT_READY);
     160
     161    audioTestDriverStackStreamDrain(&DrvStack, pStream, true /* fSync */);
     162    audioTestDriverStackStreamDestroy(&DrvStack, pStream);
     163
     164    audioTestDriverStackDelete(&DrvStack);
     165
     166    RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Testing driver stack ended with %Rrc\n", rc);
     167    return rc;
     168}
     169
     170
     171/*********************************************************************************************************************************
    117172*   Self-test implementation                                                                                                     *
    118173*********************************************************************************************************************************/
     
    346401        }
    347402    }
     403
     404    rc = AudioTestDriverStackPerformSelftest();
     405    if (RT_FAILURE(rc))
     406        return RTMsgErrorExit(RTEXITCODE_FAILURE, "Testing driver stack failed: %Rrc\n", rc);
    348407
    349408    /* Go with the Validation Kit audio backend if nothing else is specified. */
  • trunk/src/VBox/ValidationKit/utils/audio/vkatInternal.h

    r91632 r91946  
    396396/** @name Driver stack
    397397 * @{ */
     398int         AudioTestDriverStackPerformSelftest(void);
     399
    398400void        audioTestDriverStackDelete(PAUDIOTESTDRVSTACK pDrvStack);
    399401int         audioTestDriverStackInitEx(PAUDIOTESTDRVSTACK pDrvStack, PCPDMDRVREG pDrvReg, bool fEnabledIn, bool fEnabledOut, bool fWithDrvAudio);
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