VirtualBox

Changeset 91119 in vbox


Ignore:
Timestamp:
Sep 6, 2021 9:35:26 AM (3 years ago)
Author:
vboxsync
Message:

Audio/Validation Kit: Separated the audio testing and the actual audio verification into two steps to have a more fine-grained result in the test manager. Also, now using more meaningful test tags which contain a timestamp and the VM name for easier retrieval / identification. ​bugref:10008

Location:
trunk/src/VBox/ValidationKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/tests/audio/tdAudioTest.py

    r91118 r91119  
    3434
    3535# Standard Python imports.
     36from datetime import datetime
    3637import os
    3738import sys
    3839import signal
    3940import subprocess
    40 import uuid
    4141
    4242# Only the main script needs to modify the path.
     
    397397        return iRc;
    398398
    399     def startVkatOnGuest(self, oTestVm, oSession, oTxsSession):
     399    def startVkatOnGuest(self, oTestVm, oSession, oTxsSession, sTag):
    400400        """
    401401        Starts VKAT on the guest (running in background).
     
    407407        reporter.log('Guest audio test temp path is \"%s\"' % (sPathAudioOut));
    408408        reporter.log('Guest audio test output path is \"%s\"' % (sPathAudioTemp));
     409        reporter.log('Guest audio test tag is \"%s\"' % (sTag));
    409410
    410411        fRc, sVkatExe = self.locateGstVkat(oSession, oTxsSession);
     
    415416
    416417            asArgsVkat = [ sVkatExe, 'test', '--mode', 'guest', '--probe-backends', \
    417                            '--tempdir', sPathAudioTemp, '--outdir', sPathAudioOut ];
     418                           '--tempdir', sPathAudioTemp, '--outdir', sPathAudioOut, \
     419                           '--tag', sTag ];
    418420
    419421            asArgs.extend(asArgsVkat);
     
    467469        return fRc;
    468470
    469     def runTests(self, oTestVm, oSession, oTxsSession, sDesc, asTests):
     471    def runTests(self, oTestVm, oSession, oTxsSession, sDesc, sTag, asTests):
    470472        """
    471473        Runs one or more tests using VKAT on the host, which in turn will
     
    474476        """
    475477        _              = oSession, oTxsSession;
    476         sTag           = uuid.uuid4();
    477478
    478479        sPathTemp      = self.sScratchPath;
     
    492493        # Build the base command line, exclude all tests by default.
    493494        asArgs = [ sVkatExe, 'test', '--mode', 'host', '--probe-backends', \
    494                              '--tempdir', sPathAudioTemp, '--outdir', sPathAudioOut, '-a' ];
     495                             '--tempdir', sPathAudioTemp, '--outdir', sPathAudioOut, '-a', \
     496                             '--tag', sTag, \
     497                             '--no-verify' ]; # We do the verification separately in the step below.
    495498
    496499        for _ in range(1, reporter.getVerbosity()): # Verbosity always is initialized at 1.
     
    507510        reporter.testDone();
    508511
     512        if fRc:
     513            #
     514            # When running the test(s) above were successful, do the verification step next.
     515            # This gives us a bit more fine-grained test results in the test manager.
     516            #
     517            reporter.testStart('Verifying audio data');
     518
     519            sNameSetHst = '%s-host.tar.gz' % (sTag);
     520            sPathSetHst = oTestVm.pathJoin(sPathAudioOut, sNameSetHst);
     521            sNameSetGst = '%s-guest.tar.gz' % (sTag);
     522            sPathSetGst = oTestVm.pathJoin(sPathAudioOut, sNameSetGst);
     523
     524            asArgs = [ sVkatExe, 'verify', sPathSetHst, sPathSetGst ];
     525
     526            for _ in range(1, reporter.getVerbosity()): # Verbosity always is initialized at 1.
     527                asArgs.extend([ '-v' ]);
     528
     529            fRc = self.executeHst("VKAT Host Verify", asArgs);
     530            if fRc:
     531                reporter.error("Verification audio data successful");
     532            else:
     533                #
     534                # Add the test sets to the test manager for later (manual) diagnosis.
     535                #
     536                reporter.addLogFile(sPathSetGst, 'misc/other', 'Guest audio test set');
     537                reporter.addLogFile(sPathSetHst, 'misc/other', 'Host audio test set');
     538
     539                reporter.error("Verification of audio data failed");
     540
     541            reporter.testDone();
     542
    509543        return fRc;
    510544
     
    527561        reporter.log("Active tests: %s" % (self.asTests,));
    528562
    529         fRc = self.startVkatOnGuest(oTestVm, oSession, oTxsSession);
     563        # Define a tag for the whole run.
     564        sTag = oTestVm.sVmName + "_" + datetime.now().strftime("%Y%m%d_%H%M%S");
     565
     566        fRc = self.startVkatOnGuest(oTestVm, oSession, oTxsSession, sTag);
    530567        if fRc:
    531568            #
     
    533570            #
    534571            if "guest_tone_playback" in self.asTests:
    535                 fRc = self.runTests(oTestVm, oSession, oTxsSession, 'Guest audio playback', asTests = [ '-i0' ]);
     572                fRc = self.runTests(oTestVm, oSession, oTxsSession, \
     573                                    'Guest audio playback', sTag + "_test_playback", \
     574                                    asTests = [ '-i0' ]);
    536575            if "guest_tone_recording" in self.asTests:
    537                 fRc = fRc and self.runTests(oTestVm, oSession, oTxsSession, 'Guest audio recording', asTests = [ '-i1' ]);
     576                fRc = fRc and self.runTests(oTestVm, oSession, oTxsSession, \
     577                                            'Guest audio recording', sTag + "_test_recording", \
     578                                            asTests = [ '-i1' ]);
    538579
    539580            # Cancel guest VKAT execution task summoned by startVkatOnGuest().
  • trunk/src/VBox/ValidationKit/utils/audio/vkat.cpp

    r91088 r91119  
    670670                    RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Verification skipped\n");
    671671
    672                 RTFileDelete(pTstEnv->u.Host.szPathTestSetGuest);
    673                 RTFileDelete(pTstEnv->u.Host.szPathTestSetValKit);
     672                if (!pTstEnv->fSkipVerify)
     673                {
     674                    RTFileDelete(pTstEnv->u.Host.szPathTestSetGuest);
     675                    RTFileDelete(pTstEnv->u.Host.szPathTestSetValKit);
     676                }
     677                else
     678                    RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Leaving test set files behind\n");
    674679            }
    675680        }
     
    750755    int         rc;
    751756
    752     const char *pszTag        = NULL; /* Custom tag to use. Can be NULL if not being used. */
    753757    PCPDMDRVREG pDrvReg       = AudioTestGetDefaultBackend();
    754758    bool        fWithDrvAudio = false;
     
    862866
    863867            case VKAT_TEST_OPT_TAG:
    864                 pszTag = ValueUnion.psz;
     868                rc = RTStrCopy(TstEnv.szTag, sizeof(TstEnv.szTag), ValueUnion.psz);
     869                if (RT_FAILURE(rc))
     870                    return RTMsgErrorExit(RTEXITCODE_FAILURE, "Tag invalid, rc=%Rrc", rc);
    865871                break;
    866872
     
    978984
    979985    const bool fPacked = AudioTestSetIsPacked(pszPathSet);
     986
    980987    if (fPacked)
    981988    {
    982989        RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Test set is an archive and needs to be unpacked\n");
    983990
    984         char szPathTemp[RTPATH_MAX];
    985         rc = RTPathTemp(szPathTemp, sizeof(szPathTemp));
     991        if (!RTFileExists(pszPathSet))
     992        {
     993            RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Test set '%s' does not exist\n", pszPathSet);
     994            rc = VERR_FILE_NOT_FOUND;
     995        }
     996        else
     997            rc = VINF_SUCCESS;
     998
    986999        if (RT_SUCCESS(rc))
    9871000        {
    988             RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Using temporary directory '%s'\n", szPathTemp);
    989 
    990             rc = RTPathJoin(szPathExtracted, sizeof(szPathExtracted), szPathTemp, "vkat-testset-XXXX");
     1001            char szPathTemp[RTPATH_MAX];
     1002            rc = RTPathTemp(szPathTemp, sizeof(szPathTemp));
    9911003            if (RT_SUCCESS(rc))
    9921004            {
    993                 rc = RTDirCreateTemp(szPathExtracted, 0755);
     1005                RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Using temporary directory '%s'\n", szPathTemp);
     1006
     1007                rc = RTPathJoin(szPathExtracted, sizeof(szPathExtracted), szPathTemp, "vkat-testset-XXXX");
    9941008                if (RT_SUCCESS(rc))
    9951009                {
    996                     RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Unpacking archive to '%s'\n", szPathExtracted);
    997                     rc = AudioTestSetUnpack(pszPathSet, szPathExtracted);
     1010                    rc = RTDirCreateTemp(szPathExtracted, 0755);
    9981011                    if (RT_SUCCESS(rc))
    999                         RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Archive successfully unpacked\n");
     1012                    {
     1013                        RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Unpacking archive to '%s'\n", szPathExtracted);
     1014                        rc = AudioTestSetUnpack(pszPathSet, szPathExtracted);
     1015                        if (RT_SUCCESS(rc))
     1016                            RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Archive successfully unpacked\n");
     1017                    }
    10001018                }
    10011019            }
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