VirtualBox

Changeset 83927 in vbox for trunk/src/VBox/ValidationKit


Ignore:
Timestamp:
Apr 22, 2020 2:14:31 PM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
137473
Message:

Validation Kit/Additions: Don't download and install any dependencies required for installing the Guest Additions anymore; it's now documented and set as a rule that these must be pre-installed with the test VM. Should also speed up testing a lot.

File:
1 edited

Legend:

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

    r83908 r83927  
    343343        fRc = False;
    344344
    345         # Additional environment block to add to the following commands.
    346         asEnv = ();
    347 
    348         fNeedsProxy = True; ## @todo Make this more flexible / dynamic.
    349         sHttpProxy  = 'http://emea-proxy.uk.oracle.com:80/';
    350         sHttpsProxy = sHttpProxy;
    351 
    352         if fNeedsProxy:
    353             reporter.log('Using proxy: ' + sHttpProxy);
    354             asEnv += ('http_proxy='  + sHttpProxy, 'https_proxy=' + sHttpsProxy);
    355 
    356         cMsTimeout = 15 * 60 * 1000; # Use a 15 minutes timeout; needed for sloooow internet connections :-/
    357 
    358         # Install Kernel headers, which are required for actually installing the Linux Additions.
    359         if oTestVm.sKind.startswith('Debian') \
    360         or oTestVm.sKind.startswith('Ubuntu'):
    361 
    362             if fNeedsProxy:
    363                 fRc = oTxsSession.syncMkDirPath("/etc/apt/apt.conf.d/", 0o755);
    364                 if fRc:
    365                     fRc = oTxsSession.syncUploadString('Acquire::http::Proxy \"' + sHttpProxy + '\";\n'
    366                                                        'Acquire::https::Proxy \"' + sHttpsProxy + '\";',
    367                                                        '/etc/apt/apt.conf.d/proxy.conf', 0o644);
    368                     if not fRc:
    369                         reporter.error('Unable to write to /etc/apt/apt.conf.d/proxy.conf');
    370                 else:
    371                     reporter.error('Unable to create /etc/apt/apt.conf.d');
    372 
    373             # As Ubuntu 15.10 is EOL we need to tweak the package sources by hand first in order to have a working
    374             # package update path again; otherwise updating and installing packages will fail.
    375             if 'ubuntu-15_10' in oTestVm.sVmName:
    376                 fRc = self.txsRunTest(oTxsSession, 'Applying EOL upgrade path of Ubuntu 15.10', 5 * 60 *1000,
    377                                       '/bin/sed',
    378                                       ('/bin/sed', '-E', '-i',
    379                                        's/http:\\/\\/.*\\.ubuntu\\.com/http:\\/\\/old-releases.ubuntu.com/',
    380                                        '/etc/apt/sources.list'),
    381                                       fCheckSessionStatus = True);
     345        #
     346        # The actual install.
     347        # Also tell the installer to produce the appropriate log files.
     348        #
     349        # Make sure to add "--nox11" to the makeself wrapper in order to not getting any blocking
     350        # xterm window spawned.
     351        fRc = self.txsRunTest(oTxsSession, 'VBoxLinuxAdditions.run', 30 * 60 * 1000,
     352                                '/bin/sh', ('/bin/sh', '${CDROM}/VBoxLinuxAdditions.run', '--nox11'));
     353        ## @todo We need to figure out why the result is != 0 when running the .run installer. For now just ignore it.
     354        if not fRc:
     355            reporter.error('Installing Linux Additions failed (isSuccess=%s, iResult=%d, see log file for details)'
     356                            % (oTxsSession.isSuccess(), oTxsSession.getResult()));
     357
     358        #
     359        # Download log files.
     360        # Ignore errors as all files above might not be present for whatever reason.
     361        #
     362        asLogFile = [];
     363        asLogFile.append('/var/log/vboxadd-install.log');
     364        self.txsDownloadFiles(oSession, oTxsSession, asLogFile, fIgnoreErrors = True);
     365
     366        # Do the final reboot to get the just installed Guest Additions up and running.
     367        if fRc:
     368            reporter.testStart('Rebooting guest w/ updated Guest Additions active');
     369            (fRc, oTxsSession) = self.txsRebootAndReconnectViaTcp(oSession, oTxsSession, 15 * 60 * 1000,
     370                                                                    sFileCdWait = self.sFileCdWait);
    382371            if fRc:
    383                 fRc = self.txsRunTest(oTxsSession, 'Updating package sources', cMsTimeout,
    384                                       '/usr/bin/apt-get', ('/usr/bin/apt-get', 'update'),
    385                                       asAddEnv = asEnv,
    386                                       fCheckSessionStatus = True);
    387             if fRc:
    388                 fRc = self.txsRunTest(oTxsSession, 'Installing Kernel headers', cMsTimeout,
    389                                       '/usr/bin/apt-get', ('/usr/bin/apt-get', 'install', '-y', 'linux-headers-generic'),
    390                                       asAddEnv = asEnv,
    391                                       fCheckSessionStatus = True);
    392             if fRc:
    393                 fRc = self.txsRunTest(oTxsSession, 'Installing Guest Additions depdendencies', cMsTimeout, \
    394                                       '/usr/bin/apt-get', ('/usr/bin/apt-get', 'install', '-y', 'build-essential', 'perl'),
    395                                       asAddEnv = asEnv,
    396                                       fCheckSessionStatus = True);
    397         elif oTestVm.sKind.startswith('OL') \
    398         or   oTestVm.sKind.startswith('Oracle') \
    399         or   oTestVm.sKind.startswith('RHEL') \
    400         or   oTestVm.sKind.startswith('Redhat') \
    401         or   oTestVm.sKind.startswith('Cent'):
    402 
    403             fRc = self.txsRunTest(oTxsSession, 'Updating package sources', cMsTimeout,
    404                                                '/usr/bin/yum', ('/usr/bin/yum', '-y', 'updateinfo'),
    405                                                asAddEnv = asEnv,
    406                                                fCheckSessionStatus = True);
    407             if fRc:
    408                 fRc = self.txsRunTest(oTxsSession, 'Installing Kernel headers', cMsTimeout,
    409                                       '/usr/bin/yum', ('/usr/bin/yum', '-y', 'install', 'kernel-headers'),
    410                                       asAddEnv = asEnv,
    411                                       fCheckSessionStatus = True);
    412             if fRc:
    413                 fRc = self.txsRunTest(oTxsSession, 'Installing Guest Additions depdendencies', cMsTimeout, \
    414                                       '/usr/bin/yum', ('/usr/bin/yum', '-y', 'install', \
    415                                                    'make', 'automake', 'gcc', 'kernel-devel', 'dkms', 'bzip2', 'perl'),
    416                                       asAddEnv = asEnv,
    417                                       fCheckSessionStatus = True);
    418         else:
    419             reporter.error('Installing Linux Additions for kind "%s" is not supported yet' % oTestVm.sKind);
    420             return (False, oTxsSession);
    421 
    422         if fRc:
    423             # Make sure the new, updated kernel is in charge, which eventually got installed by the updating stuff above.
    424             # Otherwise building the Guest Additions module might not work correctly.
    425             reporter.testStart('Rebooting guest w/ latest kernel active');
    426             (fRc, oTxsSession) = self.txsRebootAndReconnectViaTcp(oSession, oTxsSession, cMsTimeout,
    427                                                                   sFileCdWait = self.sFileCdWait);
    428             if fRc is True:
    429                 reporter.testDone();
    430 
    431                 #
    432                 # The actual install.
    433                 # Also tell the installer to produce the appropriate log files.
    434                 #
    435                 # Make sure to add "--nox11" to the makeself wrapper in order to not getting any blocking
    436                 # xterm window spawned.
    437                 fRc = self.txsRunTest(oTxsSession, 'VBoxLinuxAdditions.run', 30 * 60 * 1000,
    438                                       '/bin/sh', ('/bin/sh', '${CDROM}/VBoxLinuxAdditions.run', '--nox11'));
    439                 ## @todo We need to figure out why the result is != 0 when running the .run installer. For now just ignore it.
    440                 if not fRc:
    441                     reporter.error('Installing Linux Additions failed (isSuccess=%s, iResult=%d, see log file for details)'
    442                                    % (oTxsSession.isSuccess(), oTxsSession.getResult()));
    443 
    444                 #
    445                 # Download log files.
    446                 # Ignore errors as all files above might not be present for whatever reason.
    447                 #
    448                 asLogFile = [];
    449                 asLogFile.append('/var/log/vboxadd-install.log');
    450                 self.txsDownloadFiles(oSession, oTxsSession, asLogFile, fIgnoreErrors = True);
    451 
    452                 # Do the final reboot to get the just installed Guest Additions up and running.
    453                 if fRc:
    454                     reporter.testStart('Rebooting guest w/ updated Guest Additions active');
    455                     (fRc, oTxsSession) = self.txsRebootAndReconnectViaTcp(oSession, oTxsSession, cMsTimeout,
    456                                                                           sFileCdWait = self.sFileCdWait);
    457                     if fRc:
    458                         pass
    459                     else:
    460                         reporter.testFailure('Rebooting and reconnecting to TXS service failed');
    461                     reporter.testDone();
     372                pass
    462373            else:
    463374                reporter.testFailure('Rebooting and reconnecting to TXS service failed');
    464                 reporter.testDone();
     375            reporter.testDone();
    465376
    466377        return (fRc, oTxsSession);
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette