VirtualBox

Changeset 89139 in vbox for trunk/src/VBox/ValidationKit


Ignore:
Timestamp:
May 18, 2021 1:29:24 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
144480
Message:

Audio/ValKit: Implemented unpacking and verification of packed audio test archives. bugref:10008

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/utils/audio/vkat.cpp

    r89136 r89139  
    3131#include <iprt/buildconfig.h>
    3232#include <iprt/ctype.h>
     33#include <iprt/dir.h>
    3334#include <iprt/errcore.h>
    3435#include <iprt/initterm.h>
     
    19421943static int audioVerifyOne(const char *pszPath, const char *pszTag)
    19431944{
    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    }
    19451982
    19461983    AUDIOTESTSET tstSet;
    1947     int rc = AudioTestSetOpen(&tstSet, pszPath);
     1984    rc = AudioTestSetOpen(&tstSet, fPacked ? szPathExtracted : pszPath);
    19481985    if (RT_SUCCESS(rc))
    19491986    {
     
    20272064            RTTestBanner(g_hTest);
    20282065        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);
    20312070    }
    20322071
     
    22792318    {
    22802319        "test",     audioTestMain,
    2281         "Does some kind of testing, I guess...",
     2320        "Runs audio tests and creates an audio test set.",
    22822321        g_aCmdTestOptions,      RT_ELEMENTS(g_aCmdTestOptions),     audioTestCmdTestHelp
    22832322    },
    22842323    {
    22852324        "verify",   audioVerifyMain,
    2286         "Verfies something, I guess...",
     2325        "Verifies a formerly created audio test set.",
    22872326        g_aCmdVerifyOptions,    RT_ELEMENTS(g_aCmdVerifyOptions),   NULL,
    22882327    },
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