VirtualBox

Changeset 91123 in vbox


Ignore:
Timestamp:
Sep 6, 2021 1:23:14 PM (3 years ago)
Author:
vboxsync
Message:

Audio/Validation Kit: Try harder finding the su binary on the guest, might be different on some guests. Fall back to starting VKAT with the same privileges as TxS if not found. ​bugref:10008

File:
1 edited

Legend:

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

    r91119 r91123  
    205205        return oTestVm.pathJoin(self.getGuestTempDir(oTestVm), 'vkat-guest.log');
    206206
    207     def locateGstVkat(self, oSession, oTxsSession):
    208         """
    209         Returns guest side path to VKAT.
    210         """
    211         for sVkatPath in self.asGstVkatPaths:
    212             reporter.log2('Checking for VKAT at: %s ...' % (sVkatPath));
    213             if self.txsIsFile(oSession, oTxsSession, sVkatPath, fIgnoreErrors = True):
    214                 return (True, sVkatPath);
    215         reporter.error('Unable to find guest VKAT in any of these places:\n%s' % ('\n'.join(self.asGstVkatPaths),));
     207    def locateGstBinary(self, oSession, oTxsSession, asPaths):
     208        """
     209        Locates a guest binary on the guest by checking the paths in \a asPaths.
     210        """
     211        for sCurPath in asPaths:
     212            reporter.log2('Checking for \"%s\" ...' % (sCurPath));
     213            if self.txsIsFile(oSession, oTxsSession, sCurPath, fIgnoreErrors = True):
     214                return (True, sCurPath);
     215        reporter.error('Unable to find guest binary in any of these places:\n%s' % ('\n'.join(asPaths),));
    216216        return (False, "");
    217217
     
    409409        reporter.log('Guest audio test tag is \"%s\"' % (sTag));
    410410
    411         fRc, sVkatExe = self.locateGstVkat(oSession, oTxsSession);
     411        fRc, sVkatExe = self.locateGstBinary(oSession, oTxsSession, self.asGstVkatPaths);
    412412        if fRc:
    413413            reporter.log('Using VKAT on guest at \"%s\"' % (sVkatExe));
    414414
     415            sCmd   = '';
    415416            asArgs = [];
    416417
     
    435436                # as the Test Execution Service (TxS) currently does not implement impersonation yet.
    436437                #
    437                 sCmd     = '/usr/bin/su';
    438                 sCmdArgs = '';
    439                 for sArg in asArgs:
    440                     sCmdArgs += sArg + " ";
    441                 asArgs   = [ sCmd, 'vbox', '-c', sCmdArgs ];
    442             else: # Just start it with the same privileges as TxS.
    443                 sCmd     = sVkatExe;
     438                asSU         = [ '/bin/su',
     439                                 '/usr/bin/su',
     440                                 '/usr/local/bin/su' ];
     441                fRc, sCmd    = self.locateGstBinary(oSession, oTxsSession, asSU);
     442                if fRc:
     443                    sCmdArgs = '';
     444                    for sArg in asArgs:
     445                        sCmdArgs += sArg + " ";
     446                    asArgs   = [ sCmd, 'vbox', '-c', sCmdArgs ];
     447                else:
     448                    reporter.log('Unable to find SU on guest, falling back to regular starting ...')
     449
     450            if not sCmd: # Just start it with the same privileges as TxS.
     451                sCmd = sVkatExe;
    444452
    445453            reporter.log2('startVkatOnGuest: sCmd=%s' % (sCmd,));
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