VirtualBox

Changeset 77469 in vbox for trunk/src


Ignore:
Timestamp:
Feb 26, 2019 12:25:43 PM (6 years ago)
Author:
vboxsync
Message:

Validation Kit/tdAddBasic1.py: Added initial Linux Additions installation testing support.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/tests/additions/tdAddBasic1.py

    r76553 r77469  
    3030__version__ = "$Revision$"
    3131
     32# pylint: disable=unnecessary-semicolon
    3233
    3334# Standard Python imports.
     
    6364        vbox.TestDriver.__init__(self);
    6465        self.oTestVmSet = self.oTestVmManager.getSmokeVmSet('nat');
    65         self.asTestsDef = ['guestprops', 'stdguestprops', 'guestcontrol'];
     66        self.asTestsDef = ['install', 'guestprops', 'stdguestprops', 'guestcontrol'];
    6667        self.asTests    = self.asTestsDef;
    6768        self.asRsrcs    = None
     
    133134        fRc = False;
    134135
     136        if oTestVm.isWindows():
     137            sFileCdWait = 'VBoxWindowsAdditions.exe';
     138        elif oTestVm.isLinux():
     139            sFileCdWait = 'VBoxLinuxAdditions.run';
     140
    135141        self.logVmInfo(oVM);
    136         oSession, oTxsSession = self.startVmAndConnectToTxsViaTcp(oTestVm.sVmName, fCdWait = True, \
    137                                                                   sFileCdWait = 'AUTORUN.INF');
     142        oSession, oTxsSession = self.startVmAndConnectToTxsViaTcp(oTestVm.sVmName, fCdWait = True, sFileCdWait = sFileCdWait);
    138143        if oSession is not None:
    139144            self.addTask(oTxsSession);
    140145            # Do the testing.
     146            fSkip = 'install' not in self.asTests;
    141147            reporter.testStart('Install');
    142             fRc, oTxsSession = self.testInstallAdditions(oSession, oTxsSession, oTestVm);
    143             reporter.testDone();
    144             fSkip = not fRc;
    145 
     148            if not fSkip:
     149                fRc, oTxsSession = self.testInstallAdditions(oSession, oTxsSession, oTestVm);
     150            reporter.testDone(fSkip);
     151
     152            fSkip = 'guestprops' not in self.asTests;
    146153            reporter.testStart('Guest Properties');
    147154            if not fSkip:
     
    149156            reporter.testDone(fSkip);
    150157
     158            fSkip = 'guestcontrol' not in self.asTests;
    151159            reporter.testStart('Guest Control');
    152160            if not fSkip:
    153                 (fRc2, oTxsSession) = self.aoSubTstDrvs[0].testIt(oTestVm, oSession, oTxsSession);
    154                 fRc = fRc2 and fRc;
     161                fRc, oTxsSession = self.aoSubTstDrvs[0].testIt(oTestVm, oSession, oTxsSession);
    155162            reporter.testDone(fSkip);
    156163
     
    172179        if oTestVm.isWindows():
    173180            (fRc, oTxsSession) = self.testWindowsInstallAdditions(oSession, oTxsSession, oTestVm);
     181        elif oTestVm.isLinux():
     182            (fRc, oTxsSession) = self.testLinuxInstallAdditions(oSession, oTxsSession, oTestVm);
    174183        else:
    175184            reporter.error('Guest Additions installation not implemented for %s yet! (%s)' % \
     
    279288        return (fRc, oTxsSession);
    280289
     290    def testLinuxInstallAdditions(self, oSession, oTxsSession, oTestVm):
     291        oSession = oSession;
     292        oTestVm = oTestVm;
     293
     294        fRc = False;
     295
     296        # Install Kernel headers, which are required for actually installing the Linux Additions.
     297        if oTestVm.sKind.startswith('Debian') \
     298        or oTestVm.sKind.startswith('Ubuntu'):
     299            fRc = self.txsRunTest(oTxsSession, 'Installing Kernel headers', 5 * 60 *1000,
     300                                  '/usr/bin/apt-get', ('/usr/bin/apt-get', 'install', '-y', 'linux-headers-generic'));
     301            if not fRc:
     302                reporter.error('Error installing Kernel headers');
     303            fRc = self.txsRunTest(oTxsSession, 'Installing Guest Additions depdendencies', 5 * 60 *1000, \
     304                                  '/usr/bin/apt-get', ('/usr/bin/apt-get', 'install', '-y', 'build-essential', 'perl'));
     305            if not fRc:
     306                reporter.error('Error installing additional installer dependencies');
     307        elif oTestVm.sKind.startswith('OL') \
     308        or   oTestVm.sKind.startswith('Oracle') \
     309        or   oTestVm.sKind.startswith('RHEL') \
     310        or   oTestVm.sKind.startswith('Redhat') \
     311        or   oTestVm.sKind.startswith('Cent'):
     312            fRc = self.txsRunTest(oTxsSession, 'Installing Kernel headers', 5 * 60 *1000,
     313                                  '/usr/bin/yum', ('/usr/bin/yum', '-y', 'install', 'kernel-headers'));
     314            if not fRc:
     315                reporter.error('Error installing Kernel headers');
     316            fRc = self.txsRunTest(oTxsSession, 'Installing Guest Additions depdendencies', 5 * 60 *1000, \
     317                                  '/usr/bin/yum', ('/usr/bin/yum', '-y', 'install', \
     318                                                   'make', 'automake', 'gcc', 'kernel-devel', 'dkms', 'bzip2', 'perl'));
     319            if not fRc:
     320                reporter.error('Error installing additional installer dependencies');
     321        else:
     322            reporter.error('Installing Linux Additions for kind "%s" is not supported yet' % oTestVm.sKind);
     323            return (False, oTxsSession);
     324
     325        if fRc:
     326            #
     327            # The actual install.
     328            # Also tell the installer to produce the appropriate log files.
     329            #
     330            fRc = self.txsRunTest(oTxsSession, 'VBoxLinuxAdditions.run', 5 * 60 * 1000,
     331                '/bin/sh', ('/bin/sh', '${CDROM}/VBoxLinuxAdditions.run'));
     332            if not fRc:
     333                reporter.error('Installing Linux Additions failed (see log file for details)');
     334
     335            #
     336            # Download log files.
     337            # Ignore errors as all files above might not be present for whatever reason.
     338            #
     339            asLogFile = [];
     340            asLogFile.append('/var/log/vboxadd-install.log');
     341            self.txsDownloadFiles(oSession, oTxsSession, asLogFile, fIgnoreErrors = True);
     342
     343        if fRc:
     344            (fRc, oTxsSession) = self.txsRebootAndReconnectViaTcp(oSession, oTxsSession, cMsTimeout = 3 * 60000);
     345
     346        return (fRc, oTxsSession);
     347
    281348    def testIGuest_additionsVersion(self, oGuest):
    282349        """
     
    338405if __name__ == '__main__':
    339406    sys.exit(tdAddBasic1().main(sys.argv));
    340 
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