Changeset 89139 in vbox for trunk/src/VBox/Devices
- Timestamp:
- May 18, 2021 1:29:24 PM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 144480
- Location:
- trunk/src/VBox/Devices/Audio
- Files:
-
- 2 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);
Note:
See TracChangeset
for help on using the changeset viewer.