Changeset 79324 in vbox
- Timestamp:
- Jun 25, 2019 1:39:46 PM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 131544
- Location:
- trunk/src/VBox/ValidationKit
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/testdriver/base.py
r79245 r79324 1638 1638 iRc = self.innerMain(asArgs); 1639 1639 except: 1640 reporter.logXcpt(); 1640 1641 try: 1641 1642 self.onExit(-1); -
trunk/src/VBox/ValidationKit/tests/additions/tdAddGuestCtrl.py
r79318 r79324 390 390 return reporter.errorXcpt('fsObjExists failed on "%s" after deletion (type: %s)' % (self.sPath, sType)); 391 391 if fExists: 392 return reporter.error Xcpt('fsObjExists says "%s" still exists after deletion (type: %s)!' % (self.sPath, sType));392 return reporter.error('fsObjExists says "%s" still exists after deletion (type: %s)!' % (self.sPath, sType)); 393 393 return True; 394 394 … … 409 409 except: 410 410 reporter.maybeErrXcpt(self.fRcExpect, 'Removing "%s" failed' % (self.sPath,)); 411 return False; 411 return not self.fRcExpect; 412 if not self.fRcExpect: 413 return reporter.error('Expected removing "%s" to failed, but it succeeded' % (self.sPath,)); 414 412 415 return self.checkRemoved('file'); 413 416 … … 426 429 except: 427 430 reporter.maybeErrXcpt(self.fRcExpect, 'Removing "%s" (as a directory) failed' % (self.sPath,)); 428 return False; 431 return not self.fRcExpect; 432 if not self.fRcExpect: 433 return reporter.error('Expected removing "%s" (dir) to failed, but it succeeded' % (self.sPath,)); 434 429 435 return self.checkRemoved('directory'); 430 436 … … 433 439 Recursively remove a directory tree. 434 440 """ 435 def __init__(self, sPath, afFlags = None, fRcExpect = True, sUser = None, sPassword = None):441 def __init__(self, sPath, afFlags = None, fRcExpect = True, fNotExist = False, sUser = None, sPassword = None): 436 442 tdTestRemoveBase.__init__(self, sPath, fRcExpect, sUser, sPassword); 437 443 self.afFlags = afFlags if afFlags is not None else []; 444 self.fNotExist = fNotExist; # Hack for the ContentOnly scenario where the dir does not exist. 438 445 439 446 def execute(self, oSubTstDrv): … … 444 451 reporter.maybeErrXcpt(self.fRcExpect, 'Removing directory tree "%s" failed (afFlags=%s)' 445 452 % (self.sPath, self.afFlags)); 446 return False;453 return not self.fRcExpect; 447 454 448 455 oWrappedProgress = vboxwrappers.ProgressWrapper(oProgress, oSubTstDrv.oTstDrv.oVBoxMgr, oSubTstDrv.oTstDrv, … … 451 458 if not oWrappedProgress.isSuccess(): 452 459 oWrappedProgress.logResult(fIgnoreErrors = not self.fRcExpect); 453 return False; 454 455 if vboxcon.DirectoryRemoveRecFlag_ContentOnly in self.afFlags: 460 return not self.fRcExpect; 461 if not self.fRcExpect: 462 return reporter.error('Expected removing "%s" (tree) to failed, but it succeeded' % (self.sPath,)); 463 464 if vboxcon.DirectoryRemoveRecFlag_ContentAndDir not in self.afFlags and not self.fNotExist: 456 465 # Cannot use directoryExists here as it is buggy. 457 466 try: … … 3424 3433 """ 3425 3434 3426 # Something is busted here wrt progress wrappers or something... debugging.3427 if self.oTstDrv.fpApiVer < 10.0:3428 return None;3429 3430 3435 # 3431 3436 # Create a directory with a few files in it using TXS that we'll use for the initial tests. … … 3461 3466 return reporter.error('Failed to create test file "%s"!' % (sFile,)); 3462 3467 3463 3464 3468 # 3465 3469 # Tear down the directories and files. … … 3486 3490 tdTestRemoveFile(asTestFiles[0], fRcExpect = True), 3487 3491 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 tdTestRemove Tree(asTestDirs[9], fRcExpect = True),3491 tdTestRemoveTree(asTestDirs[3], fRcExpect = False), # Have subdirs & files, no flags == single rmdir.3492 # 17: 3493 tdTestRemoveTree(asTestDirs[8], fRcExpect = True), # Removes empty subdirs and leaves the dir itself. 3494 tdTestRemoveDir(asTestDirs[8], fRcExpect = True), 3495 tdTestRemoveTree(asTestDirs[3], fRcExpect = False), # Have subdirs & files, 3492 3496 tdTestRemoveTree(asTestDirs[3], afFlags = [vboxcon.DirectoryRemoveRecFlag_ContentOnly,], fRcExpect = True), 3493 tdTestRemove Tree(asTestDirs[3], fRcExpect = True),3497 tdTestRemoveDir(asTestDirs[3], fRcExpect = True), 3494 3498 tdTestRemoveTree(asTestDirs[0], afFlags = [vboxcon.DirectoryRemoveRecFlag_ContentAndDir,], fRcExpect = True), 3495 tdTestRemoveTree(asTestDirs[0], afFlags = [vboxcon.DirectoryRemoveRecFlag_ContentAndDir,], fRcExpect = False), 3499 # No error if already delete (RTDirRemoveRecursive artifact). 3500 tdTestRemoveTree(asTestDirs[0], afFlags = [vboxcon.DirectoryRemoveRecFlag_ContentAndDir,], fRcExpect = True), 3501 tdTestRemoveTree(asTestDirs[0], afFlags = [vboxcon.DirectoryRemoveRecFlag_ContentOnly,], 3502 fNotExist = True, fRcExpect = True), 3503 # Exception is when not specifying any flags the the guest does not call RTDirRemoveRecursive but does its own thing. 3504 tdTestRemoveTree(asTestDirs[0], afFlags = [], fRcExpect = False), 3496 3505 ]; 3497 3506 … … 3509 3518 fRc = oTest.execute(self) and fRc; 3510 3519 fRc = oTest.closeSession() and fRc; 3511 3512 3520 3513 3521 if fRc is True:
Note:
See TracChangeset
for help on using the changeset viewer.