VirtualBox

Changeset 89839 in vbox for trunk


Ignore:
Timestamp:
Jun 22, 2021 3:36:51 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
145296
Message:

Audio/ValKit: More work on logging. bugref:10008

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Audio/AudioTest.cpp

    r89769 r89839  
    591591 * @param   idxTest             Index of failing test (zero-based).
    592592 * @param   rc                  Result code of entry to add.
    593  * @param   pszDesc             Error description format string to add.
    594  * @param   args                Optional format arguments of \a pszDesc to add.
    595  */
    596 static int audioTestErrorDescAddV(PAUDIOTESTERRORDESC pErr, uint32_t idxTest, int rc, const char *pszDesc, va_list args)
     593 * @param   pszFormat           Error description format string to add.
     594 * @param   va                  Optional format arguments of \a pszDesc to add.
     595 */
     596static int audioTestErrorDescAddV(PAUDIOTESTERRORDESC pErr, uint32_t idxTest, int rc, const char *pszFormat, va_list va)
    597597{
    598598    PAUDIOTESTERRORENTRY pEntry = (PAUDIOTESTERRORENTRY)RTMemAlloc(sizeof(AUDIOTESTERRORENTRY));
     
    600600
    601601    char *pszDescTmp;
    602     if (RTStrAPrintf(&pszDescTmp, pszDesc, args) < 0)
     602    if (RTStrAPrintfV(&pszDescTmp, pszFormat, va) < 0)
    603603        AssertFailedReturn(VERR_NO_MEMORY);
    604604
     
    622622 * @param   pErr                Test error description to add entry for.
    623623 * @param   idxTest             Index of failing test (zero-based).
    624  * @param   pszDesc             Error description format string to add.
     624 * @param   pszFormat           Error description format string to add.
    625625 * @param   ...                 Optional format arguments of \a pszDesc to add.
    626626 */
    627 static int audioTestErrorDescAdd(PAUDIOTESTERRORDESC pErr, uint32_t idxTest, const char *pszDesc, ...)
     627static int audioTestErrorDescAdd(PAUDIOTESTERRORDESC pErr, uint32_t idxTest, const char *pszFormat, ...)
    628628{
    629629    va_list va;
    630     va_start(va, pszDesc);
    631 
    632     int rc = audioTestErrorDescAddV(pErr, idxTest, VERR_GENERAL_FAILURE /** @todo Fudge! */, pszDesc, va);
     630    va_start(va, pszFormat);
     631
     632    int rc = audioTestErrorDescAddV(pErr, idxTest, VERR_GENERAL_FAILURE /** @todo Fudge! */, pszFormat, va);
    633633
    634634    va_end(va);
     
    16371637}
    16381638
     1639#define CHECK_RC_MAYBE_RET(a_rc, a_pVerJob) \
     1640    if (RT_FAILURE(a_rc)) \
     1641    { \
     1642        if (!a_pVerJob->fKeepGoing) \
     1643            return VINF_SUCCESS; \
     1644    }
     1645
     1646#define CHECK_RC_MSG_MAYBE_RET(a_rc, a_pVerJob, a_Msg) \
     1647    if (RT_FAILURE(a_rc)) \
     1648    { \
     1649        int rc3 = audioTestErrorDescAdd(a_pVerJob->pErr, a_pVerJob->idxTest, (a_Msg)); \
     1650        AssertRC(rc3); \
     1651        if (!a_pVerJob->fKeepGoing) \
     1652            return VINF_SUCCESS; \
     1653    }
     1654
    16391655/**
    16401656 * Does the actual PCM data verification of a test tone.
    16411657 *
    16421658 * @returns VBox status code.
    1643  * @param   pVerify             Verification job to verify PCM data for.
     1659 * @param   pVerJob             Verification job to verify PCM data for.
    16441660 * @param   phTest              Test handle of test to verify PCM data for.
    16451661 */
    1646 static int audioTestVerifyTestToneData(PAUDIOTESTVERIFYJOB pVerify, PAUDIOTESTOBJHANDLE phTest)
     1662static int audioTestVerifyTestToneData(PAUDIOTESTVERIFYJOB pVerJob, PAUDIOTESTOBJHANDLE phTest)
    16471663{
    16481664    int rc;
     
    16511667
    16521668    char szObjA[128];
    1653     rc = audioTestGetValueStr(pVerify->pSetA, phTest, "obj0_uuid", szObjA, sizeof(szObjA));
    1654     AssertRCReturn(rc, rc);
     1669    rc = audioTestGetValueStr(pVerJob->pSetA, phTest, "obj0_uuid", szObjA, sizeof(szObjA));
    16551670    PAUDIOTESTOBJ pObjA;
    1656     rc = audioTestSetObjOpen(pVerify->pSetA, szObjA, &pObjA);
    1657     AssertRCReturn(rc, rc);
     1671    rc = audioTestSetObjOpen(pVerJob->pSetA, szObjA, &pObjA);
     1672    CHECK_RC_MSG_MAYBE_RET(rc, pVerJob, ("Unable to open object A '%s'", szObjA));
    16581673
    16591674    char szObjB[128];
    1660     rc = audioTestGetValueStr(pVerify->pSetB, phTest, "obj0_uuid", szObjB, sizeof(szObjB));
    1661     AssertRCReturn(rc, rc);
     1675    rc = audioTestGetValueStr(pVerJob->pSetB, phTest, "obj0_uuid", szObjB, sizeof(szObjB));
    16621676    PAUDIOTESTOBJ pObjB;
    1663     rc = audioTestSetObjOpen(pVerify->pSetB, szObjB, &pObjB);
    1664     AssertRCReturn(rc, rc);
     1677    rc = audioTestSetObjOpen(pVerJob->pSetB, szObjB, &pObjB);
     1678    CHECK_RC_MSG_MAYBE_RET(rc, pVerJob, ("Unable to open object B '%s'", szObjB));
    16651679
    16661680    AssertReturn(pObjA->enmType == AUDIOTESTOBJTYPE_FILE, VERR_NOT_SUPPORTED);
     
    16801694        /** @todo Add more sophisticated stuff here. */
    16811695
    1682         int rc2 = audioTestErrorDescAdd(pVerify->pErr, pVerify->idxTest, "Files '%s' and '%s' don't match\n", szObjA, szObjB);
     1696        int rc2 = audioTestErrorDescAdd(pVerJob->pErr, pVerJob->idxTest, "Files '%s' and '%s' don't match\n", szObjA, szObjB);
    16831697        AssertRC(rc2);
    16841698    }
     
    17751789    VerJob.fKeepGoing = true;
    17761790
     1791    PAUDIOTESTVERIFYJOB pVerJob = &VerJob;
     1792
    17771793    int rc;
    17781794
     
    17841800
    17851801    rc = audioTestVerifyValue(&VerJob, &hHdr,   "magic",        "vkat_ini",    "Manifest magic wrong");
    1786     AssertRCReturn(rc, rc);
     1802    CHECK_RC_MAYBE_RET(rc, pVerJob);
    17871803    rc = audioTestVerifyValue(&VerJob, &hHdr,   "ver",          "1"       ,    "Manifest version wrong");
    1788     AssertRCReturn(rc, rc);
     1804    CHECK_RC_MAYBE_RET(rc, pVerJob);
    17891805    rc = audioTestVerifyValue(&VerJob, &hHdr,   "tag",          NULL,          "Manifest tags don't match");
    1790     AssertRCReturn(rc, rc);
     1806    CHECK_RC_MAYBE_RET(rc, pVerJob);
    17911807    rc = audioTestVerifyValue(&VerJob, &hHdr,   "test_count",   NULL,          "Test counts don't match");
    1792     AssertRCReturn(rc, rc);
     1808    CHECK_RC_MAYBE_RET(rc, pVerJob);
    17931809    rc = audioTestVerifyValue(&VerJob, &hHdr,   "obj_count",    NULL,          "Object counts don't match");
    1794     AssertRCReturn(rc, rc);
    1795 
    1796     if (   pErrDesc->cErrors
    1797         && !VerJob.fKeepGoing)
    1798         return VINF_SUCCESS;
     1810    CHECK_RC_MAYBE_RET(rc, pVerJob);
    17991811
    18001812    /*
     
    18141826        AUDIOTESTTYPE enmTestTypeA;
    18151827        rc = audioTestGetValueUInt32(VerJob.pSetA, &hTest, "test_type", (uint32_t *)&enmTestTypeA);
    1816         AssertRCReturn(rc, rc);
     1828        CHECK_RC_MSG_MAYBE_RET(rc, pVerJob, ("Test type A not found"));
     1829
    18171830        AUDIOTESTTYPE enmTestTypeB;
    18181831        rc = audioTestGetValueUInt32(VerJob.pSetB, &hTest, "test_type", (uint32_t *)&enmTestTypeB);
    1819         AssertRCReturn(rc, rc);
     1832        CHECK_RC_MSG_MAYBE_RET(rc, pVerJob, ("Test type B not found"));
    18201833
    18211834        switch (enmTestTypeA)
     
    18571870    }
    18581871
    1859 #undef VERIFY_VALUE
    1860 
    18611872    /* Only return critical stuff not related to actual testing here. */
    18621873    return VINF_SUCCESS;
    18631874}
     1875
     1876#undef CHECK_RC_MAYBE_RET
     1877#undef CHECK_RC_MSG_MAYBE_RET
    18641878
    18651879
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