Changeset 89316 in vbox for trunk/src/VBox/Devices
- Timestamp:
- May 27, 2021 12:31:34 PM (4 years ago)
- Location:
- trunk/src/VBox/Devices/Audio
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/AudioTest.cpp
r89311 r89316 452 452 453 453 RTListInit(&pSet->lstTest); 454 pSet->cTests = 0; 455 pSet->cTestsRunning = 0; 456 pSet->offTestCount = 0; 457 454 pSet->cTests = 0; 455 pSet->cTestsRunning = 0; 456 pSet->offTestCount = 0; 457 pSet->pTestCur = NULL; 458 pSet->cObj = 0; 459 pSet->offObjCount = 0; 458 460 pSet->cTotalFailures = 0; 459 461 } … … 705 707 AssertRCReturn(rc, rc); 706 708 709 rc = audioTestManifestWrite(pSet, "obj_count="); 710 AssertRCReturn(rc, rc); 711 pSet->offObjCount = audioTestManifestGetOffsetAbs(pSet); 712 rc = audioTestManifestWrite(pSet, "0000\n"); /* A bit messy, but does the trick for now. */ 713 AssertRCReturn(rc, rc); 714 707 715 pSet->enmMode = AUDIOTESTSETMODE_TEST; 708 716 … … 809 817 return VINF_SUCCESS; 810 818 811 /* Update number of ran tests. */ 812 int rc = RTFileSeek(pSet->f.hFile, pSet->offTestCount, RTFILE_SEEK_BEGIN, NULL); 819 int rc; 820 821 /* Update number of bound test objects. */ 822 PAUDIOTESTENTRY pTest; 823 RTListForEach(&pSet->lstTest, pTest, AUDIOTESTENTRY, Node) 824 { 825 rc = RTFileSeek(pSet->f.hFile, pTest->offObjCount, RTFILE_SEEK_BEGIN, NULL); 826 AssertRCReturn(rc, rc); 827 rc = audioTestManifestWrite(pSet, "%04RU32", pTest->cObj); 828 AssertRCReturn(rc, rc); 829 } 830 831 /* 832 * Update number of ran tests. 833 */ 834 rc = RTFileSeek(pSet->f.hFile, pSet->offObjCount, RTFILE_SEEK_BEGIN, NULL); 835 AssertRCReturn(rc, rc); 836 rc = audioTestManifestWrite(pSet, "%04RU32", pSet->cObj); 837 AssertRCReturn(rc, rc); 838 839 /* 840 * Update number of ran tests. 841 */ 842 rc = RTFileSeek(pSet->f.hFile, pSet->offTestCount, RTFILE_SEEK_BEGIN, NULL); 813 843 AssertRCReturn(rc, rc); 814 844 rc = audioTestManifestWrite(pSet, "%04RU32", pSet->cTests); 815 845 AssertRCReturn(rc, rc); 846 847 /* 848 * Serialize all registered test objects. 849 */ 850 rc = RTFileSeek(pSet->f.hFile, 0, RTFILE_SEEK_END, NULL); 851 AssertRCReturn(rc, rc); 852 853 PAUDIOTESTOBJ pObj; 854 RTListForEach(&pSet->lstObj, pObj, AUDIOTESTOBJ, Node) 855 { 856 rc = audioTestManifestWrite(pSet, "\n"); 857 AssertRCReturn(rc, rc); 858 char szUuid[64]; 859 rc = RTUuidToStr(&pObj->Uuid, szUuid, sizeof(szUuid)); 860 AssertRCReturn(rc, rc); 861 rc = audioTestManifestWriteSectionHdr(pSet, "obj_%s", szUuid); 862 AssertRCReturn(rc, rc); 863 rc = audioTestManifestWrite(pSet, "obj_type=%RU32\n", pObj->enmType); 864 AssertRCReturn(rc, rc); 865 rc = audioTestManifestWrite(pSet, "obj_name=%s\n", pObj->szName); 866 AssertRCReturn(rc, rc); 867 } 816 868 817 869 RTFileClose(pSet->f.hFile); … … 865 917 866 918 /** 867 * Creates and registers a new audio test object to a test set.919 * Creates and registers a new audio test object to the current running test. 868 920 * 869 921 * @returns VBox status code. … … 874 926 int AudioTestSetObjCreateAndRegister(PAUDIOTESTSET pSet, const char *pszName, PAUDIOTESTOBJ *ppObj) 875 927 { 928 AssertReturn(pSet->cTestsRunning == 1, VERR_WRONG_ORDER); /* No test nesting allowed. */ 929 876 930 AssertPtrReturn(pszName, VERR_INVALID_POINTER); 877 931 … … 892 946 { 893 947 pObj->enmType = AUDIOTESTOBJTYPE_FILE; 948 pObj->cRefs = 1; /* Currently only 1:1 mapping. */ 894 949 895 950 RTListAppend(&pSet->lstObj, &pObj->Node); 896 951 pSet->cObj++; 952 953 /* Generate + set an UUID for the object and assign it to the current test. */ 954 rc = RTUuidCreate(&pObj->Uuid); 955 AssertRCReturn(rc, rc); 956 char szUuid[64]; 957 rc = RTUuidToStr(&pObj->Uuid, szUuid, sizeof(szUuid)); 958 AssertRCReturn(rc, rc); 959 960 rc = audioTestManifestWrite(pSet, "obj%RU32_uuid=%s\n", pSet->pTestCur->cObj, szUuid); 961 AssertRCReturn(rc, rc); 962 963 AssertPtr(pSet->pTestCur); 964 pSet->pTestCur->cObj++; 897 965 898 966 *ppObj = pObj; … … 963 1031 AssertRCReturn(rc, rc); 964 1032 965 rc = audioTestManifestWriteSectionHdr(pSet, "test %04RU32", pSet->cTests);1033 rc = audioTestManifestWriteSectionHdr(pSet, "test_%04RU32", pSet->cTests); 966 1034 AssertRCReturn(rc, rc); 967 1035 rc = audioTestManifestWrite(pSet, "test_desc=%s\n", pszDesc); … … 972 1040 AssertRCReturn(rc, rc); 973 1041 rc = audioTestManifestWrite(pSet, "audio_direction=%s\n", PDMAudioDirGetName(pParms->enmDir)); 1042 AssertRCReturn(rc, rc); 1043 1044 rc = audioTestManifestWrite(pSet, "obj_count="); 1045 AssertRCReturn(rc, rc); 1046 pEntry->offObjCount = audioTestManifestGetOffsetAbs(pSet); 1047 rc = audioTestManifestWrite(pSet, "0000\n"); /* A bit messy, but does the trick for now. */ 974 1048 AssertRCReturn(rc, rc); 975 1049 … … 1009 1083 pSet->cTests++; 1010 1084 pSet->cTestsRunning++; 1085 pSet->pTestCur = pEntry; 1011 1086 1012 1087 *ppEntry = pEntry; … … 1028 1103 1029 1104 pEntry->pParent->cTestsRunning--; 1105 pEntry->pParent->pTestCur = NULL; 1030 1106 1031 1107 return rc2; … … 1041 1117 1042 1118 pEntry->pParent->cTestsRunning--; 1119 pEntry->pParent->pTestCur = NULL; 1043 1120 1044 1121 return rc2; -
trunk/src/VBox/Devices/Audio/AudioTest.h
r89308 r89316 185 185 /** List node. */ 186 186 RTLISTNODE Node; 187 RTUUID Uuid; 188 /** Number of references to this test object. */ 189 uint32_t cRefs; 187 190 /** Name of the test object. 188 191 * Must not contain a path and has to be able to serialize to disk. */ … … 208 211 char szDesc[64]; 209 212 AUDIOTESTPARMS Parms; 213 /** Number of test objects bound to this test. */ 214 uint32_t cObj; 215 /** Absolute offset (in bytes) where to write the "obj_count" value later. */ 216 uint64_t offObjCount; 210 217 int rc; 211 218 } AUDIOTESTENTRY; … … 234 241 /** Number of test objects in lstObj. */ 235 242 uint32_t cObj; 243 /** Absolute offset (in bytes) where to write the "obj_count" value later. */ 244 uint64_t offObjCount; 236 245 /** List containing PAUDIOTESTOBJ test object entries. */ 237 246 RTLISTANCHOR lstObj; … … 243 252 /** List containing PAUDIOTESTENTRY test entries. */ 244 253 RTLISTANCHOR lstTest; 245 /** Number of tests currently running. */ 254 /** Current test running. Can be NULL if no test is running. */ 255 PAUDIOTESTENTRY pTestCur; 256 /** Number of tests currently running. 257 * Currently we only allow one concurrent test running at a given time. */ 246 258 uint32_t cTestsRunning; 247 259 /** Number of total (test) failures. */
Note:
See TracChangeset
for help on using the changeset viewer.