VirtualBox

Changeset 90129 in vbox


Ignore:
Timestamp:
Jul 9, 2021 2:33:26 PM (4 years ago)
Author:
vboxsync
Message:

Audio/ValKit: More fixes and additions for the Validation Kit test driver. bugref:10008

File:
1 edited

Legend:

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

    r90099 r90129  
    166166        return (False, "");
    167167
     168    def killProcessByName(self, sProcName):
     169        """
     170        Kills processes by their name.
     171        """
     172        if sys.platform == 'win32':
     173            os.system('taskkill /IM "%s.exe" /F' % (sProcName));
     174        else:
     175            os.system('killall -9 %s' % (sProcName));
     176
     177    def killHstVkat(self):
     178        """
     179        Kills VKAT (VBoxAudioTest) on the host side.
     180        """
     181        self.killProcessByName("vkat");
     182        self.killProcessByName("VBoxAudioTest");
     183
    168184    def _getVkatResult(self, oTxsSession):
    169185        """
     
    181197        Starts VKAT on the guest (running in background).
    182198        """
    183         sDesc          = 'Starting VKAT on guest';
    184 
    185199        sPathTemp      = self.getGuestTempDir(oTestVm);
    186200        sPathAudioOut  = oTestVm.pathJoin(sPathTemp, 'vkat-guest-out');
     
    202216            aArgs.extend(['--daemonize']);
    203217
    204             fRc = self.txsRunTest(oTxsSession, sDesc, 15 * 60 * 1000,
     218            fRc = self.txsRunTest(oTxsSession, 'Starting VKAT on guest', 15 * 60 * 1000,
    205219                                  sVkatExe, aArgs);
    206220            if not fRc:
    207221                reporter.error('VKAT on guest returned exit code error %d' % (self._getVkatResult(oTxsSession)));
     222        else:
     223            reporter.error('VKAT on guest not found');
    208224
    209225        return fRc;
     
    245261        #
    246262        procVkat = subprocess.Popen(sArgs, \
    247                                     stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True);
     263                                    stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True);
    248264        if procVkat:
    249             while procVkat.poll() is None:
    250                 sLine = procVkat.stdout.readline().rstrip();
    251                 if sLine:
    252                     reporter.log(sLine);
    253 
    254             if procVkat.returncode != 0:
    255                 reporter.testFailure('VKAT on the host failed with exit code %d' % (procVkat.returncode));
     265            reporter.log('VKAT on host started');
     266
     267            out, err = procVkat.communicate();
     268            rc = procVkat.poll();
     269
     270            out = out.decode(sys.stdin.encoding);
     271            for line in out.split('\n'):
     272                reporter.log(line);
     273
     274            err = err.decode(sys.stdin.encoding);
     275            for line in err.split('\n'):
     276                reporter.log(line);
     277
     278            reporter.log('VKAT on host ended with exit code %d' % rc);
     279            if rc != 0:
     280                reporter.testFailure('VKAT on the host failed');
    256281                fRc = False;
    257282        else:
     
    267292        Executes the specified audio tests.
    268293        """
     294
     295        # First try to kill any old VKAT / VBoxAudioTest processes lurking around on the host.
     296        # Might happen because of former (aborted) runs.
     297        self.killHstVkat();
     298
    269299        fRc = self.startVkatOnGuest(oTestVm, oSession, oTxsSession);
    270300        if fRc:
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