Changeset 70849 in vbox for trunk/src/VBox/ValidationKit/tests/api/tdMoveMedium1.py
- Timestamp:
- Feb 1, 2018 1:27:34 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/tests/api/tdMoveMedium1.py
r70816 r70849 44 44 from testdriver import base 45 45 from testdriver import reporter 46 from testdriver import vboxcon 46 47 from testdriver import vboxwrappers 47 48 … … 51 52 Sub-test driver for Medium Move Test #1. 52 53 """ 53 54 # List of suffixes to append.55 suffixes = [56 '.vdi',57 ]58 54 59 55 def __init__(self, oTstDrv): … … 79 75 80 76 try: 81 oProgress = vboxwrappers.ProgressWrapper(oMedium.setLocation(sLocation), self.oTstDrv.oVBoxMgr, self.oTstDrv, 'move "%s"' % (oMedium.name,)) 77 oProgress = vboxwrappers.ProgressWrapper(oMedium.setLocation(sLocation), self.oTstDrv.oVBoxMgr, self.oTstDrv, 78 'move "%s"' % (oMedium.name,)) 82 79 except: 83 80 return reporter.errorXcpt('Medium::setLocation("%s") for medium "%s" failed' % (sLocation, oMedium.name,)) … … 105 102 assert oVM is not None 106 103 107 # create virtual disk image vdi104 # create disk images 108 105 fRc = True 109 106 c = 0 110 107 oSession = self.oTstDrv.openSession(oVM) 111 for i in self.suffixes: 112 sHddPath = os.path.join(self.oTstDrv.sScratchPath, 'Test' + str(c) + i) 113 oHd = oSession.createBaseHd(sHddPath, cb=1024*1024) 108 aoDskFmts = self.oTstDrv.oVBoxMgr.getArray(self.oTstDrv.oVBox.systemProperties, 'mediumFormats') 109 for oDskFmt in aoDskFmts: 110 aoDskFmtCaps = self.oTstDrv.oVBoxMgr.getArray(oDskFmt, 'capabilities') 111 if vboxcon.MediumFormatCapabilities_File not in aoDskFmtCaps \ 112 or vboxcon.MediumFormatCapabilities_CreateDynamic not in aoDskFmtCaps: 113 continue 114 (asExts, aTypes) = oDskFmt.describeFileExtensions() 115 for i in range(0, len(asExts)): 116 if aTypes[i] is vboxcon.DeviceType_HardDisk: 117 sExt = '.' + asExts[i] 118 break 119 if sExt is None: 120 fRc = False 121 break 122 sHddPath = os.path.join(self.oTstDrv.sScratchPath, 'Test' + str(c) + sExt) 123 oHd = oSession.createBaseHd(sHddPath, sFmt=oDskFmt.id, cb=1024*1024) 114 124 if oHd is None: 115 125 fRc = False … … 118 128 # attach HDD, IDE controller exists by default, but we use SATA just in case 119 129 sController='SATA Controller' 120 fRc = fRc and oSession.attachHd(sHddPath, sController, iPort = c, iDevice = 0, fImmutable=False, fForceResource=False) 121 fRc = fRc and oSession.saveSettings() 130 fRc = fRc and oSession.attachHd(sHddPath, sController, iPort = c, fImmutable=False, fForceResource=False) 131 if fRc: 132 c += 1 133 134 fRc = fRc and oSession.saveSettings() 122 135 123 136 #create temporary subdirectory in the current working directory … … 125 138 sNewLoc = os.path.join(sOrigLoc, 'newLocation/') 126 139 127 os.m akedirs(sNewLoc, 0o775)140 os.mkdir(sNewLoc, 0o775) 128 141 129 142 aListOfAttach = oVM.getMediumAttachmentsOfController(sController) … … 137 150 138 151 #case 3. Path with file name 139 sLocation = sNewLoc + 'newName .vdi'152 sLocation = sNewLoc + 'newName' 140 153 self.setLocation(sLocation, aListOfAttach) 141 154
Note:
See TracChangeset
for help on using the changeset viewer.