Changeset 79262 in vbox for trunk/src/VBox/ValidationKit/tests/additions/tdAddGuestCtrl.py
- Timestamp:
- Jun 20, 2019 4:19:11 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/tests/additions/tdAddGuestCtrl.py
r79255 r79262 83 83 ## IGuest reference. 84 84 self.oGuest = oSession.o.console.guest; ## @todo may throw shit 85 self.oSes ison = oSession;86 self.oTxsSes ison = oTxsSession;85 self.oSession = oSession; 86 self.oTxsSession = oTxsSession; 87 87 self.oTestVm = oTestVm; 88 88 … … 426 426 return True; 427 427 428 def doStepsOnOpenedFile(self, fExpectSuccess ):428 def doStepsOnOpenedFile(self, fExpectSuccess, fpApiVer): 429 429 """ Overridden by children to do more testing. """ 430 _ = fExpectSuccess; 430 _ = fExpectSuccess; _ = fpApiVer; 431 431 return True; 432 432 … … 443 443 return True; 444 444 445 def doSteps(self, fExpectSuccess ):445 def doSteps(self, fExpectSuccess, fpApiVer): 446 446 """ Do the tests. """ 447 447 fRc = self.doOpenStep(fExpectSuccess); 448 448 if fRc is True: 449 fRc = self.doStepsOnOpenedFile(fExpectSuccess );449 fRc = self.doStepsOnOpenedFile(fExpectSuccess, fpApiVer); 450 450 if self.oOpenedFile: 451 451 fRc = self.doCloseStep() and fRc; … … 462 462 self.cbOpenExpected = cbOpenExpected; 463 463 464 def doStepsOnOpenedFile(self, fExpectSuccess ):464 def doStepsOnOpenedFile(self, fExpectSuccess, fpApiVer): 465 465 # 466 466 # Call parent. 467 467 # 468 fRc = tdTestFileOpen.doStepsOnOpenedFile(self, fExpectSuccess); 469 470 # 471 # Check the size. 472 # 473 try: 474 oFsObjInfo = self.oOpenedFile.queryInfo(); 475 except: 476 return reporter.errorXcpt('queryInfo([%s, %s, %s, %s, %s, %s])' 477 % (self.sFile, self.eAccessMode, self.eAction, self.eSharing, 478 self.fCreationMode, self.afOpenFlags,)); 479 if oFsObjInfo is None: 480 return reporter.error('IGuestFile::queryInfo returned None'); 481 try: 482 cbFile = oFsObjInfo.objectSize; 483 except: 484 return reporter.errorXcpt(); 485 if cbFile != self.cbOpenExpected: 486 return reporter.error('Wrong file size after open (%d): %s, expected %s (file %s) (#1)' 487 % (self.eAction, cbFile, self.cbOpenExpected, self.sFile)); 488 489 try: 490 cbFile = self.oOpenedFile.querySize(); 491 except: 492 return reporter.errorXcpt('querySize([%s, %s, %s, %s, %s, %s])' 493 % (self.sFile, self.eAccessMode, self.eAction, self.eSharing, 494 self.fCreationMode, self.afOpenFlags,)); 495 if cbFile != self.cbOpenExpected: 496 return reporter.error('Wrong file size after open (%d): %s, expected %s (file %s) (#2)' 497 % (self.eAction, cbFile, self.cbOpenExpected, self.sFile)); 468 fRc = tdTestFileOpen.doStepsOnOpenedFile(self, fExpectSuccess, fpApiVer); 469 470 # 471 # Check the size. Requires 6.0 or later (E_NOTIMPL in 5.2). 472 # 473 if fpApiVer >= 6.0: 474 try: 475 oFsObjInfo = self.oOpenedFile.queryInfo(); 476 except: 477 return reporter.errorXcpt('queryInfo([%s, %s, %s, %s, %s, %s])' 478 % (self.sFile, self.eAccessMode, self.eAction, self.eSharing, 479 self.fCreationMode, self.afOpenFlags,)); 480 if oFsObjInfo is None: 481 return reporter.error('IGuestFile::queryInfo returned None'); 482 try: 483 cbFile = oFsObjInfo.objectSize; 484 except: 485 return reporter.errorXcpt(); 486 if cbFile != self.cbOpenExpected: 487 return reporter.error('Wrong file size after open (%d): %s, expected %s (file %s) (#1)' 488 % (self.eAction, cbFile, self.cbOpenExpected, self.sFile)); 489 490 try: 491 cbFile = self.oOpenedFile.querySize(); 492 except: 493 return reporter.errorXcpt('querySize([%s, %s, %s, %s, %s, %s])' 494 % (self.sFile, self.eAccessMode, self.eAction, self.eSharing, 495 self.fCreationMode, self.afOpenFlags,)); 496 if cbFile != self.cbOpenExpected: 497 return reporter.error('Wrong file size after open (%d): %s, expected %s (file %s) (#2)' 498 % (self.eAction, cbFile, self.cbOpenExpected, self.sFile)); 498 499 499 500 return fRc; … … 3496 3497 break; 3497 3498 3498 fRc2 = oCurTest.doSteps(oCurRes.fRc );3499 fRc2 = oCurTest.doSteps(oCurRes.fRc, self.oTstDrv.fpApiVer); 3499 3500 if fRc2 != oCurRes.fRc: 3500 3501 fRc = reporter.error('Test #%d result mismatch: Got %s, expected %s' % (i, fRc2, oCurRes.fRc,)); … … 3718 3719 # Check stat info on the file as well as querySize. 3719 3720 # 3721 if self.oTstDrv.fpApiVer > 5.2: 3722 try: 3723 oFsObjInfo = oFile.queryInfo(); 3724 except: 3725 fRc = reporter.errorXcpt('%s: queryInfo()' % (oTestFile.sPath,)); 3726 else: 3727 if oFsObjInfo is None: 3728 fRc = reporter.error('IGuestFile::queryInfo returned None'); 3729 else: 3730 try: 3731 cbFile = oFsObjInfo.objectSize; 3732 except: 3733 fRc = reporter.errorXcpt(); 3734 else: 3735 if cbFile != oTestFile.cbContent: 3736 fRc = reporter.error('%s: queryInfo returned incorrect file size: %s, expected %s' 3737 % (oTestFile.sPath, cbFile, oTestFile.cbContent)); 3738 3739 try: 3740 cbFile = oFile.querySize(); 3741 except: 3742 fRc = reporter.errorXcpt('%s: querySize()' % (oTestFile.sPath,)); 3743 else: 3744 if cbFile != oTestFile.cbContent: 3745 fRc = reporter.error('%s: querySize returned incorrect file size: %s, expected %s' 3746 % (oTestFile.sPath, cbFile, oTestFile.cbContent)); 3747 3748 # 3749 # Use seek to test the file size and do a few other end-relative seeks. 3750 # 3720 3751 try: 3721 oFsObjInfo = oFile.queryInfo();3752 cbFile = oFile.seek(0, vboxcon.FileSeekOrigin_End); 3722 3753 except: 3723 fRc = reporter.errorXcpt('%s: queryInfo()' % (oTestFile.sPath,)); 3724 else: 3725 if oFsObjInfo is None: 3726 fRc = reporter.error('IGuestFile::queryInfo returned None'); 3727 else: 3728 try: 3729 cbFile = oFsObjInfo.objectSize; 3730 except: 3731 fRc = reporter.errorXcpt(); 3732 else: 3733 if cbFile != oTestFile.cbContent: 3734 fRc = reporter.error('%s: queryInfo returned incorrect file size: %s, expected %s' 3735 % (oTestFile.sPath, cbFile, oTestFile.cbContent)); 3736 3737 try: 3738 cbFile = oFile.querySize(); 3739 except: 3740 fRc = reporter.errorXcpt('%s: querySize()' % (oTestFile.sPath,)); 3754 fRc = reporter.errorXcpt('%s: seek(0,End)' % (oTestFile.sPath,)); 3741 3755 else: 3742 3756 if cbFile != oTestFile.cbContent: 3743 fRc = reporter.error('%s: querySizereturned incorrect file size: %s, expected %s'3757 fRc = reporter.error('%s: seek(0,End) returned incorrect file size: %s, expected %s' 3744 3758 % (oTestFile.sPath, cbFile, oTestFile.cbContent)); 3759 if oTestFile.cbContent > 0: 3760 for _ in xrange(12): 3761 offSeek = self.oTestFiles.oRandom.randrange(oTestFile.cbContent + 1); 3762 try: 3763 offFile = oFile.seek(-offSeek, vboxcon.FileSeekOrigin_End); 3764 except: 3765 fRc = reporter.errorXcpt('%s: seek(%s,End)' % (oTestFile.sPath, -offSeek,)); 3766 else: 3767 if offFile != oTestFile.cbContent - offSeek: 3768 fRc = reporter.error('%s: seek(%s,End) returned incorrect offset: %s, expected %s (cbContent=%s)' 3769 % (oTestFile.sPath, -offSeek, offSeek, oTestFile.cbContent - offSeek, 3770 oTestFile.cbContent,)); 3745 3771 3746 3772 #
Note:
See TracChangeset
for help on using the changeset viewer.