Changeset 8248 in vbox for trunk/src/VBox/Devices/Storage/testcase
- Timestamp:
- Apr 21, 2008 6:03:45 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/testcase/tstVD.cpp
r8155 r8248 45 45 46 46 47 static int tstVD OpenCreateWriteMerge(const char *pszBackend,48 const char *pszBaseFilename,49 const char *pszDiffFilename)47 static int tstVDCreateDelete(const char *pszBackend, const char *pszFilename, 48 uint64_t cbSize, VDIMAGETYPE enmType, 49 unsigned uFlags, bool fDelete) 50 50 { 51 51 int rc; 52 52 PVBOXHDD pVD = NULL; 53 char *pszFormat;54 53 PDMMEDIAGEOMETRY PCHS = { 0, 0, 0 }; 55 54 PDMMEDIAGEOMETRY LCHS = { 0, 0, 0 }; … … 69 68 CHECK("VDCreate()"); 70 69 70 rc = VDCreateBase(pVD, pszBackend, pszFilename, enmType, cbSize, 71 uFlags, "Test image", &PCHS, &LCHS, VD_OPEN_FLAGS_NORMAL, 72 NULL, NULL); 73 CHECK("VDCreateBase()"); 74 75 VDDumpImages(pVD); 76 77 VDClose(pVD, fDelete); 78 #undef CHECK 79 return 0; 80 } 81 82 83 static int tstVDOpenCreateWriteMerge(const char *pszBackend, 84 const char *pszBaseFilename, 85 const char *pszDiffFilename) 86 { 87 int rc; 88 PVBOXHDD pVD = NULL; 89 char *pszFormat; 90 PDMMEDIAGEOMETRY PCHS = { 0, 0, 0 }; 91 PDMMEDIAGEOMETRY LCHS = { 0, 0, 0 }; 92 93 #define CHECK(str) \ 94 do \ 95 { \ 96 RTPrintf("%s rc=%Vrc\n", str, rc); \ 97 if (VBOX_FAILURE(rc)) \ 98 { \ 99 VDCloseAll(pVD); \ 100 return rc; \ 101 } \ 102 } while (0) 103 104 rc = VDCreate(tstVDError, NULL, &pVD); 105 CHECK("VDCreate()"); 106 71 107 RTFILE File; 72 108 rc = RTFileOpen(&File, pszBaseFilename, RTFILE_O_READ); … … 151 187 * Clean up potential leftovers from previous unsuccessful runs. 152 188 */ 189 RTFileDelete("tmpVDCreate.vdi"); 190 RTFileDelete("tmpVDCreate.vmdk"); 153 191 RTFileDelete("tmpVDBase.vdi"); 154 192 RTFileDelete("tmpVDDiff.vdi"); … … 156 194 RTFileDelete("tmpVDDiff.vmdk"); 157 195 196 rc = tstVDCreateDelete("VDI", "tmpVDCreate.vdi", 2 * _4G, 197 VD_IMAGE_TYPE_NORMAL, VD_IMAGE_FLAGS_NONE, 198 true); 199 if (VBOX_FAILURE(rc)) 200 { 201 RTPrintf("tstVD: dynamic VDI create test failed! rc=%Vrc\n", rc); 202 g_cErrors++; 203 } 204 rc = tstVDCreateDelete("VDI", "tmpVDCreate.vdi", 2 * _4G, 205 VD_IMAGE_TYPE_FIXED, VD_IMAGE_FLAGS_NONE, 206 true); 207 if (VBOX_FAILURE(rc)) 208 { 209 RTPrintf("tstVD: fixed VDI create test failed! rc=%Vrc\n", rc); 210 g_cErrors++; 211 } 212 rc = tstVDCreateDelete("VMDK", "tmpVDCreate.vmdk", 2 * _4G, 213 VD_IMAGE_TYPE_NORMAL, VD_IMAGE_FLAGS_NONE, 214 true); 215 if (VBOX_FAILURE(rc)) 216 { 217 RTPrintf("tstVD: dynamic VMDK create test failed! rc=%Vrc\n", rc); 218 g_cErrors++; 219 } 220 rc = tstVDCreateDelete("VMDK", "tmpVDCreate.vmdk", 2 * _4G, 221 VD_IMAGE_TYPE_NORMAL, VD_VMDK_IMAGE_FLAGS_SPLIT_2G, 222 true); 223 if (VBOX_FAILURE(rc)) 224 { 225 RTPrintf("tstVD: dynamic split VMDK create test failed! rc=%Vrc\n", rc); 226 g_cErrors++; 227 } 228 rc = tstVDCreateDelete("VMDK", "tmpVDCreate.vmdk", 2 * _4G, 229 VD_IMAGE_TYPE_FIXED, VD_IMAGE_FLAGS_NONE, 230 true); 231 if (VBOX_FAILURE(rc)) 232 { 233 RTPrintf("tstVD: fixed VMDK create test failed! rc=%Vrc\n", rc); 234 g_cErrors++; 235 } 236 rc = tstVDCreateDelete("VMDK", "tmpVDCreate.vmdk", 2 * _4G, 237 VD_IMAGE_TYPE_FIXED, VD_VMDK_IMAGE_FLAGS_SPLIT_2G, 238 true); 239 if (VBOX_FAILURE(rc)) 240 { 241 RTPrintf("tstVD: fixed split VMDK create test failed! rc=%Vrc\n", rc); 242 g_cErrors++; 243 } 244 158 245 rc = tstVDOpenCreateWriteMerge("VDI", "tmpVDBase.vdi", "tmpVDDiff.vdi"); 159 246 if (VBOX_FAILURE(rc)) … … 184 271 * Clean up any leftovers. 185 272 */ 273 RTFileDelete("tmpVDCreate.vdi"); 274 RTFileDelete("tmpVDCreate.vmdk"); 186 275 RTFileDelete("tmpVDBase.vdi"); 187 276 RTFileDelete("tmpVDDiff.vdi");
Note:
See TracChangeset
for help on using the changeset viewer.