Changeset 89139 in vbox
- Timestamp:
- May 18, 2021 1:29:24 PM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 144480
- Location:
- trunk/src/VBox
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/AudioTest.cpp
r89136 r89139 55 55 /** The current test manifest version. */ 56 56 #define AUDIOTEST_MANIFEST_VER 1 57 /** Audio test archive default suffix. 58 * According to IPRT terminology this always contains the dot. */ 59 #define AUDIOTEST_ARCHIVE_SUFF_STR ".tar.gz" 57 60 58 61 /** Test manifest header name. */ … … 779 782 return VINF_SUCCESS; 780 783 784 if (!RTFileIsValid(pSet->f.hFile)) 785 return VINF_SUCCESS; 786 781 787 /* Update number of ran tests. */ 782 788 int rc = RTFileSeek(pSet->f.hFile, pSet->offTestCount, RTFILE_SEEK_BEGIN, NULL); … … 785 791 AssertRCReturn(rc, rc); 786 792 787 if (RTFileIsValid(pSet->f.hFile)) 788 { 789 RTFileClose(pSet->f.hFile); 790 pSet->f.hFile = NIL_RTFILE; 791 } 793 RTFileClose(pSet->f.hFile); 794 pSet->f.hFile = NIL_RTFILE; 792 795 793 796 return rc; … … 1033 1036 1034 1037 char szOutName[RT_ELEMENTS(AUDIOTEST_PATH_PREFIX_STR) + AUDIOTEST_TAG_MAX + 16]; 1035 if (RTStrPrintf2(szOutName, sizeof(szOutName), "%s-%s.tar.gz", AUDIOTEST_PATH_PREFIX_STR, pSet->szTag) <= 0) 1038 if (RTStrPrintf2(szOutName, sizeof(szOutName), "%s-%s%s", 1039 AUDIOTEST_PATH_PREFIX_STR, pSet->szTag, AUDIOTEST_ARCHIVE_SUFF_STR) <= 0) 1036 1040 AssertFailedReturn(VERR_BUFFER_OVERFLOW); 1037 1041 … … 1066 1070 1067 1071 /** 1072 * Returns whether a test set archive is packed (as .tar.gz by default) or 1073 * a plain directory. 1074 * 1075 * @returns \c true if packed (as .tar.gz), or \c false if not (directory). 1076 * @param pszPath Path to return packed staus for. 1077 */ 1078 bool AudioTestSetIsPacked(const char *pszPath) 1079 { 1080 /** @todo Improve this, good enough for now. */ 1081 return (RTStrIStr(pszPath, AUDIOTEST_ARCHIVE_SUFF_STR) != NULL); 1082 } 1083 1084 /** 1068 1085 * Unpacks a formerly packed audio test set. 1069 1086 * 1070 1087 * @returns VBox status code. 1071 * @param pszFile Test set file to unpack. 1088 * @param pszFile Test set file to unpack. Must contain the absolute path. 1072 1089 * @param pszOutDir Directory where to unpack the test set into. 1073 1090 * If the directory does not exist it will be created. … … 1075 1092 int AudioTestSetUnpack(const char *pszFile, const char *pszOutDir) 1076 1093 { 1077 RT_NOREF(pszFile, pszOutDir); 1078 1079 // RTZipTarCmd() 1080 1081 return VERR_NOT_IMPLEMENTED; 1094 AssertReturn(pszFile && pszOutDir, VERR_INVALID_PARAMETER); 1095 1096 int rc = VINF_SUCCESS; 1097 1098 if (!RTDirExists(pszOutDir)) 1099 { 1100 rc = RTDirCreateFullPath(pszOutDir, 0755); 1101 if (RT_FAILURE(rc)) 1102 return rc; 1103 } 1104 1105 const char *apszArgs[8]; 1106 unsigned cArgs = 0; 1107 1108 apszArgs[cArgs++] = "AudioTest"; 1109 apszArgs[cArgs++] = "--extract"; 1110 apszArgs[cArgs++] = "--gunzip"; 1111 apszArgs[cArgs++] = "--directory"; 1112 apszArgs[cArgs++] = pszOutDir; 1113 apszArgs[cArgs++] = "--file"; 1114 apszArgs[cArgs++] = pszFile; 1115 1116 RTEXITCODE rcExit = RTZipTarCmd(cArgs, (char **)apszArgs); 1117 if (rcExit != RTEXITCODE_SUCCESS) 1118 rc = VERR_GENERAL_FAILURE; /** @todo Fudge! */ 1119 1120 return rc; 1082 1121 } 1083 1122 -
trunk/src/VBox/Devices/Audio/AudioTest.h
r89135 r89139 27 27 28 28 /** Maximum length in characters an audio test tag can have. */ 29 #define AUDIOTEST_TAG_MAX 6429 #define AUDIOTEST_TAG_MAX 64 30 30 /** Maximum length in characters a single audio test error description can have. */ 31 #define AUDIOTEST_ERROR_DESC_MAX 12831 #define AUDIOTEST_ERROR_DESC_MAX 128 32 32 /** Prefix for audio test (set) directories. */ 33 #define AUDIOTEST_PATH_PREFIX_STR "vkat"33 #define AUDIOTEST_PATH_PREFIX_STR "vkat" 34 34 35 35 /** … … 324 324 int AudioTestSetClose(PAUDIOTESTSET pSet); 325 325 int AudioTestSetWipe(PAUDIOTESTSET pSet); 326 bool AudioTestSetIsPacked(const char *pszPath); 326 327 int AudioTestSetPack(PAUDIOTESTSET pSet, const char *pszOutDir, char *pszFileName, size_t cbFileName); 327 328 int AudioTestSetUnpack(const char *pszFile, const char *pszOutDir); -
trunk/src/VBox/ValidationKit/utils/audio/vkat.cpp
r89136 r89139 31 31 #include <iprt/buildconfig.h> 32 32 #include <iprt/ctype.h> 33 #include <iprt/dir.h> 33 34 #include <iprt/errcore.h> 34 35 #include <iprt/initterm.h> … … 1942 1943 static int audioVerifyOne(const char *pszPath, const char *pszTag) 1943 1944 { 1944 RTTestSubF(g_hTest, "Verifying test set (tag '%s') ...", pszTag ? pszTag : "default"); 1945 RTTestSubF(g_hTest, "Verifying test set ..."); 1946 1947 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Using tag '%s'\n", pszTag ? pszTag : "default"); 1948 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Opening archive '%s'\n", pszPath); 1949 1950 int rc = VINF_SUCCESS; 1951 1952 char szPathExtracted[RTPATH_MAX]; 1953 const bool fPacked = AudioTestSetIsPacked(pszPath); 1954 if (fPacked) 1955 { 1956 char szPathTemp[RTPATH_MAX]; 1957 rc = RTPathTemp(szPathTemp, sizeof(szPathTemp)); 1958 if (RT_SUCCESS(rc)) 1959 { 1960 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Using temporary directory '%s'\n", szPathTemp); 1961 1962 rc = RTPathJoin(szPathExtracted, sizeof(szPathExtracted), szPathTemp, "vkat-XXXX"); 1963 if (RT_SUCCESS(rc)) 1964 { 1965 rc = RTDirCreateTemp(szPathExtracted, 0755); 1966 if (RT_SUCCESS(rc)) 1967 { 1968 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Unpacking archive to '%s'\n", szPathExtracted); 1969 rc = AudioTestSetUnpack(pszPath, szPathExtracted); 1970 if (RT_SUCCESS(rc)) 1971 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Archive successfully unpacked\n"); 1972 } 1973 } 1974 } 1975 } 1976 1977 if (RT_FAILURE(rc)) 1978 { 1979 RTTestFailed(g_hTest, "Unable to open / unpack test set archive: %Rrc", rc); 1980 return rc; 1981 } 1945 1982 1946 1983 AUDIOTESTSET tstSet; 1947 int rc = AudioTestSetOpen(&tstSet,pszPath);1984 rc = AudioTestSetOpen(&tstSet, fPacked ? szPathExtracted : pszPath); 1948 1985 if (RT_SUCCESS(rc)) 1949 1986 { … … 2027 2064 RTTestBanner(g_hTest); 2028 2065 char szDirCur[RTPATH_MAX]; 2029 rc = RTPathGetCurrent(szDirCur, sizeof(szDirCur)); 2030 audioVerifyOne(RT_SUCCESS(rc) ? szDirCur : ".", pszTag); 2066 int rc2 = RTPathGetCurrent(szDirCur, sizeof(szDirCur)); 2067 if (RT_FAILURE(rc2)) 2068 RTTestFailed(g_hTest, "Failed to retrieve current directory: %Rrc", rc2); 2069 rc = audioVerifyOne(RT_SUCCESS(rc2) ? szDirCur : ".", pszTag); 2031 2070 } 2032 2071 … … 2279 2318 { 2280 2319 "test", audioTestMain, 2281 " Does some kind of testing, I guess...",2320 "Runs audio tests and creates an audio test set.", 2282 2321 g_aCmdTestOptions, RT_ELEMENTS(g_aCmdTestOptions), audioTestCmdTestHelp 2283 2322 }, 2284 2323 { 2285 2324 "verify", audioVerifyMain, 2286 "Ver fies something, I guess...",2325 "Verifies a formerly created audio test set.", 2287 2326 g_aCmdVerifyOptions, RT_ELEMENTS(g_aCmdVerifyOptions), NULL, 2288 2327 },
Note:
See TracChangeset
for help on using the changeset viewer.