Changeset 79318 in vbox for trunk/src/VBox/ValidationKit/tests/additions/tdAddGuestCtrl.py
- Timestamp:
- Jun 25, 2019 8:50:23 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/tests/additions/tdAddGuestCtrl.py
r79303 r79318 151 151 return reporter.addLogFile(sHstFileName, 'misc/other', sDesc); 152 152 153 def createSession(self, sName, fIsError = False):153 def createSession(self, sName, fIsError = True): 154 154 """ 155 155 Creates (opens) a guest session. … … 205 205 return self.oGuestSession; 206 206 207 def closeSession(self, fIsError = False):207 def closeSession(self, fIsError = True): 208 208 """ 209 209 Closes the guest session. … … 365 365 self.oCreds = tdCtxCreds(sUser, sPassword, sDomain = None); 366 366 self.sFile = sFile; 367 368 class 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 395 class 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 414 class 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 431 class 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 367 472 368 473 class tdTestFileStat(tdTestGuestCtrlBase): … … 703 808 return fRc; 704 809 810 705 811 class tdTestSession(tdTestGuestCtrlBase): 706 812 """ … … 761 867 # Close the session. 762 868 # 763 fRc2 = self.closeSession( True);869 fRc2 = self.closeSession(); 764 870 if fRc2 is False: 765 871 fRc = reporter.error('%s: Session could not be closed' % (sMsgPrefix,)); … … 2201 2307 fRc = reporter.error('Test #%d failed: Session name does not match: Got "%s", expected "%s"' 2202 2308 % (i, sObjName, sCurGuestSessionName)); 2203 fRc2 = oCurTest.closeSession( True);2309 fRc2 = oCurTest.closeSession(); 2204 2310 if fRc2 is False: 2205 2311 fRc = reporter.error('Test #%d failed: Session could not be closed' % (i,)); … … 2238 2344 # Close this session: 2239 2345 oClosedGuestSession = aoMultiSessions[i].oGuestSession; 2240 fRc2 = aoMultiSessions[i].closeSession( True);2346 fRc2 = aoMultiSessions[i].closeSession(); 2241 2347 cCurSessions = aoMultiSessions[i].getSessionCount(self.oTstDrv.oVBoxMgr) 2242 2348 reporter.log2('MultiSession #%d count is %d' % (i, cCurSessions,)); … … 2715 2821 oCurRes = tTest[1] # type: tdTestResultExec 2716 2822 oCurTest.setEnvironment(oSession, oTxsSession, oTestVm); 2717 fRc, oCurGuestSession = oCurTest.createSession('testGuestCtrlExec: Test #%d' % (i,) , True);2823 fRc, oCurGuestSession = oCurTest.createSession('testGuestCtrlExec: Test #%d' % (i,)); 2718 2824 if fRc is not True: 2719 2825 reporter.error('Test #%d failed: Could not create session' % (i,)); … … 2722 2828 if fRc is not True: 2723 2829 break; 2724 fRc = oCurTest.closeSession( True);2830 fRc = oCurTest.closeSession(); 2725 2831 if fRc is not True: 2726 2832 break; … … 3115 3221 3116 3222 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,)); 3118 3224 if fRc is False: 3119 3225 return reporter.error('Test #%d failed: Could not create session' % (i,)); … … 3121 3227 fRc = self.gctrlCreateDir(oCurTest, oCurRes, oCurGuestSession); 3122 3228 3123 fRc = oCurTest.closeSession( fIsError = True) and fRc;3229 fRc = oCurTest.closeSession() and fRc; 3124 3230 if fRc is False: 3125 3231 fRc = reporter.error('Test #%d failed' % (i,)); … … 3166 3272 3167 3273 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,)); 3169 3275 if fRc is False: 3170 3276 fRc = reporter.error('Test #%d failed: Could not create session' % (i,)); … … 3207 3313 fRc = reporter.error('Temporary directory "%s" not created as a directory: eType=%d' 3208 3314 % (sDirTemp, eType)); 3209 fRc = oCurTest.closeSession( True) and fRc;3315 fRc = oCurTest.closeSession() and fRc; 3210 3316 return (fRc, oTxsSession); 3211 3317 … … 3261 3367 reporter.log('Testing #%d, dir="%s" ...' % (i, oCurTest.sDirectory)); 3262 3368 oCurTest.setEnvironment(oSession, oTxsSession, oTestVm); 3263 fRc, oCurGuestSession = oCurTest.createSession('testGuestCtrlDirRead: Test #%d' % (i,) , True);3369 fRc, oCurGuestSession = oCurTest.createSession('testGuestCtrlDirRead: Test #%d' % (i,)); 3264 3370 if fRc is not True: 3265 3371 break; 3266 3372 (fRc2, cDirs, cFiles, cOthers) = self.gctrlReadDirTree(oCurTest, oCurGuestSession, oCurRes.fRc); 3267 fRc = oCurTest.closeSession( True) and fRc;3373 fRc = oCurTest.closeSession() and fRc; 3268 3374 3269 3375 reporter.log2('Test #%d: Returned %d directories, %d files total' % (i, cDirs, cFiles)); … … 3303 3409 oCurTest = tdTestDirRead(); 3304 3410 oCurTest.setEnvironment(oSession, oTxsSession, oTestVm); 3305 fRc, oCurGuestSession = oCurTest.createSession('testGuestCtrlDirRead: gctrlReadDirTree2' , True);3411 fRc, oCurGuestSession = oCurTest.createSession('testGuestCtrlDirRead: gctrlReadDirTree2'); 3306 3412 if fRc is True: 3307 3413 for oDir in (self.oTestFiles.oEmptyDir, self.oTestFiles.oManyDir, self.oTestFiles.oTreeDir): 3308 3414 reporter.log('Checking "%s" ...' % (oDir.sPath,)); 3309 3415 fRc = self.gctrlReadDirTree2(oCurGuestSession, oDir) and fRc; 3310 fRc = oCurTest.closeSession( True) and fRc;3416 fRc = oCurTest.closeSession() and fRc; 3311 3417 3312 3418 return (fRc, oTxsSession); 3313 3419 3420 3314 3421 def testGuestCtrlFileRemove(self, oSession, oTxsSession, oTestVm): 3315 3422 """ … … 3317 3424 """ 3318 3425 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 # 3371 3501 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(); 3376 3515 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,)); 3384 3548 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 3394 3560 return (fRc, oTxsSession); 3561 3395 3562 3396 3563 def testGuestCtrlFileStat(self, oSession, oTxsSession, oTestVm): # pylint: disable=too-many-locals … … 3457 3624 oTest = tdTestGuestCtrlBase(); 3458 3625 oTest.setEnvironment(oSession, oTxsSession, oTestVm); 3459 fRc2, oGuestSession = oTest.createSession('FsStat on TestFileSet' , True);3626 fRc2, oGuestSession = oTest.createSession('FsStat on TestFileSet'); 3460 3627 if fRc2 is not True: 3461 3628 return (False, oTxsSession); … … 3523 3690 % (oFsObj.sPath, type(oFsObj), fExistsResult, fDirExists)); 3524 3691 3525 fRc = oTest.closeSession( True) and fRc;3692 fRc = oTest.closeSession() and fRc; 3526 3693 return (fRc, oTxsSession); 3527 3694 … … 3664 3831 3665 3832 oCurTest.setEnvironment(oSession, oTxsSession, oTestVm); 3666 fRc, _ = oCurTest.createSession('testGuestCtrlFileOpen: Test #%d' % (i,) , True);3833 fRc, _ = oCurTest.createSession('testGuestCtrlFileOpen: Test #%d' % (i,)); 3667 3834 if fRc is not True: 3668 3835 fRc = reporter.error('Test #%d failed: Could not create session' % (i,)); … … 3673 3840 fRc = reporter.error('Test #%d result mismatch: Got %s, expected %s' % (i, fRc2, oCurRes.fRc,)); 3674 3841 3675 fRc = oCurTest.closeSession( True) and fRc;3842 fRc = oCurTest.closeSession() and fRc; 3676 3843 3677 3844 return (fRc, oTxsSession); … … 3691 3858 oTest = tdTestGuestCtrlBase(); 3692 3859 oTest.setEnvironment(oSession, oTxsSession, oTestVm); 3693 fRc2, oGuestSession = oTest.createSession('FsStat on TestFileSet' , True);3860 fRc2, oGuestSession = oTest.createSession('FsStat on TestFileSet'); 3694 3861 if fRc2 is not True: 3695 3862 return (False, oTxsSession); … … 4034 4201 fRc = reporter.errorXcpt('fsObjRemove(%s)' % (sBigPath,)); 4035 4202 4036 fRc = oTest.closeSession( True) and fRc;4203 fRc = oTest.closeSession() and fRc; 4037 4204 4038 4205 return (fRc, oTxsSession); … … 4106 4273 4107 4274 oCurTest.setEnvironment(oSession, oTxsSession, oTestVm); 4108 fRc, _ = oCurTest.createSession('testGuestCtrlFileWrite: Test #%d' % (i,) , True);4275 fRc, _ = oCurTest.createSession('testGuestCtrlFileWrite: Test #%d' % (i,)); 4109 4276 if fRc is not True: 4110 4277 fRc = reporter.error('Test #%d failed: Could not create session' % (i,)); … … 4115 4282 fRc = reporter.error('Test #%d failed!' % (i,)); 4116 4283 4117 fRc = oCurTest.closeSession( True) and fRc;4284 fRc = oCurTest.closeSession() and fRc; 4118 4285 4119 4286 # … … 4333 4500 4334 4501 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,)); 4336 4503 if fRc is not True: 4337 4504 fRc = reporter.error('Test #%d failed: Could not create session' % (i,)); … … 4346 4513 fRc = reporter.error('Test #%d failed: Got %s, expected %s' % (i, fRc2, oCurRes.fRc)); 4347 4514 4348 fRc = oCurTest.closeSession( True) and fRc;4515 fRc = oCurTest.closeSession() and fRc; 4349 4516 4350 4517 return (fRc, oTxsSession); … … 4519 4686 else: 4520 4687 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,)); 4522 4689 if fRc2 is not True: 4523 4690 fRc = reporter.error('Test #%d failed: Could not create session' % (i,)); … … 4533 4700 fRc2 = False; 4534 4701 4535 fRc = oCurTest.closeSession( fIsError = True) and fRc;4702 fRc = oCurTest.closeSession() and fRc; 4536 4703 4537 4704 return (fRc, oTxsSession);
Note:
See TracChangeset
for help on using the changeset viewer.