Changeset 99112 in vbox for trunk/src/VBox/ValidationKit/tests/api
- Timestamp:
- Mar 22, 2023 12:42:20 PM (2 years ago)
- svn:sync-xref-src-repo-rev:
- 156477
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/tests/api/tdTreeDepth1.py
r99100 r99112 45 45 import sys 46 46 import random 47 import time 47 48 import gc 48 49 … … 125 126 return True; 126 127 127 def openAndRegisterMachine(self, oVBox,sSettingsFile):128 def openAndRegisterMachine(self, sSettingsFile): 128 129 """ 129 130 Helper routine which opens a VM and registers it. … … 133 134 if self.oTstDrv.fpApiVer >= 7.0: 134 135 # Needs a password parameter since 7.0. 135 oVM = oVBox.openMachine(sSettingsFile, "");136 oVM = self.oTstDrv.oVBox.openMachine(sSettingsFile, ""); 136 137 else: 137 oVM = oVBox.openMachine(sSettingsFile);138 oVM = self.oTstDrv.oVBox.openMachine(sSettingsFile); 138 139 except: 139 140 reporter.logXcpt('openMachine(%s) failed' % (sSettingsFile)); … … 144 145 145 146 try: 146 oVBox.registerMachine(oVM);147 self.oTstDrv.oVBox.registerMachine(oVM); 147 148 except: 148 149 reporter.logXcpt('registerMachine(%s) failed' % (sSettingsFile)); … … 210 211 # If there is no base image (expected) then there are no leftover 211 212 # child images either. 212 oVBox = self.oTstDrv.oVBoxMgr.getVirtualBox(); 213 if oVBox is None: 214 return False; 215 216 cBaseImages = len(self.oTstDrv.oVBoxMgr.getArray(oVBox, 'hardDisks')) 213 cBaseImages = len(self.oTstDrv.oVBoxMgr.getArray(self.oTstDrv.oVBox, 'hardDisks')) 217 214 reporter.log('After unregister(DetachAllReturnHardDisksOnly): API reports %d base images' % (cBaseImages)); 218 215 if cBaseImages != 0: … … 220 217 221 218 # re-register to test loading of settings 222 oVM = self.openAndRegisterMachine( oVBox,sSettingsFile);219 oVM = self.openAndRegisterMachine(sSettingsFile); 223 220 if oVM is None: 224 221 return False; … … 243 240 # the object when the garbage collector runs however this can take several seconds 244 241 # so we invoke the Python garbage collector manually here so we don't have to wait. 245 reporter.log('Invoking python garbage collection to trigger Machine::uninit() which will close the attached disks');246 242 try: 247 243 gc.collect(); … … 249 245 reporter.logXcpt(); 250 246 251 cBaseImages = len(self.oTstDrv.oVBoxMgr.getArray(oVBox, 'hardDisks')); 247 reporter.log('Waiting three seconds for Machine::uninit() to be called to close the attached disks'); 248 # Fudge factor: Machine::uninit() will be invoked when the oVM object is processed 249 # by the garbage collector above but it may take a few moments to close up to 64 250 # disks. 251 time.sleep(3); 252 253 cBaseImages = len(self.oTstDrv.oVBoxMgr.getArray(self.oTstDrv.oVBox, 'hardDisks')) 252 254 reporter.log('After unregister(UnregisterOnly): API reports %d base images' % (cBaseImages)); 253 255 if cBaseImages != 0: … … 303 305 # If there is no base image (expected) then there are no leftover 304 306 # child images either. 305 oVBox = self.oTstDrv.oVBoxMgr.getVirtualBox() 306 if oVBox is None: 307 return False; 308 309 cBaseImages = len(self.oTstDrv.oVBoxMgr.getArray(oVBox, 'hardDisks')) 307 cBaseImages = len(self.oTstDrv.oVBoxMgr.getArray(self.oTstDrv.oVBox, 'hardDisks')) 310 308 reporter.log('After unregister(DetachAllReturnHardDisksOnly): API reports %d base images' % (cBaseImages)); 311 309 fRc = fRc and cBaseImages == 0 … … 314 312 315 313 # re-register to test loading of settings 316 oVM = self.openAndRegisterMachine( oVBox,sSettingsFile);314 oVM = self.openAndRegisterMachine(sSettingsFile); 317 315 if oVM is None: 318 316 return False; … … 336 334 # the object when the garbage collector runs however this can take several seconds 337 335 # so we invoke the Python garbage collector manually here so we don't have to wait. 338 reporter.log('Invoking python garbage collection to trigger Machine::uninit() which will close the attached disks');339 336 try: 340 337 gc.collect(); … … 342 339 reporter.logXcpt(); 343 340 344 cBaseImages = len(self.oTstDrv.oVBoxMgr.getArray(oVBox, 'hardDisks')) 341 reporter.log('Waiting three seconds for Machine::uninit() to be called to close the attached disks'); 342 # Fudge factor: Machine::uninit() will be invoked when the oVM object is processed 343 # by the garbage collector above but it may take a few moments to close up to 200 344 # snapshots. 345 time.sleep(3); 346 347 cBaseImages = len(self.oTstDrv.oVBoxMgr.getArray(self.oTstDrv.oVBox, 'hardDisks')) 345 348 reporter.log('After unregister(UnregisterOnly): API reports %d base images' % (cBaseImages)); 346 349 if cBaseImages != 0:
Note:
See TracChangeset
for help on using the changeset viewer.