Changeset 38204 in vbox for trunk/src/VBox/Storage
- Timestamp:
- Jul 27, 2011 4:14:59 PM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 73172
- Location:
- trunk/src/VBox/Storage/testcase
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Storage/testcase/tstVDIo.cpp
r37308 r38204 300 300 static DECLCALLBACK(int) vdScriptHandlerMerge(PVDTESTGLOB pGlob, PVDSCRIPTARG paScriptArgs, unsigned cScriptArgs); 301 301 static DECLCALLBACK(int) vdScriptHandlerCompact(PVDTESTGLOB pGlob, PVDSCRIPTARG paScriptArgs, unsigned cScriptArgs); 302 static DECLCALLBACK(int) vdScriptHandlerCopy(PVDTESTGLOB pGlob, PVDSCRIPTARG paScriptArgs, unsigned cScriptArgs); 302 303 static DECLCALLBACK(int) vdScriptHandlerClose(PVDTESTGLOB pGlob, PVDSCRIPTARG paScriptArgs, unsigned cScriptArgs); 303 304 static DECLCALLBACK(int) vdScriptHandlerIoRngCreate(PVDTESTGLOB pGlob, PVDSCRIPTARG paScriptArgs, unsigned cScriptArgs); … … 377 378 }; 378 379 380 /* Compact a disk */ 381 const VDSCRIPTARGDESC g_aArgCopy[] = 382 { 383 /* pcszName chId enmType fFlags */ 384 {"diskfrom", 's', VDSCRIPTARGTYPE_STRING, VDSCRIPTARGDESC_FLAG_MANDATORY}, 385 {"diskto", 'd', VDSCRIPTARGTYPE_STRING, VDSCRIPTARGDESC_FLAG_MANDATORY}, 386 {"imagefrom", 'i', VDSCRIPTARGTYPE_UNSIGNED_NUMBER, VDSCRIPTARGDESC_FLAG_MANDATORY}, 387 {"backend", 'b', VDSCRIPTARGTYPE_STRING, 0}, 388 {"filename", 'f', VDSCRIPTARGTYPE_STRING, 0}, 389 {"movebyrename", 'm', VDSCRIPTARGTYPE_BOOL, 0}, 390 {"size", 'z', VDSCRIPTARGTYPE_UNSIGNED_NUMBER, 0}, 391 {"fromsame", 'o', VDSCRIPTARGTYPE_UNSIGNED_NUMBER, 0}, 392 {"tosame", 't', VDSCRIPTARGTYPE_UNSIGNED_NUMBER, 0} 393 }; 394 379 395 /* close action */ 380 396 const VDSCRIPTARGDESC g_aArgClose[] = … … 481 497 {"merge", g_aArgMerge, RT_ELEMENTS(g_aArgMerge), vdScriptHandlerMerge}, 482 498 {"compact", g_aArgCompact, RT_ELEMENTS(g_aArgCompact), vdScriptHandlerCompact}, 499 {"copy", g_aArgCopy, RT_ELEMENTS(g_aArgCopy), vdScriptHandlerCopy}, 483 500 {"iorngcreate", g_aArgIoRngCreate, RT_ELEMENTS(g_aArgIoRngCreate), vdScriptHandlerIoRngCreate}, 484 501 {"iorngdestroy", NULL, 0, vdScriptHandlerIoRngDestroy}, … … 1185 1202 */ 1186 1203 rc = VDCompact(pDisk->pVD, nImage, NULL); 1204 } 1205 } 1206 1207 return rc; 1208 } 1209 1210 static DECLCALLBACK(int) vdScriptHandlerCopy(PVDTESTGLOB pGlob, PVDSCRIPTARG paScriptArgs, unsigned cScriptArgs) 1211 { 1212 int rc = VINF_SUCCESS; 1213 const char *pcszDiskFrom = NULL; 1214 const char *pcszDiskTo = NULL; 1215 PVDDISK pDiskFrom = NULL; 1216 PVDDISK pDiskTo = NULL; 1217 unsigned nImageFrom = 0; 1218 const char *pcszBackend = NULL; 1219 const char *pcszFilename = NULL; 1220 bool fMoveByRename = false; 1221 uint64_t cbSize = 0; 1222 unsigned nImageFromSame = VD_IMAGE_CONTENT_UNKNOWN; 1223 unsigned nImageToSame = VD_IMAGE_CONTENT_UNKNOWN; 1224 1225 for (unsigned i = 0; i < cScriptArgs; i++) 1226 { 1227 switch (paScriptArgs[i].chId) 1228 { 1229 case 's': 1230 { 1231 pcszDiskFrom = paScriptArgs[i].u.pcszString; 1232 break; 1233 } 1234 case 'd': 1235 { 1236 pcszDiskTo = paScriptArgs[i].u.pcszString; 1237 break; 1238 } 1239 case 'i': 1240 { 1241 nImageFrom = (unsigned)paScriptArgs[i].u.u64; 1242 break; 1243 } 1244 case 'b': 1245 { 1246 pcszBackend = paScriptArgs[i].u.pcszString; 1247 break; 1248 } 1249 case 'f': 1250 { 1251 pcszFilename = paScriptArgs[i].u.pcszString; 1252 break; 1253 } 1254 case 'm': 1255 { 1256 fMoveByRename = paScriptArgs[i].u.fFlag; 1257 break; 1258 } 1259 case 'z': 1260 { 1261 cbSize = paScriptArgs[i].u.u64; 1262 break; 1263 } 1264 case 'o': 1265 { 1266 nImageFromSame = (unsigned)paScriptArgs[i].u.u64; 1267 break; 1268 } 1269 case 't': 1270 { 1271 nImageToSame = (unsigned)paScriptArgs[i].u.u64; 1272 break; 1273 } 1274 1275 default: 1276 AssertMsgFailed(("Invalid argument given!\n")); 1277 } 1278 1279 if (RT_FAILURE(rc)) 1280 break; 1281 } 1282 1283 if (RT_SUCCESS(rc)) 1284 { 1285 pDiskFrom = tstVDIoGetDiskByName(pGlob, pcszDiskFrom); 1286 pDiskTo = tstVDIoGetDiskByName(pGlob, pcszDiskTo); 1287 if (!pDiskFrom || !pDiskTo) 1288 rc = VERR_NOT_FOUND; 1289 else 1290 { 1291 /** @todo: Provide progress interface to test that cancelation 1292 * works as intended. 1293 */ 1294 rc = VDCopyEx(pDiskFrom->pVD, nImageFrom, pDiskTo->pVD, pcszBackend, pcszFilename, 1295 fMoveByRename, cbSize, nImageFromSame, nImageToSame, 1296 VD_IMAGE_FLAGS_NONE, NULL, VD_OPEN_FLAGS_ASYNC_IO, 1297 NULL, pGlob->pInterfacesImages, NULL); 1187 1298 } 1188 1299 } -
trunk/src/VBox/Storage/testcase/tstVDIo.vd
r36135 r38204 25 25 io disk=test async=yes max-reqs=32 mode=seq blocksize=64k off=0-200M size=200M writes=100 26 26 io disk=test async=yes max-reqs=32 mode=seq blocksize=64k off=0-200M size=200M writes=0 27 create disk=test mode=diff name=tstShared2.vmdk type=dynamic backend=VMDK size=20 M27 create disk=test mode=diff name=tstShared2.vmdk type=dynamic backend=VMDK size=200M 28 28 io disk=test async=yes max-reqs=32 mode=rnd blocksize=64k off=0-200M size=200M writes=50 29 create disk=test mode=diff name=tstShared3.vmdk type=dynamic backend=VMDK size=20 M29 create disk=test mode=diff name=tstShared3.vmdk type=dynamic backend=VMDK size=200M 30 30 io disk=test async=yes max-reqs=32 mode=rnd blocksize=64k off=0-200M size=200M writes=50 31 31 close disk=test mode=single delete=yes … … 40 40 io disk=test async=yes max-reqs=32 mode=seq blocksize=64k off=0-200M size=200M writes=100 41 41 io disk=test async=yes max-reqs=32 mode=seq blocksize=64k off=0-200M size=200M writes=0 42 create disk=test mode=diff name=tstShared2.vdi type=dynamic backend=VDI size=20 M42 create disk=test mode=diff name=tstShared2.vdi type=dynamic backend=VDI size=200M 43 43 io disk=test async=yes max-reqs=32 mode=rnd blocksize=64k off=0-200M size=200M writes=50 44 create disk=test mode=diff name=tstShared3.vdi type=dynamic backend=VDI size=20 M44 create disk=test mode=diff name=tstShared3.vdi type=dynamic backend=VDI size=200M 45 45 io disk=test async=yes max-reqs=32 mode=rnd blocksize=64k off=0-200M size=200M writes=50 46 46 close disk=test mode=single delete=yes … … 55 55 io disk=test async=yes max-reqs=32 mode=seq blocksize=64k off=0-200M size=200M writes=100 56 56 io disk=test async=yes max-reqs=32 mode=seq blocksize=64k off=0-200M size=200M writes=0 57 create disk=test mode=diff name=tstShared2.vhd type=dynamic backend=VHD size=20 M57 create disk=test mode=diff name=tstShared2.vhd type=dynamic backend=VHD size=200M 58 58 io disk=test async=yes max-reqs=32 mode=rnd blocksize=64k off=0-200M size=200M writes=50 59 create disk=test mode=diff name=tstShared3.vhd type=dynamic backend=VHD size=20 M59 create disk=test mode=diff name=tstShared3.vhd type=dynamic backend=VHD size=200M 60 60 io disk=test async=yes max-reqs=32 mode=rnd blocksize=64k off=0-200M size=200M writes=50 61 61 close disk=test mode=single delete=yes
Note:
See TracChangeset
for help on using the changeset viewer.