VirtualBox

Changeset 91036 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Aug 31, 2021 4:27:59 PM (3 years ago)
Author:
vboxsync
Message:

Audio/Validation Kit: More code for resolving the connection problems. ​bugref:10008

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Audio/AudioTest.cpp

    r90184 r91036  
    11241124int AudioTestSetClose(PAUDIOTESTSET pSet)
    11251125{
    1126     if (!pSet)
     1126    AssertPtrReturn(pSet, VERR_INVALID_POINTER);
     1127
     1128    if (!audioTestManifestIsOpen(pSet))
    11271129        return VINF_SUCCESS;
    11281130
    1129     if (!RTFileIsValid(pSet->f.hFile))
    1130         return VINF_SUCCESS;
    1131 
    11321131    int rc;
    11331132
    1134     /* Update number of bound test objects. */
    1135     PAUDIOTESTENTRY pTest;
    1136     RTListForEach(&pSet->lstTest, pTest, AUDIOTESTENTRY, Node)
    1137     {
    1138         rc = RTFileSeek(pSet->f.hFile, pTest->offObjCount, RTFILE_SEEK_BEGIN, NULL);
     1133    if (pSet->enmMode == AUDIOTESTSETMODE_TEST)
     1134    {
     1135        /* Update number of bound test objects. */
     1136        PAUDIOTESTENTRY pTest;
     1137        RTListForEach(&pSet->lstTest, pTest, AUDIOTESTENTRY, Node)
     1138        {
     1139            rc = RTFileSeek(pSet->f.hFile, pTest->offObjCount, RTFILE_SEEK_BEGIN, NULL);
     1140            AssertRCReturn(rc, rc);
     1141            rc = audioTestManifestWrite(pSet, "%04RU32", pTest->cObj);
     1142            AssertRCReturn(rc, rc);
     1143        }
     1144
     1145        /*
     1146         * Update number of ran tests.
     1147         */
     1148        rc = RTFileSeek(pSet->f.hFile, pSet->offObjCount, RTFILE_SEEK_BEGIN, NULL);
    11391149        AssertRCReturn(rc, rc);
    1140         rc = audioTestManifestWrite(pSet, "%04RU32", pTest->cObj);
     1150        rc = audioTestManifestWrite(pSet, "%04RU32", pSet->cObj);
    11411151        AssertRCReturn(rc, rc);
    1142     }
    1143 
    1144     /*
    1145      * Update number of ran tests.
    1146      */
    1147     rc = RTFileSeek(pSet->f.hFile, pSet->offObjCount, RTFILE_SEEK_BEGIN, NULL);
    1148     AssertRCReturn(rc, rc);
    1149     rc = audioTestManifestWrite(pSet, "%04RU32", pSet->cObj);
    1150     AssertRCReturn(rc, rc);
    1151 
    1152     /*
    1153      * Update number of ran tests.
    1154      */
    1155     rc = RTFileSeek(pSet->f.hFile, pSet->offTestCount, RTFILE_SEEK_BEGIN, NULL);
    1156     AssertRCReturn(rc, rc);
    1157     rc = audioTestManifestWrite(pSet, "%04RU32", pSet->cTests);
    1158     AssertRCReturn(rc, rc);
    1159 
    1160     /*
    1161      * Serialize all registered test objects.
    1162      */
    1163     rc = RTFileSeek(pSet->f.hFile, 0, RTFILE_SEEK_END, NULL);
    1164     AssertRCReturn(rc, rc);
    1165 
    1166     PAUDIOTESTOBJINT pObj;
    1167     RTListForEach(&pSet->lstObj, pObj, AUDIOTESTOBJINT, Node)
    1168     {
    1169         rc = audioTestManifestWrite(pSet, "\n");
     1152
     1153        /*
     1154         * Update number of ran tests.
     1155         */
     1156        rc = RTFileSeek(pSet->f.hFile, pSet->offTestCount, RTFILE_SEEK_BEGIN, NULL);
    11701157        AssertRCReturn(rc, rc);
    1171         char szUuid[AUDIOTEST_MAX_SEC_LEN];
    1172         rc = RTUuidToStr(&pObj->Uuid, szUuid, sizeof(szUuid));
     1158        rc = audioTestManifestWrite(pSet, "%04RU32", pSet->cTests);
    11731159        AssertRCReturn(rc, rc);
    1174         rc = audioTestManifestWriteSectionHdr(pSet, "obj_%s", szUuid);
     1160
     1161        /*
     1162         * Serialize all registered test objects.
     1163         */
     1164        rc = RTFileSeek(pSet->f.hFile, 0, RTFILE_SEEK_END, NULL);
    11751165        AssertRCReturn(rc, rc);
    1176         rc = audioTestManifestWrite(pSet, "obj_type=%RU32\n", pObj->enmType);
    1177         AssertRCReturn(rc, rc);
    1178         rc = audioTestManifestWrite(pSet, "obj_name=%s\n", pObj->szName);
    1179         AssertRCReturn(rc, rc);
    1180 
    1181         switch (pObj->enmType)
     1166
     1167        PAUDIOTESTOBJINT pObj;
     1168        RTListForEach(&pSet->lstObj, pObj, AUDIOTESTOBJINT, Node)
    11821169        {
    1183             case AUDIOTESTOBJTYPE_FILE:
     1170            rc = audioTestManifestWrite(pSet, "\n");
     1171            AssertRCReturn(rc, rc);
     1172            char szUuid[AUDIOTEST_MAX_SEC_LEN];
     1173            rc = RTUuidToStr(&pObj->Uuid, szUuid, sizeof(szUuid));
     1174            AssertRCReturn(rc, rc);
     1175            rc = audioTestManifestWriteSectionHdr(pSet, "obj_%s", szUuid);
     1176            AssertRCReturn(rc, rc);
     1177            rc = audioTestManifestWrite(pSet, "obj_type=%RU32\n", pObj->enmType);
     1178            AssertRCReturn(rc, rc);
     1179            rc = audioTestManifestWrite(pSet, "obj_name=%s\n", pObj->szName);
     1180            AssertRCReturn(rc, rc);
     1181
     1182            switch (pObj->enmType)
    11841183            {
    1185                 rc = audioTestManifestWrite(pSet, "obj_size=%RU64\n", pObj->File.cbSize);
    1186                 AssertRCReturn(rc, rc);
    1187                 break;
    1188             }
    1189 
    1190             default:
    1191                 AssertFailed();
    1192                 break;
    1193         }
    1194 
    1195         /*
    1196          * Write all meta data.
    1197          */
    1198         PAUDIOTESTOBJMETA pMeta;
    1199         RTListForEach(&pObj->lstMeta, pMeta, AUDIOTESTOBJMETA, Node)
    1200         {
    1201             switch (pMeta->enmType)
    1202             {
    1203                 case AUDIOTESTOBJMETADATATYPE_STRING:
     1184                case AUDIOTESTOBJTYPE_FILE:
    12041185                {
    1205                     rc = audioTestManifestWrite(pSet, (const char *)pMeta->pvMeta);
     1186                    rc = audioTestManifestWrite(pSet, "obj_size=%RU64\n", pObj->File.cbSize);
    12061187                    AssertRCReturn(rc, rc);
    12071188                    break;
     
    12121193                    break;
    12131194            }
     1195
     1196            /*
     1197             * Write all meta data.
     1198             */
     1199            PAUDIOTESTOBJMETA pMeta;
     1200            RTListForEach(&pObj->lstMeta, pMeta, AUDIOTESTOBJMETA, Node)
     1201            {
     1202                switch (pMeta->enmType)
     1203                {
     1204                    case AUDIOTESTOBJMETADATATYPE_STRING:
     1205                    {
     1206                        rc = audioTestManifestWrite(pSet, (const char *)pMeta->pvMeta);
     1207                        AssertRCReturn(rc, rc);
     1208                        break;
     1209                    }
     1210
     1211                    default:
     1212                        AssertFailed();
     1213                        break;
     1214                }
     1215            }
    12141216        }
    1215     }
    1216 
    1217     RTFileClose(pSet->f.hFile);
    1218     pSet->f.hFile = NIL_RTFILE;
     1217
     1218        RTFileClose(pSet->f.hFile);
     1219        pSet->f.hFile = NIL_RTFILE;
     1220    }
     1221    else if (pSet->enmMode == AUDIOTESTSETMODE_VERIFY)
     1222    {
     1223        RTIniFileRelease(pSet->f.hIniFile);
     1224        pSet->f.hIniFile = NIL_RTINIFILE;
     1225
     1226        rc = VINF_SUCCESS;
     1227    }
     1228    else /* Not supported, just skip. */
     1229        rc = VINF_SUCCESS;
    12191230
    12201231    return rc;
     
    15621573int AudioTestSetPack(PAUDIOTESTSET pSet, const char *pszOutDir, char *pszFileName, size_t cbFileName)
    15631574{
     1575    AssertPtrReturn(pSet, VERR_INVALID_POINTER);
    15641576    AssertReturn(!pszFileName || cbFileName, VERR_INVALID_PARAMETER);
    15651577    AssertReturn(!audioTestManifestIsOpen(pSet), VERR_WRONG_ORDER);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette