Changeset 89383 in vbox for trunk/src/VBox/ValidationKit/utils/audio
- Timestamp:
- May 31, 2021 7:26:13 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/utils/audio/vkat.cpp
r89380 r89383 2216 2216 *********************************************************************************************************************************/ 2217 2217 2218 /** 2219 * Verifies one single test set. 2220 * 2221 * @returns VBox status code. 2222 * @param pszPath Absolute path to test set. 2223 * @param pszTag Tag of test set to verify. Optional and can be NULL. 2224 */ 2225 static int audioVerifyOne(const char *pszPath, const char *pszTag) 2226 { 2227 RTTestSubF(g_hTest, "Verifying test set ..."); 2228 2229 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Using tag '%s'\n", pszTag ? pszTag : "default"); 2230 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Opening archive '%s'\n", pszPath); 2231 2232 int rc = VINF_SUCCESS; 2218 static int audioVerifyOpenTestSet(const char *pszPathSet, PAUDIOTESTSET pSet) 2219 { 2220 int rc; 2233 2221 2234 2222 char szPathExtracted[RTPATH_MAX]; 2235 const bool fPacked = AudioTestSetIsPacked(pszPath); 2223 2224 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Opening test set '%s'\n", pszPathSet); 2225 2226 const bool fPacked = AudioTestSetIsPacked(pszPathSet); 2236 2227 if (fPacked) 2237 2228 { 2229 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Test set is an archive and needs to be unpacked\n"); 2230 2238 2231 char szPathTemp[RTPATH_MAX]; 2239 2232 rc = RTPathTemp(szPathTemp, sizeof(szPathTemp)); … … 2249 2242 { 2250 2243 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Unpacking archive to '%s'\n", szPathExtracted); 2251 rc = AudioTestSetUnpack(pszPath , szPathExtracted);2244 rc = AudioTestSetUnpack(pszPathSet, szPathExtracted); 2252 2245 if (RT_SUCCESS(rc)) 2253 2246 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Archive successfully unpacked\n"); … … 2256 2249 } 2257 2250 } 2251 else 2252 rc = VINF_SUCCESS; 2253 2254 if (RT_SUCCESS(rc)) 2255 rc = AudioTestSetOpen(pSet, fPacked ? szPathExtracted : pszPathSet); 2258 2256 2259 2257 if (RT_FAILURE(rc)) 2260 {2261 2258 RTTestFailed(g_hTest, "Unable to open / unpack test set archive: %Rrc", rc); 2262 return rc; 2263 } 2264 2265 AUDIOTESTSET tstSet; 2266 rc = AudioTestSetOpen(&tstSet, fPacked ? szPathExtracted : pszPath); 2259 2260 return rc; 2261 } 2262 2263 /** 2264 * Verifies one single test set. 2265 * 2266 * @returns VBox status code. 2267 * @param pszPathSetA Absolute path to test set A. 2268 * @param pszPathSetB Absolute path to test set B. 2269 */ 2270 static int audioVerifyOne(const char *pszPathSetA, const char *pszPathSetB) 2271 { 2272 RTTestSubF(g_hTest, "Verifying"); 2273 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Verifying test set '%s' with test set '%s'\n", pszPathSetA, pszPathSetB); 2274 2275 AUDIOTESTSET SetA, SetB; 2276 int rc = audioVerifyOpenTestSet(pszPathSetA, &SetA); 2267 2277 if (RT_SUCCESS(rc)) 2278 rc = audioVerifyOpenTestSet(pszPathSetB, &SetB); 2279 2280 if (RT_SUCCESS(rc)) 2268 2281 { 2269 2282 AUDIOTESTERRORDESC errDesc; 2270 rc = AudioTestSetVerify(& tstSet, pszTag ? pszTag : "default", &errDesc);2283 rc = AudioTestSetVerify(&SetA, &SetB, &errDesc); 2271 2284 if (RT_SUCCESS(rc)) 2272 2285 { … … 2276 2289 PAUDIOTESTERRORENTRY pErrEntry; 2277 2290 RTListForEach(&errDesc.List, pErrEntry, AUDIOTESTERRORENTRY, Node) 2278 {2279 2291 RTTestFailed(g_hTest, pErrEntry->szDesc); 2280 }2281 2292 } 2282 2293 else 2283 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Verification successful ");2294 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Verification successful\n"); 2284 2295 2285 2296 AudioTestErrorDescDestroy(&errDesc); … … 2287 2298 else 2288 2299 RTTestFailed(g_hTest, "Verification failed with %Rrc", rc); 2289 2290 AudioTestSetClose(&tstSet); 2291 } 2292 else 2293 RTTestFailed(g_hTest, "Opening test set '%s' (tag '%s') failed, rc=%Rrc\n", pszPath, pszTag, rc); 2300 } 2301 2302 AudioTestSetClose(&SetA); 2303 AudioTestSetClose(&SetB); 2294 2304 2295 2305 RTTestSubDone(g_hTest); … … 2309 2319 * Parse options and process arguments. 2310 2320 */ 2311 const char *pszTag = NULL; /* Custom tag to use. Can be NULL if not being used. */ 2312 unsigned iTestSet = 0; 2321 char *pszSetA = NULL; 2322 char *pszSetB = NULL; 2323 unsigned iTestSet = 0; 2313 2324 2314 2325 int rc; … … 2319 2330 { 2320 2331 case VKAT_VERIFY_OPT_TAG: 2321 pszTag = ValueUnion.psz;2322 if (g_uVerbosity > 0)2323 RTMsgInfo("Using tag '%s'\n", pszTag);2324 2332 break; 2325 2333 2326 2334 case VINF_GETOPT_NOT_OPTION: 2335 { 2336 char **ppszSet = iTestSet == 0 ? &pszSetA : &pszSetB; 2337 2327 2338 if (iTestSet == 0) 2328 2339 RTTestBanner(g_hTest); 2329 audioVerifyOne(ValueUnion.psz, pszTag); 2340 2341 *ppszSet = RTStrDup(ValueUnion.psz); 2342 AssertPtrReturn(*ppszSet, RTEXITCODE_FAILURE); 2343 2330 2344 iTestSet++; 2331 2345 break; 2346 } 2332 2347 2333 2348 AUDIO_TEST_COMMON_OPTION_CASES(ValueUnion); … … 2338 2353 } 2339 2354 2355 if (!iTestSet) 2356 return RTMsgErrorExitFailure("At least one test set must be specified"); 2357 2358 if (iTestSet > 2) 2359 return RTMsgErrorExitFailure("Only two test sets can be verified at one time"); 2360 2340 2361 /* 2341 * If no paths given, default to the current directory. 2362 * If only test set A is given, default to the current directory 2363 * for test set B. 2342 2364 */ 2343 if (iTestSet == 0) 2344 { 2345 if (iTestSet == 0) 2346 RTTestBanner(g_hTest); 2365 if (iTestSet == 1) 2366 { 2347 2367 char szDirCur[RTPATH_MAX]; 2348 int rc2 = RTPathGetCurrent(szDirCur, sizeof(szDirCur)); 2349 if (RT_FAILURE(rc2)) 2350 RTTestFailed(g_hTest, "Failed to retrieve current directory: %Rrc", rc2); 2351 rc = audioVerifyOne(RT_SUCCESS(rc2) ? szDirCur : ".", pszTag); 2352 } 2368 rc = RTPathGetCurrent(szDirCur, sizeof(szDirCur)); 2369 if (RT_SUCCESS(rc)) 2370 { 2371 Assert(pszSetB == NULL); 2372 pszSetB = RTStrDup(szDirCur); 2373 AssertPtrReturn(pszSetB, RTEXITCODE_FAILURE); 2374 } 2375 else 2376 RTTestFailed(g_hTest, "Failed to retrieve current directory: %Rrc", rc); 2377 } 2378 2379 if (RT_SUCCESS(rc)) 2380 rc = audioVerifyOne(pszSetA, pszSetB); 2381 2382 RTStrFree(pszSetA); 2383 RTStrFree(pszSetB); 2353 2384 2354 2385 /*
Note:
See TracChangeset
for help on using the changeset viewer.