- Timestamp:
- May 22, 2019 5:06:36 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/tests/api/tdCreateVMWithDefaults1.py
r78634 r78671 42 42 43 43 # Validation Kit imports. 44 from testdriver import base 44 45 from testdriver import reporter; 45 from testdriver import vbox;46 46 from testdriver import vboxcon; 47 47 48 class tdCreateVMWithDefaults1(vbox.TestDriver):48 class SubTstDrvCreateVMWithDefaults1(base.SubTestDriverBase): 49 49 """ 50 Create VM with defaultsTest #1.50 Sub-test driver for VM Move Test #1. 51 51 """ 52 52 53 def __init__(self ):54 vbox.TestDriver.__init__(self);55 self.asRsrcs = None;53 def __init__(self, oTstDrv): 54 base.SubTestDriverBase.__init__(self, 'move-vm', oTstDrv) 55 self.asRsrcs = [] 56 56 57 def getResourceSet(self): 58 # Construct the resource list the first time it's queried. 59 if self.asRsrcs is None: 60 self.asRsrcs = []; 61 return self.asRsrcs; 62 63 def actionExecute(self): 57 def testIt(self): 64 58 """ 65 Execute the testcase.59 Execute the sub-testcase. 66 60 """ 67 fRc = self.testCreateVMWithDefaults()68 return fRc;61 reporter.log('ValidationKit folder is "%s"' % (g_ksValidationKitDir,)) 62 return self.testCreateVMWithDefaults() 69 63 70 64 def createVMWithDefaults(self, sGuestType): … … 73 67 # the method, but IMachine::applyDefault() must be called before machine is registered 74 68 try: 75 if self.fpApiVer >= 4.2: # Introduces grouping (third parameter, empty for now). 76 oVM = self.oVBox.createMachine("", sName, [], self.tryFindGuestOsId(sGuestType), "") 77 elif self.fpApiVer >= 4.0: 78 oVM = self.oVBox.createMachine("", sName, self.tryFindGuestOsId(sGuestType), "", 79 False) 80 elif self.fpApiVer >= 3.2: 81 oVM = self.oVBox.createMachine(sName, self.tryFindGuestOsId(sGuestType), "", "", 82 False) 69 if self.oTstDrv.fpApiVer >= 4.2: # Introduces grouping (third parameter, empty for now). 70 oVM = self.oTstDrv.oVBox.createMachine("", sName, [], 71 self.oTstDrv.tryFindGuestOsId(sGuestType), 72 "") 73 elif self.oTstDrv.fpApiVer >= 4.0: 74 oVM = self.oTstDrv.oVBox.createMachine("", sName, 75 self.oTstDrv.tryFindGuestOsId(sGuestType), 76 "", False) 77 elif self.oTstDrv.fpApiVer >= 3.2: 78 oVM = self.oTstDrv.oVBox.createMachine(sName, 79 self.oTstDrv.tryFindGuestOsId(sGuestType), 80 "", "", False) 83 81 else: 84 oVM = self.oVBox.createMachine(sName, self.tryFindGuestOsId(sGuestType), "", "") 82 oVM = self.oTstDrv.oVBox.createMachine(sName, 83 self.oTstDrv.tryFindGuestOsId(sGuestType), 84 "", "") 85 85 try: 86 86 oVM.saveSettings() 87 87 except: 88 88 reporter.logXcpt() 89 if self. fpApiVer >= 4.0:89 if self.oTstDrv.fpApiVer >= 4.0: 90 90 try: 91 if self. fpApiVer >= 4.3:91 if self.oTstDrv.fpApiVer >= 4.3: 92 92 oProgress = oVM.deleteConfig([]) 93 93 else: 94 94 oProgress = oVM.delete(None); 95 self. waitOnProgress(oProgress)95 self.oTstDrv.waitOnProgress(oProgress) 96 96 except: 97 97 reporter.logXcpt() … … 110 110 fRc = True 111 111 try: 112 if self. fpApiVer >= 6.1:112 if self.oTstDrv.fpApiVer >= 6.1: 113 113 oVM.applyDefaults('') 114 114 oVM.saveSettings(); 115 self.o VBox.registerMachine(oVM)115 self.oTstDrv.oVBox.registerMachine(oVM) 116 116 except: 117 117 reporter.logXcpt() 118 118 fRc = False 119 119 120 # some errors from applyDefaults can be observed only after further settings saving121 # change and save the size of the VM RAM as simple setting change.122 oSession = self.o penSession(oVM)120 # Some errors from applyDefaults can be observed only after further settings saving. 121 # Change and save the size of the VM RAM as simple setting change. 122 oSession = self.oTstDrv.openSession(oVM) 123 123 if oSession is None: 124 124 fRc = False … … 132 132 fRc = False 133 133 134 # delete VM134 # delete VM 135 135 try: 136 136 oVM.unregister(vboxcon.CleanupMode_DetachAllReturnNone) … … 138 138 reporter.logXcpt() 139 139 140 if self. fpApiVer >= 4.0:140 if self.oTstDrv.fpApiVer >= 4.0: 141 141 try: 142 if self. fpApiVer >= 4.3:142 if self.oTstDrv.fpApiVer >= 4.3: 143 143 oProgress = oVM.deleteConfig([]) 144 144 else: 145 145 oProgress = oVM.delete(None) 146 self. waitOnProgress(oProgress)146 self.oTstDrv.waitOnProgress(oProgress) 147 147 148 148 except: … … 159 159 Test create VM with defaults. 160 160 """ 161 if not self. importVBoxApi():161 if not self.oTstDrv.importVBoxApi(): 162 162 return reporter.error('importVBoxApi'); 163 163 164 164 # Get the guest OS types. 165 165 try: 166 aoGuestTypes = self.o VBoxMgr.getArray(self.oVBox, 'guestOSTypes')166 aoGuestTypes = self.oTstDrv.oVBoxMgr.getArray(self.oTstDrv.oVBox, 'guestOSTypes') 167 167 if aoGuestTypes is None or len(aoGuestTypes) < 1: 168 168 return reporter.error('No guest OS types'); … … 187 187 188 188 if __name__ == '__main__': 189 sys.exit(tdCreateVMWithDefaults1().main(sys.argv)) 189 sys.path.append(os.path.dirname(os.path.abspath(__file__))) 190 from tdApi1 import tdApi1; # pylint: disable=relative-import 191 sys.exit(tdApi1([SubTstDrvCreateVMWithDefaults1]).main(sys.argv))
Note:
See TracChangeset
for help on using the changeset viewer.