VirtualBox

Changeset 89966 in vbox


Ignore:
Timestamp:
Jun 30, 2021 8:24:52 AM (3 years ago)
Author:
vboxsync
Message:

Audio/ValKit: Be less strict when (binary) comparing test set audio data (comparison needs to be refined first). bugref:10008

Location:
trunk/src/VBox
Files:
2 edited

Legend:

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

    r89890 r89966  
    522522
    523523        RTMemFree(pErrEntry);
    524 
    525         Assert(pErr->cErrors);
    526         pErr->cErrors--;
    527     }
    528 
    529     Assert(pErr->cErrors == 0);
     524    }
     525
     526    pErr->cErrors = 0;
    530527}
    531528
     
    577574        AssertFailedReturn(VERR_NO_MEMORY);
    578575
    579     const ssize_t cch = RTStrPrintf2(pEntry->szDesc, sizeof(pEntry->szDesc), "Test #%RU32 failed: %s", idxTest, pszDescTmp);
     576    const ssize_t cch = RTStrPrintf2(pEntry->szDesc, sizeof(pEntry->szDesc), "Test #%RU32 %s: %s",
     577                                     idxTest, RT_FAILURE(rc) ? "failed" : "info", pszDescTmp);
    580578    RTStrFree(pszDescTmp);
    581579    AssertReturn(cch > 0, VERR_BUFFER_OVERFLOW);
     
    585583    RTListAppend(&pErr->List, &pEntry->Node);
    586584
    587     pErr->cErrors++;
     585    if (RT_FAILURE(rc))
     586        pErr->cErrors++;
    588587
    589588    return VINF_SUCCESS;
     
    591590
    592591/**
    593  * Adds a single error entry to an audio test error description, va_list version.
     592 * Adds a single error entry to an audio test error description.
    594593 *
    595594 * @returns VBox status code.
     
    599598 * @param   ...                 Optional format arguments of \a pszDesc to add.
    600599 */
    601 static int audioTestErrorDescAdd(PAUDIOTESTERRORDESC pErr, uint32_t idxTest, const char *pszFormat, ...)
     600static int audioTestErrorDescAddError(PAUDIOTESTERRORDESC pErr, uint32_t idxTest, const char *pszFormat, ...)
    602601{
    603602    va_list va;
     
    605604
    606605    int rc = audioTestErrorDescAddV(pErr, idxTest, VERR_GENERAL_FAILURE /** @todo Fudge! */, pszFormat, va);
     606
     607    va_end(va);
     608    return rc;
     609}
     610
     611/**
     612 * Adds a single info entry to an audio test error description, va_list version.
     613 *
     614 * @returns VBox status code.
     615 * @param   pErr                Test error description to add entry for.
     616 * @param   idxTest             Index of failing test (zero-based).
     617 * @param   pszFormat           Error description format string to add.
     618 * @param   ...                 Optional format arguments of \a pszDesc to add.
     619 */
     620static int audioTestErrorDescAddInfo(PAUDIOTESTERRORDESC pErr, uint32_t idxTest, const char *pszFormat, ...)
     621{
     622    va_list va;
     623    va_start(va, pszFormat);
     624
     625    int rc = audioTestErrorDescAddV(pErr, idxTest, VINF_SUCCESS, pszFormat, va);
    607626
    608627    va_end(va);
     
    16481667    if (RT_FAILURE(a_rc)) \
    16491668    { \
    1650         int rc3 = audioTestErrorDescAdd(a_pVerJob->pErr, a_pVerJob->idxTest, a_Msg); \
     1669        int rc3 = audioTestErrorDescAddError(a_pVerJob->pErr, a_pVerJob->idxTest, a_Msg); \
    16511670        AssertRC(rc3); \
    16521671        if (!a_pVerJob->fKeepGoing) \
     
    16571676    if (RT_FAILURE(a_rc)) \
    16581677    { \
    1659         int rc3 = audioTestErrorDescAdd(a_pVerJob->pErr, a_pVerJob->idxTest, a_Msg, __VA_ARGS__); \
     1678        int rc3 = audioTestErrorDescAddError(a_pVerJob->pErr, a_pVerJob->idxTest, a_Msg, __VA_ARGS__); \
    16601679        AssertRC(rc3); \
    16611680        if (!a_pVerJob->fKeepGoing) \
     
    17011720    if (!cbSizeA)
    17021721    {
    1703         int rc2 = audioTestErrorDescAdd(pVerJob->pErr, pVerJob->idxTest, "File '%s' is empty\n", pObjA->szName);
     1722        int rc2 = audioTestErrorDescAddError(pVerJob->pErr, pVerJob->idxTest, "File '%s' is empty", pObjA->szName);
    17041723        AssertRC(rc2);
    17051724    }
     
    17071726    if (!cbSizeB)
    17081727    {
    1709         int rc2 = audioTestErrorDescAdd(pVerJob->pErr, pVerJob->idxTest, "File '%s' is empty\n", pObjB->szName);
     1728        int rc2 = audioTestErrorDescAddError(pVerJob->pErr, pVerJob->idxTest, "File '%s' is empty", pObjB->szName);
    17101729        AssertRC(rc2);
    17111730    }
     
    17131732    if (cbSizeA != cbSizeB)
    17141733    {
    1715         int rc2 = audioTestErrorDescAdd(pVerJob->pErr, pVerJob->idxTest, "File '%s' is %zu bytes %s than '%s'\n",
    1716                                         pObjA->szName,
    1717                                         cbSizeA > cbSizeB ? cbSizeA - cbSizeB : cbSizeB - cbSizeA,
    1718                                         cbSizeA > cbSizeB ? "bigger" : "smaller",
    1719                                         pObjB->szName);
     1734        int rc2 = audioTestErrorDescAddInfo(pVerJob->pErr, pVerJob->idxTest, "File '%s' is %zu bytes %s than '%s'",
     1735                                            pObjA->szName,
     1736                                            cbSizeA > cbSizeB ? cbSizeA - cbSizeB : cbSizeB - cbSizeA,
     1737                                            cbSizeA > cbSizeB ? "bigger" : "smaller",
     1738                                            pObjB->szName);
    17201739        AssertRC(rc2);
    17211740    }
    1722     else if (audioTestFilesCompareBinary(pObjA->File.hFile, pObjB->File.hFile, cbSizeA))
     1741
     1742    if (!audioTestFilesCompareBinary(pObjA->File.hFile, pObjB->File.hFile, cbSizeA))
    17231743    {
    17241744        /** @todo Add more sophisticated stuff here. */
    17251745
    1726         int rc2 = audioTestErrorDescAdd(pVerJob->pErr, pVerJob->idxTest, "Files '%s' and '%s' have different content\n",
    1727                                         pObjA->szName, pObjB->szName);
     1746        int rc2 = audioTestErrorDescAddInfo(pVerJob->pErr, pVerJob->idxTest, "Files '%s' and '%s' have different content",
     1747                                            pObjA->szName, pObjB->szName);
    17281748        AssertRC(rc2);
    17291749    }
     
    17871807    if (RT_FAILURE(rc))
    17881808    {
    1789        int rc2 = audioTestErrorDescAdd(pVerify->pErr, pVerify->idxTest, "Verififcation of test tone data failed\n");
     1809       int rc2 = audioTestErrorDescAddError(pVerify->pErr, pVerify->idxTest, "Verififcation of test tone data failed\n");
    17901810       AssertRC(rc2);
    17911811    }
     
    18701890                    rc = audioTestVerifyTestTone(&VerJob, &hTest, VerJob.pSetA, VerJob.pSetB);
    18711891                else
    1872                     rc = audioTestErrorDescAdd(pErrDesc, i, "Playback test types don't match (set A=%#x, set B=%#x)",
    1873                                                enmTestTypeA, enmTestTypeB);
     1892                    rc = audioTestErrorDescAddError(pErrDesc, i, "Playback test types don't match (set A=%#x, set B=%#x)",
     1893                                                    enmTestTypeA, enmTestTypeB);
    18741894                break;
    18751895            }
     
    18801900                    rc = audioTestVerifyTestTone(&VerJob, &hTest, VerJob.pSetB, VerJob.pSetA);
    18811901                else
    1882                     rc = audioTestErrorDescAdd(pErrDesc, i, "Recording test types don't match (set A=%#x, set B=%#x)",
    1883                                                enmTestTypeA, enmTestTypeB);
     1902                    rc = audioTestErrorDescAddError(pErrDesc, i, "Recording test types don't match (set A=%#x, set B=%#x)",
     1903                                                    enmTestTypeA, enmTestTypeB);
    18841904                break;
    18851905            }
  • trunk/src/VBox/ValidationKit/utils/audio/vkat.cpp

    r89964 r89966  
    879879            if (RT_SUCCESS(rc))
    880880            {
    881                 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "%RU32 errors occurred while verifying\n", AudioTestErrorDescCount(&errDesc));
    882                 if (AudioTestErrorDescFailed(&errDesc))
     881                uint32_t const cErr = AudioTestErrorDescCount(&errDesc);
     882                RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "%RU32 errors occurred while verifying\n", cErr);
     883
     884                /** @todo Use some AudioTestErrorXXX API for enumeration here later. */
     885                PAUDIOTESTERRORENTRY pErrEntry;
     886                RTListForEach(&errDesc.List, pErrEntry, AUDIOTESTERRORENTRY, Node)
    883887                {
    884                     /** @todo Use some AudioTestErrorXXX API for enumeration here later. */
    885                     PAUDIOTESTERRORENTRY pErrEntry;
    886                     RTListForEach(&errDesc.List, pErrEntry, AUDIOTESTERRORENTRY, Node)
    887                         RTTestFailed(g_hTest, pErrEntry->szDesc);
     888                    if (RT_FAILURE(pErrEntry->rc))
     889                        RTTestFailed(g_hTest, "%s\n", pErrEntry->szDesc);
     890                    else
     891                        RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "%s\n", pErrEntry->szDesc);
    888892                }
    889                 else
     893
     894                if (cErr == 0)
    890895                    RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Verification successful\n");
    891896
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