Changeset 79332 in vbox for trunk/src/VBox/ValidationKit
- Timestamp:
- Jun 25, 2019 3:12:26 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/tests/additions/tdAddGuestCtrl.py
r79330 r79332 1249 1249 Test updating the Guest Additions inside the guest. 1250 1250 """ 1251 def __init__(self, sSrc = "", asArgs = None, fFlags = None, oCreds = None):1251 def __init__(self, sSrc = "", asArgs = None, afFlags = None, oCreds = None): 1252 1252 tdTestGuestCtrlBase.__init__(self, oCreds = oCreds); 1253 1253 self.sSrc = sSrc; 1254 1254 self.asArgs = asArgs; 1255 self. fFlags =fFlags;1255 self.afFlags = afFlags; 1256 1256 1257 1257 class tdTestResult(object): … … 4695 4695 """ 4696 4696 4697 ## @todo currently disabled everywhere. 4698 if self.oTstDrv.fpApiVer < 100.0: 4699 reporter.log("Skipping updating GAs everywhere for now..."); 4700 return None; 4701 4697 4702 # Skip test for updating Guest Additions if we run on a too old (Windows) guest. 4698 4703 ## … … 4706 4711 return (None, oTxsSession); 4707 4712 4708 # Some stupid trickery to guess the location of the iso. 4709 sVBoxValidationKitISO = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../VBoxValidationKit.iso')); 4710 if not os.path.isfile(sVBoxValidationKitISO): 4711 sVBoxValidationKitISO = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../VBoxTestSuite.iso')); 4712 if not os.path.isfile(sVBoxValidationKitISO): 4713 sCur = os.getcwd(); 4714 for i in xrange(0, 10): 4715 sVBoxValidationKitISO = os.path.join(sCur, 'validationkit/VBoxValidationKit.iso'); 4716 if os.path.isfile(sVBoxValidationKitISO): 4717 break; 4718 sVBoxValidationKitISO = os.path.join(sCur, 'testsuite/VBoxTestSuite.iso'); 4719 if os.path.isfile(sVBoxValidationKitISO): 4720 break; 4721 sCur = os.path.abspath(os.path.join(sCur, '..')); 4722 if i is None: pass; # shut up pychecker/pylint. 4723 if os.path.isfile(sVBoxValidationKitISO): 4724 reporter.log('Validation Kit .ISO found at: %s' % (sVBoxValidationKitISO,)); 4725 else: 4726 reporter.log('Warning: Validation Kit .ISO not found -- some tests might fail'); 4713 sVBoxValidationKitIso = self.oTstDrv.sVBoxValidationKitIso; 4714 if not os.path.isfile(sVBoxValidationKitIso): 4715 return reporter.log('Validation Kit .ISO not found at "%s"' % (sVBoxValidationKitIso,)); 4727 4716 4728 4717 sScratch = os.path.join(self.oTstDrv.sScratchPath, "testGctrlUpdateAdditions"); … … 4731 4720 except OSError as e: 4732 4721 if e.errno != errno.EEXIST: 4733 reporter.error('Failed: Unable to create scratch directory \"%s\"' % (sScratch,)); 4734 return (False, oTxsSession); 4722 return reporter.error('Failed: Unable to create scratch directory \"%s\"' % (sScratch,)); 4735 4723 reporter.log('Scratch path is: %s' % (sScratch,)); 4736 4724 … … 4741 4729 [ tdTestUpdateAdditions(sSrc = ''), tdTestResultFailure() ], 4742 4730 4743 # Wrong f Flags.4731 # Wrong flags. 4744 4732 [ tdTestUpdateAdditions(sSrc = self.oTstDrv.getGuestAdditionsIso(), 4745 fFlags = [ 1234 ]), tdTestResultFailure() ],4733 afFlags = [ 1234 ]), tdTestResultFailure() ], 4746 4734 4747 4735 # Non-existing .ISO. … … 4749 4737 4750 4738 # Wrong .ISO. 4751 [ tdTestUpdateAdditions(sSrc = sVBoxValidationKitI SO), tdTestResultFailure() ],4739 [ tdTestUpdateAdditions(sSrc = sVBoxValidationKitIso), tdTestResultFailure() ], 4752 4740 4753 4741 # The real thing. … … 4768 4756 4769 4757 fRc = True; 4770 for (i, aTest) in enumerate(atTests):4771 oCurTest = aTest[0]; # tdTestExec, use an index, later.4772 oCurRes = aTest[1]; #tdTestResult4773 reporter.log('Testing #%d, sSrc="%s", fFlags="%s" ...' % \4774 (i, oCurTest.sSrc, oCurTest.fFlags)); 4758 for (i, tTest) in enumerate(atTests): 4759 oCurTest = tTest[0] # type: tdTestUpdateAdditions 4760 oCurRes = tTest[1] # type: tdTestResult 4761 reporter.log('Testing #%d, sSrc="%s", afFlags="%s" ...' % (i, oCurTest.sSrc, oCurTest.afFlags,)); 4762 4775 4763 oCurTest.setEnvironment(oSession, oTxsSession, oTestVm); 4776 4764 fRc, _ = oCurTest.createSession('Test #%d' % (i,)); 4777 if fRc is False:4778 reporter.error('Test #%d failed: Could not create session' % (i,));4765 if fRc is not True: 4766 fRc = reporter.error('Test #%d failed: Could not create session' % (i,)); 4779 4767 break; 4780 try: 4781 oCurProgress = oCurTest.oGuest.updateGuestAdditions(oCurTest.sSrc, oCurTest.asArgs, oCurTest.fFlags); 4768 4769 try: 4770 oCurProgress = oCurTest.oGuest.updateGuestAdditions(oCurTest.sSrc, oCurTest.asArgs, oCurTest.afFlags); 4771 except: 4772 reporter.maybeErrXcpt(oCurRes.fRc, 'Updating Guest Additions exception for sSrc="%s", afFlags="%s":' 4773 % (oCurTest.sSrc, oCurTest.afFlags,)); 4774 fRc = False; 4775 else: 4782 4776 if oCurProgress is not None: 4783 oProgress = vboxwrappers.ProgressWrapper(oCurProgress, self.oTstDrv.oVBoxMgr, self.oTstDrv, "gctrlUpGA"); 4784 try: 4785 oProgress.wait(); 4786 if not oProgress.isSuccess(): 4787 oProgress.logResult(fIgnoreErrors = True); 4788 fRc = False; 4789 except: 4790 reporter.logXcpt('Waiting exception for updating Guest Additions:'); 4777 oWrapperProgress = vboxwrappers.ProgressWrapper(oCurProgress, self.oTstDrv.oVBoxMgr, 4778 self.oTstDrv, "gctrlUpGA"); 4779 oWrapperProgress.wait(); 4780 if not oWrapperProgress.isSuccess(): 4781 oWrapperProgress.logResult(fIgnoreErrors = not oCurRes.fRc); 4791 4782 fRc = False; 4792 4783 else: 4793 reporter.error('No progress object returned'); 4794 fRc = False; 4795 except: 4796 # Just log, don't assume an error here (will be done in the main loop then). 4797 reporter.logXcpt('Updating Guest Additions exception for sSrc="%s", fFlags="%s":' \ 4798 % (oCurTest.sSrc, oCurTest.fFlags)); 4799 fRc = False; 4784 fRc = reporter.error('No progress object returned'); 4785 4800 4786 oCurTest.closeSession(); 4801 4787 if fRc is oCurRes.fRc: 4802 4788 if fRc: 4803 4789 ## @todo Verify if Guest Additions were really updated (build, revision, ...). 4790 ## @todo r=bird: Not possible since you're installing the same GAs as before... 4791 ## Maybe check creation dates on certain .sys/.dll/.exe files? 4804 4792 pass; 4805 4793 else: 4806 reporter.error('Test #%d failed: Got %s, expected %s' % (i, fRc, oCurRes.fRc)); 4807 fRc = False; 4794 fRc = reporter.error('Test #%d failed: Got %s, expected %s' % (i, fRc, oCurRes.fRc)); 4808 4795 break; 4809 4796 … … 4941 4928 asArgs = [ sCmd, '/C', 'dir', '/S', 'c:\\windows' ]; 4942 4929 aEnv = []; 4943 fFlags = [];4930 afFlags = []; 4944 4931 4945 4932 for _ in xrange(100): 4946 4933 oProc = oGuestSession.processCreate(sCmd, asArgs if self.fpApiVer >= 5.0 else asArgs[1:], 4947 aEnv, fFlags, 30 * 1000);4934 aEnv, afFlags, 30 * 1000); 4948 4935 4949 4936 aWaitFor = [ vboxcon.ProcessWaitForFlag_Terminate ];
Note:
See TracChangeset
for help on using the changeset viewer.