VirtualBox

Ignore:
Timestamp:
Feb 14, 2024 10:03:01 AM (12 months ago)
Author:
vboxsync
Message:

Validation Kit/tdAudioTest: More bugfixes for Python 2.x on the testboxes.

File:
1 edited

Legend:

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

    r103340 r103348  
    329329            iRc  = 0;
    330330
    331             # For Python 3.x we provide "real-time" output.
    332331            if sys.version_info[0] >= 3:
    333332                while oProcess.stdout.readable(): # pylint: disable=no-member
     
    335334                    if sStdOut:
    336335                        sStdOut = sStdOut.strip();
    337                         reporter.log('%s: %s' % (sWhat, sStdOut));
     336                        reporter.log('%s: %s' % (sWhat, sStdOut.rstrip('\n')));
     337                    self.processEvents(0);
    338338                    iRc = oProcess.poll();
    339339                    if iRc is not None:
    340340                        break;
    341             else:
    342                 # For Python 2.x it's too much hassle to set the file descriptor options (O_NONBLOCK) and stuff,
    343                 # so just use communicate() here and dump everythiong all at once when finished.
    344                 sStdOut = oProcess.communicate();
    345                 if sStdOut:
    346                     reporter.log('%s: %s' % (sWhat, sStdOut));
    347                 iRc = oProcess.poll();
     341            else: # Python 2.x cruft.
     342                while True:
     343                    sStdOut = oProcess.stdout.readline();
     344                    if  sStdOut == '' \
     345                    and oProcess.poll() is not None:
     346                        break;
     347                    self.processEvents(0);
     348                    reporter.log('%s [stdout]: %s' % (sWhat, sStdOut.rstrip('\n'),));
    348349
    349350            if iRc == 0:
     
    370371        return self.executeHstLoop(sWhat, asArgs, asEnv, fAsAdmin);
    371372
    372     def executeHst(self, sWhat, asArgs, asEnv = None, fAsAdmin = False, fBlocking = False):
     373    def executeHst(self, sWhat, asArgs, asEnv = None, fAsAdmin = False, fBlocking = True):
    373374        """
    374375        Runs a binary (image) with optional admin (root) rights on the host and
     
    389390        except: pass;
    390391
    391         if not fBlocking: # Run in same thread (blocking).
     392        if fBlocking: # Run in same thread (blocking).
    392393            fRc = self.executeHstLoop(sWhat, asArgs, asEnv, fAsAdmin);
    393394        else: # Run in separate thread (asynchronous).
     
    596597        reporter.log('Using VKAT on host at: \"%s\"' % (sVkatExe));
    597598
    598         # Run the VKAT self test.
    599         # Doesn't take long and gives us some more clue if it flies on the testboxes.
    600         reporter.testStart('VKAT Selftest');
    601         fRc = self.executeHst("VKAT Host Selftest", [ sVkatExe, 'selftest' ], fBlocking = True);
    602         reporter.testDone();
    603         if not fRc:
    604             return fRc;
    605 
    606599        reporter.testStart(sDesc);
    607600
     
    738731        if  not fSkip \
    739732        and self.fpApiVer < 7.0:
    740             reporter.log('Audio testing for non-trunk builds skipped.');
     733            reporter.log('Audio testing not available for this branch, skipping.');
    741734            fSkip = True;
    742 
    743         reporter.log('Verbosity level is: %d' % (reporter.getVerbosity(),));
    744 
    745         if not fSkip:
    746             sVkatExe = self.getBinTool('vkat');
    747             asArgs   = [ sVkatExe, 'enum', '--probe-backends' ];
    748             for _ in range(1, reporter.getVerbosity()): # Verbosity always is initialized at 1.
    749                 asArgs.extend([ '-v' ]);
    750             fRc      = self.executeHst("VKAT Host Audio Probing", asArgs);
    751             if not fRc:
    752                 # Not fatal, as VBox then should fall back to the NULL audio backend (also worth having as a test case).
    753                 reporter.log('Warning: Backend probing on host failed, no audio available (pure server installation?)');
    754735
    755736        if fSkip:
    756737            reporter.testDone(fSkipped = True);
    757738            return True;
     739
     740        reporter.log('Verbosity level is: %d' % (reporter.getVerbosity(),));
     741
     742        sVkatExe = self.getBinTool('vkat');
     743
     744        # Run the VKAT self test.
     745        # Doesn't take long and gives us some more clue if it flies on the testboxes.
     746        reporter.testStart('VKAT Selftest');
     747        fRc = self.executeHst("VKAT Host Selftest", [ sVkatExe, 'selftest' ]);
     748        reporter.testDone();
     749        if not fRc:
     750            return fRc;
     751
     752        # Now probe the backends.
     753        asArgs   = [ sVkatExe, 'enum', '--probe-backends' ];
     754        for _ in range(1, reporter.getVerbosity()): # Verbosity always is initialized at 1.
     755            asArgs.extend([ '-v' ]);
     756        fRc      = self.executeHst("VKAT Host Audio Probing", asArgs);
     757        if not fRc:
     758            # Not fatal, as VBox then should fall back to the NULL audio backend (also worth having as a test case).
     759            reporter.log('Warning: Backend probing on host failed, no audio available (pure server installation?)');
    758760
    759761        # Reconfigure the VM.
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