VirtualBox

Changeset 91533 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Oct 4, 2021 6:36:46 AM (3 years ago)
Author:
vboxsync
Message:

Audio/Validation Kit: Added checking for the maximum difference (in percent) when binary-comparing. ​bugref:10008

File:
1 edited

Legend:

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

    r91531 r91533  
    22392239    AssertRC(rc);
    22402240
     2241    uint32_t cDiffs  = 0;
     2242    uint64_t cbDiffs = 0;
     2243
    22412244    RT_NOREF(pToneParms);
    22422245    uint32_t const cbChunkSize = PDMAudioPropsFrameSize(&pToneParms->Props); /* Use the audio frame size as chunk size. */
     
    22442247    uint64_t offCur      = 0;
    22452248    uint64_t offLastDiff = UINT64_MAX;
    2246     uint32_t cDiffs      = 0;
    2247     uint64_t cbToCompare = RT_MIN(pCmpA->cbSize, pCmpB->cbSize);
     2249    uint64_t cbSize      = RT_MIN(pCmpA->cbSize, pCmpB->cbSize);
     2250    uint64_t cbToCompare = cbSize;
    22482251
    22492252    while (cbToCompare)
     
    22692272            if (cDiffs)
    22702273            {
     2274                uint32_t const cbDiff = offCur - offLastDiff;
    22712275                int rc2 = audioTestErrorDescAddInfo(pVerJob->pErr, pVerJob->idxTest, "Chunks differ: A @ %#x vs. B @ %#x [%08RU64-%08RU64] (%RU64 bytes, %RU64ms)",
    22722276                                                                                     pCmpA->offStart, pCmpB->offStart, offLastDiff, offCur,
    2273                                                                                      offCur - offLastDiff, PDMAudioPropsBytesToMilli(&pToneParms->Props, offCur - offLastDiff));
     2277                                                                                     cbDiff, PDMAudioPropsBytesToMilli(&pToneParms->Props, cbDiff));
    22742278                AssertRC(rc2);
     2279
     2280                cbDiffs += cbDiff;
    22752281            }
    22762282            offLastDiff = UINT64_MAX;
     
    22862292        && cDiffs)
    22872293    {
     2294        uint32_t const cbDiff = offCur - offLastDiff;
    22882295        int rc2 = audioTestErrorDescAddInfo(pVerJob->pErr, pVerJob->idxTest, "Chunks differ: A @ %#x vs. B @ %#x [%08RU64-%08RU64] (%RU64 bytes, %RU64ms)",
    22892296                                                                             pCmpA->offStart, pCmpB->offStart, offLastDiff, offCur,
    2290                                                                              offCur - offLastDiff, PDMAudioPropsBytesToMilli(&pToneParms->Props, offCur - offLastDiff));
     2297                                                                             cbDiff, PDMAudioPropsBytesToMilli(&pToneParms->Props, cbDiff));
    22912298        AssertRC(rc2);
     2299
     2300        cbDiffs += cbDiff;
     2301    }
     2302
     2303    if (cbDiffs)
     2304    {
     2305        uint8_t const uDiffPercent = (cbSize * 100) / cbDiffs;
     2306        if (uDiffPercent > pVerJob->Opts.uMaxDiffPercent)
     2307        {
     2308            int rc2 = audioTestErrorDescAddInfo(pVerJob->pErr, pVerJob->idxTest, "Files binary-differ too much (expected maximum %RU8%%, got %RU8%%)",
     2309                                                                                 pVerJob->Opts.uMaxDiffPercent, uDiffPercent);
     2310            AssertRC(rc2);
     2311        }
    22922312    }
    22932313
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