VirtualBox

Ignore:
Timestamp:
Jun 25, 2019 8:50:23 AM (5 years ago)
Author:
vboxsync
Message:

tdAddGuestCtrl.py: Reworking the remove (delete) tests. bugref:9151 bugref:9320

File:
1 edited

Legend:

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

    r79303 r79318  
    151151        return reporter.addLogFile(sHstFileName, 'misc/other', sDesc);
    152152
    153     def createSession(self, sName, fIsError = False):
     153    def createSession(self, sName, fIsError = True):
    154154        """
    155155        Creates (opens) a guest session.
     
    205205        return self.oGuestSession;
    206206
    207     def closeSession(self, fIsError = False):
     207    def closeSession(self, fIsError = True):
    208208        """
    209209        Closes the guest session.
     
    365365        self.oCreds = tdCtxCreds(sUser, sPassword, sDomain = None);
    366366        self.sFile = sFile;
     367
     368class tdTestRemoveBase(tdTestGuestCtrlBase):
     369    """
     370    Removal base.
     371    """
     372    def __init__(self, sPath, fRcExpect = True, sUser = None, sPassword = None):
     373        tdTestGuestCtrlBase.__init__(self);
     374        self.oCreds    = tdCtxCreds(sUser, sPassword, sDomain = None);
     375        self.sPath     = sPath;
     376        self.fRcExpect = fRcExpect;
     377
     378    def execute(self, oSubTstDrv):
     379        """
     380        Executes the test, returns True/False.
     381        """
     382        _ = oSubTstDrv;
     383        return True;
     384
     385    def checkRemoved(self, sType):
     386        """ Check that the object was removed using fObjExists. """
     387        try:
     388            fExists = self.oGuestSession.fsObjExists(self.sPath, False);
     389        except:
     390            return reporter.errorXcpt('fsObjExists failed on "%s" after deletion (type: %s)' % (self.sPath, sType));
     391        if fExists:
     392            return reporter.errorXcpt('fsObjExists says "%s" still exists after deletion (type: %s)!' % (self.sPath, sType));
     393        return True;
     394
     395class tdTestRemoveFile(tdTestRemoveBase):
     396    """
     397    Remove a single file.
     398    """
     399    def __init__(self, sPath, fRcExpect = True, sUser = None, sPassword = None):
     400        tdTestRemoveBase.__init__(self, sPath, fRcExpect, sUser, sPassword);
     401
     402    def execute(self, oSubTstDrv):
     403        reporter.log2('Deleting file "%s" ...' % (self.sPath,));
     404        try:
     405            if oSubTstDrv.oTstDrv.fpApiVer >= 5.0:
     406                self.oGuestSession.fsObjRemove(self.sPath);
     407            else:
     408                self.oGuestSession.fileRemove(self.sPath);
     409        except:
     410            reporter.maybeErrXcpt(self.fRcExpect, 'Removing "%s" failed' % (self.sPath,));
     411            return False;
     412        return self.checkRemoved('file');
     413
     414class tdTestRemoveDir(tdTestRemoveBase):
     415    """
     416    Remove a single directory if empty.
     417    """
     418    def __init__(self, sPath, fRcExpect = True, sUser = None, sPassword = None):
     419        tdTestRemoveBase.__init__(self, sPath, fRcExpect, sUser, sPassword);
     420
     421    def execute(self, oSubTstDrv):
     422        _ = oSubTstDrv;
     423        reporter.log2('Deleting directory "%s" ...' % (self.sPath,));
     424        try:
     425            self.oGuestSession.directoryRemove(self.sPath);
     426        except:
     427            reporter.maybeErrXcpt(self.fRcExpect, 'Removing "%s" (as a directory) failed' % (self.sPath,));
     428            return False;
     429        return self.checkRemoved('directory');
     430
     431class tdTestRemoveTree(tdTestRemoveBase):
     432    """
     433    Recursively remove a directory tree.
     434    """
     435    def __init__(self, sPath, afFlags = None, fRcExpect = True, sUser = None, sPassword = None):
     436        tdTestRemoveBase.__init__(self, sPath, fRcExpect, sUser, sPassword);
     437        self.afFlags = afFlags if afFlags is not None else [];
     438
     439    def execute(self, oSubTstDrv):
     440        reporter.log2('Deleting tree "%s" ...' % (self.sPath,));
     441        try:
     442            oProgress = self.oGuestSession.directoryRemoveRecursive(self.sPath, self.afFlags);
     443        except:
     444            reporter.maybeErrXcpt(self.fRcExpect, 'Removing directory tree "%s" failed (afFlags=%s)'
     445                                  % (self.sPath, self.afFlags));
     446            return False;
     447
     448        oWrappedProgress = vboxwrappers.ProgressWrapper(oProgress, oSubTstDrv.oTstDrv.oVBoxMgr, oSubTstDrv.oTstDrv,
     449                                                        "remove-tree: %s" % (self.sPath,));
     450        oWrappedProgress.wait();
     451        if not oWrappedProgress.isSuccess():
     452            oWrappedProgress.logResult(fIgnoreErrors = not self.fRcExpect);
     453            return False;
     454
     455        if vboxcon.DirectoryRemoveRecFlag_ContentOnly in self.afFlags:
     456            # Cannot use directoryExists here as it is buggy.
     457            try:
     458                if oSubTstDrv.oTstDrv.fpApiVer >= 5.0:
     459                    oFsObjInfo = self.oGuestSession.fsObjQueryInfo(self.sPath, False);
     460                else:
     461                    oFsObjInfo = self.oGuestSession.fileQueryInfo(self.sPath);
     462                eType = oFsObjInfo.type;
     463            except:
     464                return reporter.errorXcpt('sPath=%s' % (self.sPath,));
     465            if eType != vboxcon.FsObjType_Directory:
     466                return reporter.error('Found file type %d, expected directory (%d) for %s after rmtree/OnlyContent'
     467                                      % (eType, vboxcon.FsObjType_Directory, self.sPath,));
     468            return True;
     469
     470        return self.checkRemoved('tree');
     471
    367472
    368473class tdTestFileStat(tdTestGuestCtrlBase):
     
    703808        return fRc;
    704809
     810
    705811class tdTestSession(tdTestGuestCtrlBase):
    706812    """
     
    761867            # Close the session.
    762868            #
    763             fRc2 = self.closeSession(True);
     869            fRc2 = self.closeSession();
    764870            if fRc2 is False:
    765871                fRc = reporter.error('%s: Session could not be closed' % (sMsgPrefix,));
     
    22012307                        fRc = reporter.error('Test #%d failed: Session name does not match: Got "%s", expected "%s"'
    22022308                                             % (i, sObjName, sCurGuestSessionName));
    2203             fRc2 = oCurTest.closeSession(True);
     2309            fRc2 = oCurTest.closeSession();
    22042310            if fRc2 is False:
    22052311                fRc = reporter.error('Test #%d failed: Session could not be closed' % (i,));
     
    22382344            # Close this session:
    22392345            oClosedGuestSession = aoMultiSessions[i].oGuestSession;
    2240             fRc2 = aoMultiSessions[i].closeSession(True);
     2346            fRc2 = aoMultiSessions[i].closeSession();
    22412347            cCurSessions = aoMultiSessions[i].getSessionCount(self.oTstDrv.oVBoxMgr)
    22422348            reporter.log2('MultiSession #%d count is %d' % (i, cCurSessions,));
     
    27152821            oCurRes  = tTest[1]  # type: tdTestResultExec
    27162822            oCurTest.setEnvironment(oSession, oTxsSession, oTestVm);
    2717             fRc, oCurGuestSession = oCurTest.createSession('testGuestCtrlExec: Test #%d' % (i,), True);
     2823            fRc, oCurGuestSession = oCurTest.createSession('testGuestCtrlExec: Test #%d' % (i,));
    27182824            if fRc is not True:
    27192825                reporter.error('Test #%d failed: Could not create session' % (i,));
     
    27222828            if fRc is not True:
    27232829                break;
    2724             fRc = oCurTest.closeSession(True);
     2830            fRc = oCurTest.closeSession();
    27252831            if fRc is not True:
    27262832                break;
     
    31153221
    31163222            oCurTest.setEnvironment(oSession, oTxsSession, oTestVm);
    3117             fRc, oCurGuestSession = oCurTest.createSession('testGuestCtrlDirCreate: Test #%d' % (i,), fIsError = True);
     3223            fRc, oCurGuestSession = oCurTest.createSession('testGuestCtrlDirCreate: Test #%d' % (i,));
    31183224            if fRc is False:
    31193225                return reporter.error('Test #%d failed: Could not create session' % (i,));
     
    31213227            fRc = self.gctrlCreateDir(oCurTest, oCurRes, oCurGuestSession);
    31223228
    3123             fRc = oCurTest.closeSession(fIsError = True) and fRc;
     3229            fRc = oCurTest.closeSession() and fRc;
    31243230            if fRc is False:
    31253231                fRc = reporter.error('Test #%d failed' % (i,));
     
    31663272
    31673273            oCurTest.setEnvironment(oSession, oTxsSession, oTestVm);
    3168             fRc, oCurGuestSession = oCurTest.createSession('testGuestCtrlDirCreateTemp: Test #%d' % (i,), fIsError = True);
     3274            fRc, oCurGuestSession = oCurTest.createSession('testGuestCtrlDirCreateTemp: Test #%d' % (i,));
    31693275            if fRc is False:
    31703276                fRc = reporter.error('Test #%d failed: Could not create session' % (i,));
     
    32073313                            fRc = reporter.error('Temporary directory "%s" not created as a directory: eType=%d'
    32083314                                                 % (sDirTemp, eType));
    3209             fRc = oCurTest.closeSession(True) and fRc;
     3315            fRc = oCurTest.closeSession() and fRc;
    32103316        return (fRc, oTxsSession);
    32113317
     
    32613367            reporter.log('Testing #%d, dir="%s" ...' % (i, oCurTest.sDirectory));
    32623368            oCurTest.setEnvironment(oSession, oTxsSession, oTestVm);
    3263             fRc, oCurGuestSession = oCurTest.createSession('testGuestCtrlDirRead: Test #%d' % (i,), True);
     3369            fRc, oCurGuestSession = oCurTest.createSession('testGuestCtrlDirRead: Test #%d' % (i,));
    32643370            if fRc is not True:
    32653371                break;
    32663372            (fRc2, cDirs, cFiles, cOthers) = self.gctrlReadDirTree(oCurTest, oCurGuestSession, oCurRes.fRc);
    3267             fRc = oCurTest.closeSession(True) and fRc;
     3373            fRc = oCurTest.closeSession() and fRc;
    32683374
    32693375            reporter.log2('Test #%d: Returned %d directories, %d files total' % (i, cDirs, cFiles));
     
    33033409            oCurTest = tdTestDirRead();
    33043410            oCurTest.setEnvironment(oSession, oTxsSession, oTestVm);
    3305             fRc, oCurGuestSession = oCurTest.createSession('testGuestCtrlDirRead: gctrlReadDirTree2', True);
     3411            fRc, oCurGuestSession = oCurTest.createSession('testGuestCtrlDirRead: gctrlReadDirTree2');
    33063412            if fRc is True:
    33073413                for oDir in (self.oTestFiles.oEmptyDir, self.oTestFiles.oManyDir, self.oTestFiles.oTreeDir):
    33083414                    reporter.log('Checking "%s" ...' % (oDir.sPath,));
    33093415                    fRc = self.gctrlReadDirTree2(oCurGuestSession, oDir) and fRc;
    3310                 fRc = oCurTest.closeSession(True) and fRc;
     3416                fRc = oCurTest.closeSession() and fRc;
    33113417
    33123418        return (fRc, oTxsSession);
    33133419
     3420
    33143421    def testGuestCtrlFileRemove(self, oSession, oTxsSession, oTestVm):
    33153422        """
     
    33173424        """
    33183425
    3319         ## @todo r=bird: This fails on windows 7 RTM.  Just create a stupid file and delete it again,
    3320         #                this chord.wav stuff is utter nonsense.
    3321         if oTestVm.isWindows():
    3322             sFileToDelete = "c:\\Windows\\Media\\chord.wav";
    3323         else:
    3324             sFileToDelete = "/home/vbox/.profile";
    3325 
    3326         atTests = [];
    3327         if oTestVm.isWindows():
    3328             atTests.extend([
    3329                 # Invalid stuff.
    3330                 [ tdTestFileRemove(sFile = ''), tdTestResultFailure() ],
    3331                 [ tdTestFileRemove(sFile = 'C:\\Windows'), tdTestResultFailure() ],
    3332                 # More unusual stuff.
    3333                 [ tdTestFileRemove(sFile = 'z:\\'), tdTestResultFailure() ],
    3334                 [ tdTestFileRemove(sFile = '\\\\uncrulez\\foo'), tdTestResultFailure() ],
    3335                 # Non-existing stuff.
    3336                 [ tdTestFileRemove(sFile = 'c:\\Apps\\nonexisting'), tdTestResultFailure() ],
    3337                 # Try to delete system files.
    3338                 [ tdTestFileRemove(sFile = 'c:\\pagefile.sys'), tdTestResultFailure() ],
    3339                 [ tdTestFileRemove(sFile = 'c:\\Windows\\kernel32.sys'), tdTestResultFailure() ] ## r=bird: it's in \system32\ ...
    3340             ]);
    3341 
    3342             if oTestVm.sKind == "WindowsXP":
    3343                 atTests.extend([
    3344                     # Try delete some unimportant media stuff.
    3345                     [ tdTestFileRemove(sFile = 'c:\\Windows\\Media\\chimes.wav'), tdTestResultSuccess() ],
    3346                     # Second attempt should fail.
    3347                     [ tdTestFileRemove(sFile = 'c:\\Windows\\Media\\chimes.wav'), tdTestResultFailure() ]
    3348                 ]);
    3349         elif oTestVm.isLinux():
    3350             atTests.extend([
    3351                 # Invalid stuff.
    3352                 [ tdTestFileRemove(sFile = ''), tdTestResultFailure() ],
    3353                 [ tdTestFileRemove(sFile = 'C:\\Windows'), tdTestResultFailure() ],
    3354                 # More unusual stuff.
    3355                 [ tdTestFileRemove(sFile = 'z:/'), tdTestResultFailure() ],
    3356                 [ tdTestFileRemove(sFile = '//uncrulez/foo'), tdTestResultFailure() ],
    3357                 # Non-existing stuff.
    3358                 [ tdTestFileRemove(sFile = '/non/existing'), tdTestResultFailure() ],
    3359                 # Try to delete system files.
    3360                 [ tdTestFileRemove(sFile = '/etc'), tdTestResultFailure() ],
    3361                 [ tdTestFileRemove(sFile = '/bin/sh'), tdTestResultFailure() ]
    3362             ]);
    3363 
    3364         atTests.extend([
    3365             # Try delete some unimportant stuff.
    3366             [ tdTestFileRemove(sFile = sFileToDelete), tdTestResultSuccess() ],
    3367             # Second attempt should fail.
    3368             [ tdTestFileRemove(sFile = sFileToDelete), tdTestResultFailure() ]
    3369         ]);
    3370 
     3426        # Something is busted here wrt progress wrappers or something... debugging.
     3427        if self.oTstDrv.fpApiVer < 10.0:
     3428            return None;
     3429
     3430        #
     3431        # Create a directory with a few files in it using TXS that we'll use for the initial tests.
     3432        #
     3433        asTestDirs = [
     3434            oTestVm.pathJoin(self.oTestFiles.oRoot.sPath, 'rmtestdir-1'),                             # [0]
     3435            oTestVm.pathJoin(self.oTestFiles.oRoot.sPath, 'rmtestdir-1', 'subdir-1'),                 # [1]
     3436            oTestVm.pathJoin(self.oTestFiles.oRoot.sPath, 'rmtestdir-1', 'subdir-1', 'subsubdir-1'),  # [2]
     3437            oTestVm.pathJoin(self.oTestFiles.oRoot.sPath, 'rmtestdir-2'),                             # [3]
     3438            oTestVm.pathJoin(self.oTestFiles.oRoot.sPath, 'rmtestdir-2', 'subdir-2'),                 # [4]
     3439            oTestVm.pathJoin(self.oTestFiles.oRoot.sPath, 'rmtestdir-2', 'subdir-2', 'subsbudir-2'),  # [5]
     3440            oTestVm.pathJoin(self.oTestFiles.oRoot.sPath, 'rmtestdir-3'),                             # [6]
     3441            oTestVm.pathJoin(self.oTestFiles.oRoot.sPath, 'rmtestdir-4'),                             # [7]
     3442            oTestVm.pathJoin(self.oTestFiles.oRoot.sPath, 'rmtestdir-5'),                             # [8]
     3443            oTestVm.pathJoin(self.oTestFiles.oRoot.sPath, 'rmtestdir-5', 'subdir-5'),                 # [9]
     3444        ]
     3445        asTestFiles = [
     3446            oTestVm.pathJoin(asTestDirs[0], 'file-0'), # [0]
     3447            oTestVm.pathJoin(asTestDirs[0], 'file-1'), # [1]
     3448            oTestVm.pathJoin(asTestDirs[0], 'file-2'), # [2]
     3449            oTestVm.pathJoin(asTestDirs[1], 'file-3'), # [3] - subdir-1
     3450            oTestVm.pathJoin(asTestDirs[1], 'file-4'), # [4] - subdir-1
     3451            oTestVm.pathJoin(asTestDirs[2], 'file-5'), # [5] - subsubdir-1
     3452            oTestVm.pathJoin(asTestDirs[3], 'file-6'), # [6] - rmtestdir-2
     3453            oTestVm.pathJoin(asTestDirs[4], 'file-7'), # [7] - subdir-2
     3454            oTestVm.pathJoin(asTestDirs[5], 'file-8'), # [8] - subsubdir-2
     3455        ];
     3456        for sDir in asTestDirs:
     3457            if oTxsSession.syncMkDir(sDir) is not True:
     3458                return reporter.error('Failed to create test dir "%s"!' % (sDir,));
     3459        for sFile in asTestFiles:
     3460            if oTxsSession.syncUploadString(sFile, sFile) is not True:
     3461                return reporter.error('Failed to create test file "%s"!' % (sFile,));
     3462
     3463
     3464        #
     3465        # Tear down the directories and files.
     3466        #
     3467        aoTests = [
     3468            # Negative tests first:
     3469            tdTestRemoveFile(asTestDirs[0], fRcExpect = False),
     3470            tdTestRemoveDir(asTestDirs[0], fRcExpect = False),
     3471            tdTestRemoveDir(asTestFiles[0], fRcExpect = False),
     3472            tdTestRemoveFile(oTestVm.pathJoin(self.oTestFiles.oEmptyDir.sPath, 'no-such-file'), fRcExpect = False),
     3473            tdTestRemoveDir(oTestVm.pathJoin(self.oTestFiles.oEmptyDir.sPath, 'no-such-dir'), fRcExpect = False),
     3474            tdTestRemoveFile(oTestVm.pathJoin(self.oTestFiles.oEmptyDir.sPath, 'no-such-dir', 'no-file'), fRcExpect = False),
     3475            tdTestRemoveDir(oTestVm.pathJoin(self.oTestFiles.oEmptyDir.sPath, 'no-such-dir', 'no-subdir'), fRcExpect = False),
     3476            tdTestRemoveTree(asTestDirs[0], afFlags = [], fRcExpect = False), # Only removes empty dirs, this isn't empty.
     3477            tdTestRemoveTree(asTestDirs[0], afFlags = [vboxcon.DirectoryRemoveRecFlag_None,], fRcExpect = False), # ditto
     3478            # Empty paths:
     3479            tdTestRemoveFile('', fRcExpect = False),
     3480            tdTestRemoveDir('', fRcExpect = False),
     3481            tdTestRemoveTree('', fRcExpect = False),
     3482            # Now actually remove stuff:
     3483            tdTestRemoveDir(asTestDirs[7], fRcExpect = True),
     3484            tdTestRemoveFile(asTestDirs[6], fRcExpect = False),
     3485            tdTestRemoveDir(asTestDirs[6], fRcExpect = True),
     3486            tdTestRemoveFile(asTestFiles[0], fRcExpect = True),
     3487            tdTestRemoveFile(asTestFiles[0], fRcExpect = False),
     3488            tdTestRemoveTree(asTestDirs[9], fRcExpect = False), # Have subdirs, no flags == single rmdir.
     3489            tdTestRemoveTree(asTestDirs[9], afFlags = [vboxcon.DirectoryRemoveRecFlag_ContentOnly,], fRcExpect = True),
     3490            tdTestRemoveTree(asTestDirs[9], fRcExpect = True),
     3491            tdTestRemoveTree(asTestDirs[3], fRcExpect = False), # Have subdirs & files, no flags == single rmdir.
     3492            tdTestRemoveTree(asTestDirs[3], afFlags = [vboxcon.DirectoryRemoveRecFlag_ContentOnly,], fRcExpect = True),
     3493            tdTestRemoveTree(asTestDirs[3], fRcExpect = True),
     3494            tdTestRemoveTree(asTestDirs[0], afFlags = [vboxcon.DirectoryRemoveRecFlag_ContentAndDir,], fRcExpect = True),
     3495            tdTestRemoveTree(asTestDirs[0], afFlags = [vboxcon.DirectoryRemoveRecFlag_ContentAndDir,], fRcExpect = False),
     3496        ];
     3497
     3498        #
     3499        # Execution loop
     3500        #
    33713501        fRc = True;
    3372         for (i, aTest) in enumerate(atTests):
    3373             oCurTest = aTest[0]; # tdTestExec, use an index, later.
    3374             oCurRes  = aTest[1]; # tdTestResult
    3375             reporter.log('Testing #%d, file="%s" ...' % (i, oCurTest.sFile));
     3502        for (i, oTest) in enumerate(aoTests): # int, tdTestRemoveBase
     3503            reporter.log('Testing #%d, path="%s" %s ...' % (i, oTest.sPath, oTest.__class__.__name__));
     3504            oTest.setEnvironment(oSession, oTxsSession, oTestVm);
     3505            fRc, _ = oTest.createSession('testGuestCtrlFileRemove: Test #%d' % (i,));
     3506            if fRc is False:
     3507                fRc = reporter.error('Test #%d failed: Could not create session' % (i,));
     3508                break;
     3509            fRc = oTest.execute(self) and fRc;
     3510            fRc = oTest.closeSession() and fRc;
     3511
     3512
     3513        if fRc is True:
     3514            oCurTest = tdTestDirRead();
    33763515            oCurTest.setEnvironment(oSession, oTxsSession, oTestVm);
    3377             fRc, oCurGuestSession = oCurTest.createSession('testGuestCtrlFileRemove: Test #%d' % (i,));
    3378             if fRc is False:
    3379                 reporter.error('Test #%d failed: Could not create session' % (i,));
    3380                 break;
    3381             try:
    3382                 if self.oTstDrv.fpApiVer >= 5.0:
    3383                     oCurGuestSession.fsObjRemove(oCurTest.sFile);
     3516            fRc, oCurGuestSession = oCurTest.createSession('remove final');
     3517            if fRc is True:
     3518
     3519                #
     3520                # Delete all the files in the many subdir of the test set.
     3521                #
     3522                reporter.log('Deleting the file in "%s" ...' % (self.oTestFiles.oManyDir.sPath,));
     3523                for oFile in self.oTestFiles.oManyDir.aoChildren:
     3524                    reporter.log2('"%s"' % (oFile.sPath,));
     3525                    try:
     3526                        if self.oTstDrv.fpApiVer >= 5.0:
     3527                            oCurGuestSession.fsObjRemove(oFile.sPath);
     3528                        else:
     3529                            oCurGuestSession.fileRemove(oFile.sPath);
     3530                    except:
     3531                        fRc = reporter.errorXcpt('Removing "%s" failed' % (oFile.sPath,));
     3532
     3533                # Remove the directory itself to verify that we've removed all the files in it:
     3534                reporter.log('Removing the directory "%s" ...' % (self.oTestFiles.oManyDir.sPath,));
     3535                try:
     3536                    oCurGuestSession.directoryRemove(self.oTestFiles.oManyDir.sPath);
     3537                except:
     3538                    fRc = reporter.errorXcpt('Removing directory "%s" failed' % (self.oTestFiles.oManyDir.sPath,));
     3539
     3540                #
     3541                # Recursively delete the entire test file tree from the root up.
     3542                #
     3543                try:
     3544                    oProgress = oCurGuestSession.directoryRemoveRecursive(self.oTestFiles.oRoot.sPath,
     3545                                                                          [vboxcon.DirectoryRemoveRecFlag_ContentAndDir,]);
     3546                except:
     3547                    fRc = reporter.errorXcpt('Removing tree "%s" failed' % (self.oTestFiles.oRoot.sPath,));
    33843548                else:
    3385                     oCurGuestSession.fileRemove(oCurTest.sFile);
    3386             except:
    3387                 if oCurRes.fRc is True:
    3388                     reporter.errorXcpt('Removing file "%s" failed:' % (oCurTest.sFile,));
    3389                     fRc = False;
    3390                     break;
    3391                 else:
    3392                     reporter.logXcpt('Removing file "%s" failed expectedly, skipping:' % (oCurTest.sFile,));
    3393             oCurTest.closeSession();
     3549                    reporter.log2('#3: fRc=%s' % (fRc));
     3550                    oWrappedProgress = vboxwrappers.ProgressWrapper(oProgress, self.oTstDrv.oVBoxMgr, self.oTstDrv,
     3551                                                                    "remove-tree-root: %s" % (self.oTestFiles.oRoot.sPath,));
     3552                    reporter.log2('waiting ...')
     3553                    oWrappedProgress.wait();
     3554                    reporter.log2('isSuccess=%s' % (oWrappedProgress.isSuccess(),));
     3555                    if not oWrappedProgress.isSuccess():
     3556                        fRc = oWrappedProgress.logResult();
     3557
     3558                fRc = oCurTest.closeSession() and fRc;
     3559
    33943560        return (fRc, oTxsSession);
     3561
    33953562
    33963563    def testGuestCtrlFileStat(self, oSession, oTxsSession, oTestVm): # pylint: disable=too-many-locals
     
    34573624        oTest = tdTestGuestCtrlBase();
    34583625        oTest.setEnvironment(oSession, oTxsSession, oTestVm);
    3459         fRc2, oGuestSession = oTest.createSession('FsStat on TestFileSet', True);
     3626        fRc2, oGuestSession = oTest.createSession('FsStat on TestFileSet');
    34603627        if fRc2 is not True:
    34613628            return (False, oTxsSession);
     
    35233690                                             % (oFsObj.sPath, type(oFsObj), fExistsResult, fDirExists));
    35243691
    3525         fRc = oTest.closeSession(True) and fRc;
     3692        fRc = oTest.closeSession() and fRc;
    35263693        return (fRc, oTxsSession);
    35273694
     
    36643831
    36653832            oCurTest.setEnvironment(oSession, oTxsSession, oTestVm);
    3666             fRc, _ = oCurTest.createSession('testGuestCtrlFileOpen: Test #%d' % (i,), True);
     3833            fRc, _ = oCurTest.createSession('testGuestCtrlFileOpen: Test #%d' % (i,));
    36673834            if fRc is not True:
    36683835                fRc = reporter.error('Test #%d failed: Could not create session' % (i,));
     
    36733840                fRc = reporter.error('Test #%d result mismatch: Got %s, expected %s' % (i, fRc2, oCurRes.fRc,));
    36743841
    3675             fRc = oCurTest.closeSession(True) and fRc;
     3842            fRc = oCurTest.closeSession() and fRc;
    36763843
    36773844        return (fRc, oTxsSession);
     
    36913858        oTest = tdTestGuestCtrlBase();
    36923859        oTest.setEnvironment(oSession, oTxsSession, oTestVm);
    3693         fRc2, oGuestSession = oTest.createSession('FsStat on TestFileSet', True);
     3860        fRc2, oGuestSession = oTest.createSession('FsStat on TestFileSet');
    36943861        if fRc2 is not True:
    36953862            return (False, oTxsSession);
     
    40344201                fRc = reporter.errorXcpt('fsObjRemove(%s)' % (sBigPath,));
    40354202
    4036         fRc = oTest.closeSession(True) and fRc;
     4203        fRc = oTest.closeSession() and fRc;
    40374204
    40384205        return (fRc, oTxsSession);
     
    41064273
    41074274            oCurTest.setEnvironment(oSession, oTxsSession, oTestVm);
    4108             fRc, _ = oCurTest.createSession('testGuestCtrlFileWrite: Test #%d' % (i,), True);
     4275            fRc, _ = oCurTest.createSession('testGuestCtrlFileWrite: Test #%d' % (i,));
    41094276            if fRc is not True:
    41104277                fRc = reporter.error('Test #%d failed: Could not create session' % (i,));
     
    41154282                fRc = reporter.error('Test #%d failed!' % (i,));
    41164283
    4117             fRc = oCurTest.closeSession(True) and fRc;
     4284            fRc = oCurTest.closeSession() and fRc;
    41184285
    41194286        #
     
    43334500
    43344501            oCurTest.setEnvironment(oSession, oTxsSession, oTestVm);
    4335             fRc, oCurGuestSession = oCurTest.createSession('testGuestCtrlCopyTo: Test #%d' % (i,), fIsError = True);
     4502            fRc, oCurGuestSession = oCurTest.createSession('testGuestCtrlCopyTo: Test #%d' % (i,));
    43364503            if fRc is not True:
    43374504                fRc = reporter.error('Test #%d failed: Could not create session' % (i,));
     
    43464513                fRc = reporter.error('Test #%d failed: Got %s, expected %s' % (i, fRc2, oCurRes.fRc));
    43474514
    4348             fRc = oCurTest.closeSession(True) and fRc;
     4515            fRc = oCurTest.closeSession() and fRc;
    43494516
    43504517        return (fRc, oTxsSession);
     
    45194686            else:
    45204687                oCurTest.setEnvironment(oSession, oTxsSession, oTestVm);
    4521                 fRc2, oCurGuestSession = oCurTest.createSession('testGuestCtrlCopyFrom: Test #%d' % (i,), fIsError = True);
     4688                fRc2, oCurGuestSession = oCurTest.createSession('testGuestCtrlCopyFrom: Test #%d' % (i,));
    45224689                if fRc2 is not True:
    45234690                    fRc = reporter.error('Test #%d failed: Could not create session' % (i,));
     
    45334700                    fRc2 = False;
    45344701
    4535                 fRc = oCurTest.closeSession(fIsError = True) and fRc;
     4702                fRc = oCurTest.closeSession() and fRc;
    45364703
    45374704        return (fRc, oTxsSession);
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