Changeset 77894 in vbox for trunk/src/VBox/ValidationKit/utils/fs/FsPerf.cpp
- Timestamp:
- Mar 27, 2019 1:41:45 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/utils/fs/FsPerf.cpp
r77865 r77894 2340 2340 { 2341 2341 RTTestIFailed("myFileSgReadAt failed: %Rrc - cSegs=%#x cbToRead=%#zx", rc, cSegs, cbToRead); 2342 for (uint32_t iSeg = 0; iSeg < cSegs; iSeg++) 2343 RTTestIFailureDetails("aSeg[%u] = %p LB %#zx (last %p)\n", iSeg, aSegs[iSeg].pvSeg, aSegs[iSeg].cbSeg, 2344 (uint8_t *)aSegs[iSeg].pvSeg + aSegs[iSeg].cbSeg - 1); 2342 2345 break; 2343 2346 } 2344 2347 } 2348 2349 /* reading beyond the end of the file */ 2350 for (uint32_t cSegs = 1; cSegs < 6; cSegs++) 2351 for (uint32_t iTest = 0; iTest < 128; iTest++) 2352 { 2353 uint32_t const cbToRead = RTRandU32Ex(0, cbBuf); 2354 uint32_t const cbBeyond = cbToRead ? RTRandU32Ex(0, cbToRead) : 0; 2355 uint32_t const cbSeg = cbToRead / cSegs; 2356 uint32_t cbLeft = cbToRead; 2357 uint8_t *pbCur = &pbBuf[cbToRead]; 2358 for (uint32_t iSeg = 0; iSeg < cSegs; iSeg++) 2359 { 2360 aSegs[iSeg].cbSeg = iSeg + 1 < cSegs ? cbSeg : cbLeft; 2361 aSegs[iSeg].pvSeg = pbCur -= aSegs[iSeg].cbSeg; 2362 cbLeft -= aSegs[iSeg].cbSeg; 2363 } 2364 Assert(pbCur == pbBuf); 2365 2366 uint64_t offFile = cbFile + cbBeyond - cbToRead; 2367 RTSgBufInit(&SgBuf, &aSegs[0], cSegs); 2368 int rcExpect = cbBeyond == 0 || cbToRead == 0 ? VINF_SUCCESS : VERR_EOF; 2369 int rc = myFileSgReadAt(hFile1, offFile, &SgBuf, cbToRead, NULL); 2370 if (rc != rcExpect) 2371 { 2372 RTTestIFailed("myFileSgReadAt failed: %Rrc - cSegs=%#x cbToRead=%#zx cbBeyond=%#zx\n", rc, cSegs, cbToRead, cbBeyond); 2373 for (uint32_t iSeg = 0; iSeg < cSegs; iSeg++) 2374 RTTestIFailureDetails("aSeg[%u] = %p LB %#zx (last %p)\n", iSeg, aSegs[iSeg].pvSeg, aSegs[iSeg].cbSeg, 2375 (uint8_t *)aSegs[iSeg].pvSeg + aSegs[iSeg].cbSeg - 1); 2376 } 2377 2378 RTSgBufInit(&SgBuf, &aSegs[0], cSegs); 2379 size_t cbActual = 0; 2380 rc = myFileSgReadAt(hFile1, offFile, &SgBuf, cbToRead, &cbActual); 2381 if (rc != VINF_SUCCESS || cbActual != cbToRead - cbBeyond) 2382 RTTestIFailed("myFileSgReadAt failed: %Rrc cbActual=%#zu - cSegs=%#x cbToRead=%#zx cbBeyond=%#zx expected %#zx\n", 2383 rc, cbActual, cSegs, cbToRead, cbBeyond, cbToRead - cbBeyond); 2384 if (RT_SUCCESS(rc) && cbActual > 0) 2385 for (uint32_t iSeg = 0; iSeg < cSegs; iSeg++) 2386 { 2387 if (!fsPerfCheckReadBuf(__LINE__, offFile, (uint8_t *)aSegs[iSeg].pvSeg, RT_MIN(cbActual, aSegs[iSeg].cbSeg))) 2388 { 2389 RTTestIFailureDetails("iSeg=%#x cSegs=%#x cbSeg=%#zx cbActual%#zx cbToRead=%#zx cbBeyond=%#zx\n", 2390 iSeg, cSegs, aSegs[iSeg].cbSeg, cbActual, cbToRead, cbBeyond); 2391 iTest = _16K; 2392 break; 2393 } 2394 if (cbActual <= aSegs[iSeg].cbSeg) 2395 break; 2396 cbActual -= aSegs[iSeg].cbSeg; 2397 offFile += aSegs[iSeg].cbSeg; 2398 } 2399 } 2345 2400 2346 2401 #endif
Note:
See TracChangeset
for help on using the changeset viewer.