Changeset 91135 in vbox
- Timestamp:
- Sep 7, 2021 8:03:30 AM (3 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/AudioTest.cpp
r91126 r91135 182 182 /** Zero-based index of current test being verified. */ 183 183 uint32_t idxTest; 184 /** Flag indicating whether to keep going after an error has occurred. */ 185 bool fKeepGoing; 186 /** Threshold of file differences (chunks) at when we consider audio files 187 * as not matching. */ 188 uint32_t cThresholdDiff; 184 /** The verification options to use. */ 185 AUDIOTESTVERIFYOPTS Opts; 189 186 /** PCM properties to use for verification. */ 190 187 PDMAUDIOPCMPROPS PCMProps; … … 1846 1843 va_end(va); 1847 1844 1848 return pVerJob-> fKeepGoing ? VINF_SUCCESS : rc;1845 return pVerJob->Opts.fKeepGoing ? VINF_SUCCESS : rc; 1849 1846 } 1850 1847 … … 2017 2014 if (cDiffs) 2018 2015 { 2019 int rc2 = audioTestErrorDescAddInfo(pVerJob->pErr, pVerJob->idxTest, "Chunks differ: A [%RU64-%RU64] vs. B [%RU64-%RU64] (%RU64 bytes, %RU64 us)",2016 int rc2 = audioTestErrorDescAddInfo(pVerJob->pErr, pVerJob->idxTest, "Chunks differ: A [%RU64-%RU64] vs. B [%RU64-%RU64] (%RU64 bytes, %RU64ms)", 2020 2017 pCmpA->offStart + offLastDiff, pCmpA->offStart + offCur, 2021 2018 pCmpB->offStart + offLastDiff, pCmpB->offStart + offCur, offCur - offLastDiff, 2022 PDMAudioPropsBytesToMi cro(&pToneParms->Props, offCur - offLastDiff));2019 PDMAudioPropsBytesToMilli(&pToneParms->Props, offCur - offLastDiff)); 2023 2020 AssertRC(rc2); 2024 2021 } … … 2037 2034 if (RT_FAILURE(a_rc)) \ 2038 2035 { \ 2039 if (!a_pVerJob-> fKeepGoing) \2036 if (!a_pVerJob->Opts.fKeepGoing) \ 2040 2037 return VINF_SUCCESS; \ 2041 2038 } … … 2046 2043 int rc3 = audioTestErrorDescAddError(a_pVerJob->pErr, a_pVerJob->idxTest, a_Msg); \ 2047 2044 AssertRC(rc3); \ 2048 if (!a_pVerJob-> fKeepGoing) \2045 if (!a_pVerJob->Opts.fKeepGoing) \ 2049 2046 return VINF_SUCCESS; \ 2050 2047 } … … 2055 2052 int rc3 = audioTestErrorDescAddError(a_pVerJob->pErr, a_pVerJob->idxTest, a_Msg, __VA_ARGS__); \ 2056 2053 AssertRC(rc3); \ 2057 if (!a_pVerJob-> fKeepGoing) \2054 if (!a_pVerJob->Opts.fKeepGoing) \ 2058 2055 return VINF_SUCCESS; \ 2059 2056 … … 2111 2108 size_t const cbDiffAbs = cbSizeA > cbSizeB ? cbSizeA - cbSizeB : cbSizeB - cbSizeA; 2112 2109 2113 int rc2 = audioTestErrorDescAddInfo(pVerJob->pErr, pVerJob->idxTest, "File '%s' is %zu bytes (%RU64 us)",2114 ObjA.szName, cbSizeA, PDMAudioPropsBytesToMi cro(&pVerJob->PCMProps, cbSizeA));2110 int rc2 = audioTestErrorDescAddInfo(pVerJob->pErr, pVerJob->idxTest, "File '%s' is %zu bytes (%RU64ms)", 2111 ObjA.szName, cbSizeA, PDMAudioPropsBytesToMilli(&pVerJob->PCMProps, cbSizeA)); 2115 2112 AssertRC(rc2); 2116 rc2 = audioTestErrorDescAddInfo(pVerJob->pErr, pVerJob->idxTest, "File '%s' is %zu bytes (%RU64 us)",2117 ObjB.szName, cbSizeB, PDMAudioPropsBytesToMi cro(&pVerJob->PCMProps, cbSizeB));2113 rc2 = audioTestErrorDescAddInfo(pVerJob->pErr, pVerJob->idxTest, "File '%s' is %zu bytes (%RU64ms)", 2114 ObjB.szName, cbSizeB, PDMAudioPropsBytesToMilli(&pVerJob->PCMProps, cbSizeB)); 2118 2115 AssertRC(rc2); 2119 2116 2120 rc2 = audioTestErrorDescAddInfo(pVerJob->pErr, pVerJob->idxTest, "File '%s' is %u%% (%zu bytes, %RU64us) %s than '%s'", 2121 ObjA.szName, 2122 cbSizeA > cbSizeB ? 100 - ((cbSizeB * 100) / cbSizeA) : 100 - ((cbSizeA * 100) / cbSizeB), 2123 cbDiffAbs, PDMAudioPropsBytesToMicro(&pVerJob->PCMProps, (uint32_t)cbDiffAbs), 2124 cbSizeA > cbSizeB ? "bigger" : "smaller", 2125 ObjB.szName); 2126 AssertRC(rc2); 2117 uint8_t const uSizeDiffPercentAbs 2118 = cbSizeA > cbSizeB ? 100 - ((cbSizeB * 100) / cbSizeA) : 100 - ((cbSizeA * 100) / cbSizeB); 2119 2120 if (uSizeDiffPercentAbs > pVerJob->Opts.uMaxSizePercent) 2121 { 2122 rc2 = audioTestErrorDescAddError(pVerJob->pErr, pVerJob->idxTest, 2123 "File '%s' is %RU8%% (%zu bytes, %RU64ms) %s than '%s' (threshold is %RU8%%)", 2124 ObjA.szName, 2125 uSizeDiffPercentAbs, 2126 cbDiffAbs, PDMAudioPropsBytesToMilli(&pVerJob->PCMProps, (uint32_t)cbDiffAbs), 2127 cbSizeA > cbSizeB ? "bigger" : "smaller", 2128 ObjB.szName, pVerJob->Opts.uMaxSizePercent); 2129 AssertRC(rc2); 2130 } 2127 2131 } 2128 2132 … … 2161 2165 uint32_t const cDiffs = audioTestFilesFindDiffsBinary(pVerJob, &FileA, &FileB, &ToneParmsA); 2162 2166 2163 rc2 = audioTestErrorDescAddInfo(pVerJob->pErr, pVerJob->idxTest, "Files '%s' and '%s' are %s (%RU32 different chunks, threshold is %RU32)", 2164 ObjA.szName, ObjB.szName, cDiffs == 0 ? "equal" : "different", cDiffs, pVerJob->cThresholdDiff); 2165 AssertRC(rc2); 2166 2167 if (cDiffs > pVerJob->cThresholdDiff) 2168 { 2169 rc2 = audioTestErrorDescAddError(pVerJob->pErr, pVerJob->idxTest, "Files '%s' and '%s' do not match", 2170 ObjA.szName, ObjB.szName); 2167 if (cDiffs > pVerJob->Opts.cMaxDiff) 2168 { 2169 rc2 = audioTestErrorDescAddError(pVerJob->pErr, pVerJob->idxTest, 2170 "Files '%s' and '%s' have too many different chunks (%RU32 vs. %RU32)", 2171 ObjA.szName, ObjB.szName, cDiffs, pVerJob->Opts.cMaxDiff); 2172 AssertRC(rc2); 2173 } 2174 2175 if (AudioTestErrorDescFailed(pVerJob->pErr)) 2176 { 2177 rc2 = audioTestErrorDescAddInfo(pVerJob->pErr, pVerJob->idxTest, "Files '%s' and '%s' do not match", 2178 ObjA.szName, ObjB.szName); 2171 2179 AssertRC(rc2); 2172 2180 } … … 2238 2246 2239 2247 /** 2240 * Verifies an opened audio test set .2248 * Verifies an opened audio test set, extended version. 2241 2249 * 2242 2250 * @returns VBox status code. 2243 2251 * @param pSetA Test set A to verify. 2244 2252 * @param pSetB Test set to verify test set A with. 2253 * @param pOpts Verification options to use. 2245 2254 * @param pErrDesc Where to return the test verification errors. 2246 2255 * 2247 2256 * @note Test verification errors have to be checked for errors, regardless of the 2248 2257 * actual return code. 2249 */ 2250 int AudioTestSetVerify(PAUDIOTESTSET pSetA, PAUDIOTESTSET pSetB, PAUDIOTESTERRORDESC pErrDesc) 2251 { 2258 * @note Uses the standard verification options. Use AudioTestSetVerifyEx() to specify 2259 * own options. 2260 */ 2261 int AudioTestSetVerifyEx(PAUDIOTESTSET pSetA, PAUDIOTESTSET pSetB, PAUDIOTESTVERIFYOPTS pOpts, PAUDIOTESTERRORDESC pErrDesc) 2262 { 2263 AssertPtrReturn(pSetA, VERR_INVALID_POINTER); 2264 AssertPtrReturn(pSetB, VERR_INVALID_POINTER); 2252 2265 AssertReturn(audioTestManifestIsOpen(pSetA), VERR_WRONG_ORDER); 2253 2266 AssertReturn(audioTestManifestIsOpen(pSetB), VERR_WRONG_ORDER); 2267 AssertPtrReturn(pOpts, VERR_INVALID_POINTER); 2254 2268 2255 2269 /* We ASSUME the caller has not init'd pErrDesc. */ … … 2261 2275 VerJob.pSetA = pSetA; 2262 2276 VerJob.pSetB = pSetB; 2263 VerJob.fKeepGoing = true; /** @todo Make this configurable. */ 2264 2265 /** @todo For now we're very strict and consider any diff as being erroneous. 2266 * We might want / need to change this depending on the test boxes lateron. */ 2267 VerJob.cThresholdDiff = 0; 2277 2278 memcpy(&VerJob.Opts, pOpts, sizeof(AUDIOTESTVERIFYOPTS)); 2268 2279 2269 2280 PAUDIOTESTVERIFYJOB pVerJob = &VerJob; … … 2356 2367 /* Only return critical stuff not related to actual testing here. */ 2357 2368 return VINF_SUCCESS; 2369 } 2370 2371 /** 2372 * Initializes audio test verification options in a strict manner. 2373 * 2374 * @param pOpts Verification options to initialize. 2375 */ 2376 void AudioTestSetVerifyOptsInitStrict(PAUDIOTESTVERIFYOPTS pOpts) 2377 { 2378 RT_BZERO(pOpts, sizeof(AUDIOTESTVERIFYOPTS)); 2379 2380 pOpts->fKeepGoing = true; 2381 pOpts->cMaxDiff = 0; /* By default we're very strict and consider any diff as being erroneous. */ 2382 pOpts->uMaxSizePercent = 0; /* Ditto for size difference. */ 2383 } 2384 2385 /** 2386 * Verifies an opened audio test set. 2387 * 2388 * @returns VBox status code. 2389 * @param pSetA Test set A to verify. 2390 * @param pSetB Test set to verify test set A with. 2391 * @param pErrDesc Where to return the test verification errors. 2392 * 2393 * @note Test verification errors have to be checked for errors, regardless of the 2394 * actual return code. 2395 * @note Uses the standard verification options (strict!). 2396 * Use AudioTestSetVerifyEx() to specify own options. 2397 */ 2398 int AudioTestSetVerify(PAUDIOTESTSET pSetA, PAUDIOTESTSET pSetB, PAUDIOTESTERRORDESC pErrDesc) 2399 { 2400 AUDIOTESTVERIFYOPTS Opts; 2401 AudioTestSetVerifyOptsInitStrict(&Opts); 2402 2403 return AudioTestSetVerifyEx(pSetA,pSetB, &Opts, pErrDesc); 2358 2404 } 2359 2405 -
trunk/src/VBox/Devices/Audio/AudioTest.h
r91051 r91135 230 230 231 231 /** 232 * Audio test verification options. 233 */ 234 typedef struct AUDIOTESTVERIFYOPTS 235 { 236 /** Flag indicating whether to keep going after an error has occurred. */ 237 bool fKeepGoing; 238 /** Threshold of file differences (number of chunks) at when we consider audio files 239 * as not matching. 0 means an exact match. */ 240 uint32_t cMaxDiff; 241 /** Threshold of file differences (difference in percent) at when we consider audio files 242 * as not matching. 0 means an exact match. */ 243 uint8_t uMaxDiffPercent; 244 /** Threshold of file size (+/-, in percent) at when we consider audio files 245 * as not matching. 0 means an exact match.*/ 246 uint8_t uMaxSizePercent; 247 } AUDIOTESTVERIFYOPTS; 248 /** Pointer to audio test verification options. */ 249 typedef AUDIOTESTVERIFYOPTS *PAUDIOTESTVERIFYOPTS; 250 251 /** 232 252 * Structure for holding a single audio test error entry. 233 253 */ … … 295 315 int AudioTestSetPack(PAUDIOTESTSET pSet, const char *pszOutDir, char *pszFileName, size_t cbFileName); 296 316 int AudioTestSetUnpack(const char *pszFile, const char *pszOutDir); 317 318 void AudioTestSetVerifyOptsInitStrict(PAUDIOTESTVERIFYOPTS pOpts); 297 319 int AudioTestSetVerify(PAUDIOTESTSET pSetA, PAUDIOTESTSET pSetB, PAUDIOTESTERRORDESC pErrDesc); 320 int AudioTestSetVerifyEx(PAUDIOTESTSET pSetA, PAUDIOTESTSET pSetB, PAUDIOTESTVERIFYOPTS pOpts, PAUDIOTESTERRORDESC pErrDesc); 298 321 299 322 uint32_t AudioTestErrorDescCount(PCAUDIOTESTERRORDESC pErr); -
trunk/src/VBox/ValidationKit/tests/audio/tdAudioTest.py
r91127 r91135 85 85 self.asTests = self.asTestsDef; 86 86 87 # Optional arguments passing to VKAT when verifying audio test sets. 88 self.asVkatVerifyArgs = []; 89 87 90 # Enable audio debug mode. 88 91 # … … 107 110 reporter.log(' --audio-tests <s1[:s2[:]]>'); 108 111 reporter.log(' Default: %s (all)' % (':'.join(self.asTestsDef))); 112 reporter.log(' --audio-verify-max-diff-count <number>'); 113 reporter.log(' Default: 0 (strict)'); 114 reporter.log(' --audio-verify-max-diff-percent <0-100>'); 115 reporter.log(' Default: 0 (strict)'); 116 reporter.log(' --audio-verify-max-size-percent <0-100>'); 117 reporter.log(' Default: 0 (strict)'); 109 118 return fRc; 110 119 … … 129 138 raise base.InvalidOption('The "--audio-tests" value "%s" is not valid; valid values are: %s' 130 139 % (s, ' '.join(self.asTestsDef))); 140 elif asArgs[iArg] == '--audio-verify-max-diff-count' \ 141 or asArgs[iArg] == '--audio-verify-max-diff-percent' \ 142 or asArgs[iArg] == '--audio-verify-max-size-percent': 143 # Strip the "--audio-verify-" prefix and keep the options as defined in VKAT, 144 # e.g. "--audio-verify-max-diff-count" -> "--max-diff-count". That way we don't 145 # need to do any special argument translation and whatnot. 146 self.asVkatVerifyArgs.extend(['--' + asArgs[iArg][len('--audio-verify-'):]]); 147 iArg += 1; 148 if iArg >= len(asArgs): 149 raise base.InvalidOption('Option "%s" needs a value' % (asArgs[iArg - 1])); 150 self.asVkatVerifyArgs.extend([asArgs[iArg]]); 131 151 else: 132 152 return vbox.TestDriver.parseOption(self, asArgs, iArg); … … 535 555 asArgs.extend([ '-v' ]); 536 556 557 if self.asVkatVerifyArgs: 558 asArgs += self.asVkatVerifyArgs; 559 537 560 fRc = self.executeHst("VKAT Host Verify", asArgs); 538 561 if fRc:
Note:
See TracChangeset
for help on using the changeset viewer.