VirtualBox

Changeset 79452 in vbox


Ignore:
Timestamp:
Jul 1, 2019 4:49:51 PM (5 years ago)
Author:
vboxsync
Message:

ValKit/UnattendedInst1,++: Adjustments for ubuntu. bugref:9151

Location:
trunk/src/VBox/ValidationKit/tests
Files:
3 edited

Legend:

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

    r79394 r79452  
    22352235
    22362236        #
    2237         # Parameters.
     2237        # Tests:
    22382238        #
    22392239        atTests = [
    22402240            # Invalid parameters.
    2241             [ tdTestSession(sUser = ''), tdTestResultSession() ],
    2242             [ tdTestSession(sPassword = 'bar'), tdTestResultSession() ],
    2243             [ tdTestSession(sDomain = 'boo'),tdTestResultSession() ],
    2244             [ tdTestSession(sPassword = 'bar', sDomain = 'boo'), tdTestResultSession() ],
     2241            [ tdTestSession(sUser = ''),                                        tdTestResultSession() ],
    22452242            # User account without a passwort - forbidden.
    2246             [ tdTestSession(sPassword = "" ), tdTestResultSession() ],
    2247             # Wrong credentials.
    2248             # Note: On Guest Additions < 4.3 this always succeeds because these don't
     2243            [ tdTestSession(sPassword = "" ),                                   tdTestResultSession() ],
     2244            # Various wrong credentials.
     2245            # Note! Only windows cares about sDomain, the other guests ignores it.
     2246            # Note! On Guest Additions < 4.3 this always succeeds because these don't
    22492247            #       support creating dedicated sessions. Instead, guest process creation
    22502248            #       then will fail. See note below.
     2249            [ tdTestSession(sPassword = 'bar'),                                 tdTestResultSession() ],
     2250            [ tdTestSession(sUser = 'foo', sPassword = 'bar'),                  tdTestResultSession() ],
     2251            [ tdTestSession(sPassword = 'bar', sDomain = 'boo'),                tdTestResultSession() ],
    22512252            [ tdTestSession(sUser = 'foo', sPassword = 'bar', sDomain = 'boo'), tdTestResultSession() ],
    2252             # Correct credentials.
    2253             [ tdTestSession(), tdTestResultSession(fRc = True, cNumSessions = 1) ]
    22542253        ];
    2255 
     2254        if oTestVm.isWindows(): # domain is ignored elsewhere.
     2255            atTests.append([ tdTestSession(sDomain = 'boo'),                    tdTestResultSession() ]);
     2256
     2257        # Finally, correct credentials.
     2258        atTests.append([ tdTestSession(),           tdTestResultSession(fRc = True, cNumSessions = 1) ]);
     2259
     2260        #
     2261        # Run the tests.
     2262        #
    22562263        fRc = True;
    22572264        for (i, tTest) in enumerate(atTests):
     
    27392746                # Basic execution.
    27402747                [ tdTestExec(sCmd = sImageOut, asArgs = [ sImageOut, '-R', sSystemDir ]),
    2741                   tdTestResultExec(fRc = True, iExitCode = 1) ],
     2748                  tdTestResultExec(fRc = True) ],
    27422749                [ tdTestExec(sCmd = sImageOut, asArgs = [ sImageOut, sFileForReading ]),
    27432750                  tdTestResultExec(fRc = True) ],
     
    28082815            oCurRes  = tTest[1]  # type: tdTestResultExec
    28092816            oCurTest.setEnvironment(oSession, oTxsSession, oTestVm);
    2810             fRc, oCurGuestSession = oCurTest.createSession('testGuestCtrlExec: Test #%d' % (i,));
    2811             if fRc is not True:
    2812                 reporter.error('Test #%d failed: Could not create session' % (i,));
     2817            fRc2, oCurGuestSession = oCurTest.createSession('testGuestCtrlExec: Test #%d' % (i,));
     2818            if fRc2 is not True:
     2819                fRc = reporter.error('Test #%d failed: Could not create session' % (i,));
    28132820                break;
    2814             fRc = self.gctrlExecDoTest(i, oCurTest, oCurRes, oCurGuestSession);
    2815             if fRc is not True:
    2816                 break;
    2817             fRc = oCurTest.closeSession();
    2818             if fRc is not True:
    2819                 break;
     2821            fRc = self.gctrlExecDoTest(i, oCurTest, oCurRes, oCurGuestSession) and fRc;
     2822            fRc = oCurTest.closeSession() and fRc;
    28202823
    28212824        reporter.log('Execution of all tests done, checking for stale sessions');
     
    34363439        ];
    34373440        for sDir in asTestDirs:
    3438             if oTxsSession.syncMkDir(sDir) is not True:
     3441            if oTxsSession.syncMkDir(sDir, 0o777) is not True:
    34393442                return reporter.error('Failed to create test dir "%s"!' % (sDir,));
    34403443        for sFile in asTestFiles:
    3441             if oTxsSession.syncUploadString(sFile, sFile) is not True:
     3444            if oTxsSession.syncUploadString(sFile, sFile, 0o666) is not True:
    34423445                return reporter.error('Failed to create test file "%s"!' % (sFile,));
    34433446
     
    35243527                # Recursively delete the entire test file tree from the root up.
    35253528                #
     3529                # Note! On unix we cannot delete the root dir itself since it is residing
     3530                #       in /var/tmp where only the owner may delete it.  Root is the owner.
     3531                #
     3532                if oTestVm.isWindows() or oTestVm.isOS2():
     3533                    afFlags = [vboxcon.DirectoryRemoveRecFlag_ContentAndDir,];
     3534                else:
     3535                    afFlags = [vboxcon.DirectoryRemoveRecFlag_ContentOnly,];
    35263536                try:
    3527                     oProgress = oCurGuestSession.directoryRemoveRecursive(self.oTestFiles.oRoot.sPath,
    3528                                                                           [vboxcon.DirectoryRemoveRecFlag_ContentAndDir,]);
     3537                    oProgress = oCurGuestSession.directoryRemoveRecursive(self.oTestFiles.oRoot.sPath, afFlags);
    35293538                except:
    35303539                    fRc = reporter.errorXcpt('Removing tree "%s" failed' % (self.oTestFiles.oRoot.sPath,));
    35313540                else:
    3532                     reporter.log2('#3: fRc=%s' % (fRc));
    35333541                    oWrappedProgress = vboxwrappers.ProgressWrapper(oProgress, self.oTstDrv.oVBoxMgr, self.oTstDrv,
    35343542                                                                    "remove-tree-root: %s" % (self.oTestFiles.oRoot.sPath,));
     
    37043712        sContent = 'abcdefghijklmnopqrstuvwxyz0123456789';
    37053713        for sFile in asNonEmptyFiles:
    3706             if oTxsSession.syncUploadString(sContent, sFile) is not True:
     3714            if oTxsSession.syncUploadString(sContent, sFile, 0o666) is not True:
    37073715                return reporter.error('Failed to create "%s" via TXS' % (sFile,));
    37083716
     
    37283736                             eAction = vboxcon.FileOpenAction_OpenExistingTruncated),                   tdTestResultFailure() ],
    37293737            [ tdTestFileOpen(sFile = oTestVm.pathJoin(sTempDir, 'no-such-dir', 'no-such-file')),        tdTestResultFailure() ],
    3730             # Wrong type:
    3731             [ tdTestFileOpen(sFile = self.getGuestTempDir(oTestVm)),                                    tdTestResultFailure() ],
    3732             [ tdTestFileOpen(sFile = self.getGuestSystemDir(oTestVm)),                                  tdTestResultFailure() ],
     3738        ];
     3739        if oTestVm.isWindows() or not self.fSkipKnownBugs: # We can open directories on linux, but we shouldn't, right...
     3740            atTests.extend([
     3741                # Wrong type:
     3742                [ tdTestFileOpen(sFile = self.getGuestTempDir(oTestVm)),                                tdTestResultFailure() ],
     3743                [ tdTestFileOpen(sFile = self.getGuestSystemDir(oTestVm)),                              tdTestResultFailure() ],
     3744            ]);
     3745        atTests.extend([
    37333746            # O_EXCL and such:
    37343747            [ tdTestFileOpen(sFile = sFileForReading, eAction = vboxcon.FileOpenAction_CreateNew,
     
    37993812            [ tdTestFileOpenCheckSize(sFile = asNonEmptyFiles[2], eAction = vboxcon.FileOpenAction_CreateOrReplace,
    38003813                                      eAccessMode = vboxcon.FileAccessMode_WriteOnly),                  tdTestResultSuccess() ],
    3801         ];
     3814        ]);
    38023815
    38033816        #
     
    40004013                    fRc = reporter.errorXcpt('%s: offFile=%s cbToRead=%s cbContent=%s'
    40014014                                             % (oTestFile.sPath, offFile, cbToRead, oTestFile.cbContent));
     4015                    cbRead = 0;
    40024016                else:
    40034017                    cbRead = len(abRead);
     
    40374051                    fRc = reporter.errorXcpt('%s: offFile=%s cbToRead=%s cbContent=%s'
    40384052                                             % (oTestFile.sPath, offFile, cbToRead, oTestFile.cbContent));
     4053                    cbRead = 0;
    40394054                else:
    40404055                    cbRead = len(abRead);
     
    40424057                        fRc = reporter.error('%s: random readAt mismatch @ %s LB %s' % (oTestFile.sPath, offFile, cbRead,));
    40434058
    4044                 if not self.fSkipKnownBugs:
    4045                     ## @todo See todo in GuestFile::getOffset() from r127065 (restored in r131439), but essentially
    4046                     ##       the issue is that 'mCurOffset += cbActuallyRead' doesn't work for non-linear readAt calls.
    4047                     ##       It should be 'mCurOffset = readAt.offsetParam + cbActuallyRead'.
    4048                     try:
    4049                         offActual = oFile.offset;
    4050                     except:
    4051                         fRc = reporter.errorXcpt('%s: offFile=%s cbToRead=%s cbContent=%s (#2)'
    4052                                                  % (oTestFile.sPath, offFile, cbToRead, oTestFile.cbContent));
    4053                     else:
    4054                         if offActual != offFile + cbRead:
    4055                             fRc = reporter.error('%s: IFile.offset is %s, expected %s (offFile=%s cbToRead=%s cbRead=%s) (#2)'
    4056                                                  % (oTestFile.sPath, offActual, offFile + cbRead, offFile, cbToRead, cbRead));
    4057                     ## @todo The trouble here is that RTFileReadAt may or may not do the seeking depending on the OS (see docs).
    4058                     ##       In addition, windows will not update the position if the offset is beyond EOF it seems.
    4059                     ##       Fix is to always do a RTFileSeek after a successful RTFileReadAt call.
    4060                     try:
    4061                         offActual = oFile.seek(0, vboxcon.FileSeekOrigin_Current);
    4062                     except:
    4063                         fRc = reporter.errorXcpt('%s: offFile=%s cbToRead=%s cbContent=%s (#2)'
    4064                                                  % (oTestFile.sPath, offFile, cbToRead, oTestFile.cbContent));
    4065                     else:
    4066                         if offActual != offFile + cbRead:
    4067                             fRc = reporter.error('%s: seek(0,cur) -> %s, expected %s (offFile=%s cbToRead=%s cbRead=%s) (#2)'
    4068                                                  % (oTestFile.sPath, offActual, offFile + cbRead, offFile, cbToRead, cbRead));
     4059                try:
     4060                    offActual = oFile.offset;
     4061                except:
     4062                    fRc = reporter.errorXcpt('%s: offFile=%s cbToRead=%s cbContent=%s (#2)'
     4063                                             % (oTestFile.sPath, offFile, cbToRead, oTestFile.cbContent));
     4064                else:
     4065                    if offActual != offFile + cbRead:
     4066                        fRc = reporter.error('%s: IFile.offset is %s, expected %s (offFile=%s cbToRead=%s cbRead=%s) (#2)'
     4067                                             % (oTestFile.sPath, offActual, offFile + cbRead, offFile, cbToRead, cbRead));
     4068
     4069                try:
     4070                    offActual = oFile.seek(0, vboxcon.FileSeekOrigin_Current);
     4071                except:
     4072                    fRc = reporter.errorXcpt('%s: offFile=%s cbToRead=%s cbContent=%s (#2)'
     4073                                             % (oTestFile.sPath, offFile, cbToRead, oTestFile.cbContent));
     4074                else:
     4075                    if offActual != offFile + cbRead:
     4076                        fRc = reporter.error('%s: seek(0,cur) -> %s, expected %s (offFile=%s cbToRead=%s cbRead=%s) (#2)'
     4077                                             % (oTestFile.sPath, offActual, offFile + cbRead, offFile, cbToRead, cbRead));
    40694078
    40704079            #
     
    43194328
    43204329        for sDir in (sScratchGst, sScratchDstDir1Gst, sScratchDstDir2Gst, sScratchDstDir3Gst, sScratchDstDir4Gst):
    4321             if oTxsSession.syncMkDir(sDir) is not True:
     4330            if oTxsSession.syncMkDir(sDir, 0o777) is not True:
    43224331                return reporter.error('TXS failed to create directory "%s"!' % (sDir,));
    43234332
  • trunk/src/VBox/ValidationKit/tests/additions/tdAddSharedFolders1.py

    r79092 r79452  
    5151    """
    5252
    53     def __init__(self, oTstDrv, fUseAltFsPerfPathForWindows = False):
     53    def __init__(self, oTstDrv):
    5454        base.SubTestDriverBase.__init__(self, oTstDrv, 'add-shared-folders', 'Shared Folders');
    5555
    56         self.asTestsDef                     = [ 'fsperf', ];
    57         self.asTests                        = self.asTestsDef;
    58         self.asExtraArgs                    = [];
    59         self.sGstFsPerfPath                 = '${CDROM}/vboxvalidationkit/${OS/ARCH}/FsPerf${EXESUFF}';
    60         self.sGstFsPerfPathAlt              = 'C:/Apps/FsPerf${EXESUFF}';
    61         self.fUseAltFsPerfPathForWindows    = fUseAltFsPerfPathForWindows;
     56        self.asTestsDef         = [ 'fsperf', ];
     57        self.asTests            = self.asTestsDef;
     58        self.asExtraArgs        = [];
     59        self.asGstFsPerfPaths   = [
     60            '${CDROM}/vboxvalidationkit/${OS/ARCH}/FsPerf${EXESUFF}',
     61            '${CDROM}/${OS/ARCH}/FsPerf${EXESUFF}',
     62            '${TXSDIR}/${OS/ARCH}/FsPerf${EXESUFF}',
     63            '${TXSDIR}/FsPerf${EXESUFF}',
     64            'E:/vboxvalidationkit/${OS/ARCH}/FsPerf${EXESUFF}',
     65        ];
    6266
    6367    def parseOption(self, asArgs, iArg):
     
    206210            # Add the extra arguments from the command line and kick it off:
    207211            asArgs.extend(self.asExtraArgs);
     212
     213            # Run FsPerf:
    208214            reporter.log2('Starting guest FsPerf (%s)...' % (asArgs,));
    209             sFsPerfPath = self.sGstFsPerfPath;
    210             if oTestVm.isWindows() and self.fUseAltFsPerfPathForWindows: # bird: Temp hack till we get UDF cloning implemented.
    211                 sFsPerfPath = self.sGstFsPerfPathAlt;                    #       Helps making unattended install tests work.
     215            sFsPerfPath = self._locateGstFsPerf(oTxsSession);
    212216            fRc = self.oTstDrv.txsRunTest(oTxsSession, 'FsPerf', 30 * 60 * 1000, sFsPerfPath, asArgs);
    213217            reporter.log2('FsPerf -> %s' % (fRc,));
     
    225229
    226230
     231    def _locateGstFsPerf(self, oTxsSession):
     232        """
     233        Returns guest side path to FsPerf.
     234        """
     235        for sFsPerfPath in self.asGstFsPerfPaths:
     236            if oTxsSession.syncIsFile(sFsPerfPath):
     237                return sFsPerfPath;
     238        reporter.log('Unable to find guest FsPerf in any of these places: %s' % ('\n    '.join(self.asGstFsPerfPaths),));
     239        return self.asGstFsPerfPaths[0];
     240
     241
    227242
    228243if __name__ == '__main__':
  • trunk/src/VBox/ValidationKit/tests/installation/tdGuestOsUnattendedInst1.py

    r79424 r79452  
    185185            return [self.sInstallIso,];
    186186        return [];
     187
     188    def _createVmDoIt(self, oTestDrv, eNic0AttachType, sDvdImage):
     189        #
     190        # Use HostOnly networking for ubuntu and debian VMs to prevent them from
     191        # downloading updates and doing database updates during installation.
     192        # We want predicable results.
     193        #
     194        if     eNic0AttachType is None \
     195          and self.isLinux() \
     196           and (   'ubuntu' in self.sKind.lower()
     197                or 'debian' in self.sKind.lower() ):
     198            eNic0AttachType = vboxcon.NetworkAttachmentType_HostOnly;
     199
     200        return vboxtestvms.BaseTestVm._createVmDoIt(self, oTestDrv, eNic0AttachType, sDvdImage);
     201
    187202
    188203    def _createVmPost(self, oTestDrv, oVM, eNic0AttachType, sDvdImage):
     
    374389        oSet.aoTestVms.extend([
    375390            # Windows7 RTM:
    376             UnattendedVm(oSet, 'tst-w7-32', 'Windows7',     '6.0/uaisos/en_windows_7_enterprise_x86_dvd_x15-70745.iso'),
    377             UnattendedVm(oSet, 'tst-w7-64', 'Windows7_64',  '6.0/uaisos/en_windows_7_enterprise_x64_dvd_x15-70749.iso'),
     391            UnattendedVm(oSet, 'tst-w7-32', 'Windows7',     '6.0/uaisos/en_windows_7_enterprise_x86_dvd_x15-70745.iso'), # 5.7GiB
     392            UnattendedVm(oSet, 'tst-w7-64', 'Windows7_64',  '6.0/uaisos/en_windows_7_enterprise_x64_dvd_x15-70749.iso'), # 10GiB
     393            UnattendedVm(oSet, 'tst-ubuntu-16.04-64', 'Ubuntu_64', '6.0/uaisos/ubuntu-16.04-desktop-amd64.iso'),
     394            #UnattendedVm(oSet, 'tst-ubuntu-18.04-64', 'Ubuntu_64', '6.0/uaisos/ubuntu-18.04-desktop-amd64.iso'), # >=5.7GiB
    378395        ]);
    379396        self.oTestVmSet = oSet;
     
    391408        # Sub-test drivers.
    392409        #
    393         self.addSubTestDriver(SubTstDrvAddSharedFolders1(self, fUseAltFsPerfPathForWindows = True)); # !HACK ALERT! UDF cloning.
     410        self.addSubTestDriver(SubTstDrvAddSharedFolders1(self));
    394411        self.addSubTestDriver(SubTstDrvAddGuestCtrl(self));
    395412
     
    511528        if not self.importVBoxApi(): # So we can use the constant below.
    512529            return False;
    513         return self.oTestVmSet.actionConfig(self, eNic0AttachType = vboxcon.NetworkAttachmentType_NAT);
     530        return self.oTestVmSet.actionConfig(self);
    514531
    515532    def actionExecute(self):
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