Changeset 80908 in vbox for trunk/src/VBox/ValidationKit
- Timestamp:
- Sep 19, 2019 7:45:06 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/utils/fs/FsPerf.cpp
r80585 r80908 250 250 #endif 251 251 252 #ifdef RT_OS_WINDOWS 253 /** @def CHECK_WINAPI 254 * Checks a windows API call, reporting the last error on failure. */ 255 # define CHECK_WINAPI_CALL(a_CallAndTestExpr) \ 256 if (!(a_CallAndTestExpr)) { \ 257 RTTestIFailed("line %u: %s failed - last error %u, last status %#x", \ 258 __LINE__, #a_CallAndTestExpr, GetLastError(), RTNtLastStatusValue()); \ 259 } else do {} while (0) 260 #endif 252 261 253 262 /********************************************************************************************************************************* … … 5373 5382 *(size_t volatile *)&pbCur[offFlush + 8] = cbFlush; 5374 5383 # ifdef RT_OS_WINDOWS 5375 RTTESTI_CHECK(FlushViewOfFile(pbCur, cbFlush));5384 CHECK_WINAPI_CALL(FlushViewOfFile(pbCur, cbFlush) == TRUE); 5376 5385 # else 5377 5386 RTTESTI_CHECK(msync(pbCur, cbFlush, MS_SYNC) == 0); … … 5421 5430 break; 5422 5431 dwErr2 = GetLastError(); 5423 C loseHandle(hSection);5432 CHECK_WINAPI_CALL(CloseHandle(hSection) == TRUE); 5424 5433 } 5425 5434 if (cbMapping <= _2M) … … 5479 5488 } 5480 5489 # ifdef RT_OS_WINDOWS 5481 RTTESTI_CHECK(FlushViewOfFile(pbMapping, _2M));5490 CHECK_WINAPI_CALL(FlushViewOfFile(pbMapping, _2M) == TRUE); 5482 5491 # else 5483 5492 RTTESTI_CHECK(msync(pbMapping, _2M, MS_SYNC) == 0); … … 5550 5559 fsPerfFillWriteBuf(0, pbMapping, cbMapping, 0xf6); 5551 5560 # ifdef RT_OS_WINDOWS 5552 RTTESTI_CHECK(FlushViewOfFile(pbMapping, cbMapping));5561 CHECK_WINAPI_CALL(FlushViewOfFile(pbMapping, cbMapping) == TRUE); 5553 5562 # else 5554 5563 RTTESTI_CHECK(msync(pbMapping, cbMapping, MS_SYNC) == 0); … … 5611 5620 */ 5612 5621 # ifdef RT_OS_WINDOWS 5613 RTTESTI_CHECK(UnmapViewOfFile(pbMapping));5614 RTTESTI_CHECK(CloseHandle(hSection));5622 CHECK_WINAPI_CALL(UnmapViewOfFile(pbMapping) == TRUE); 5623 CHECK_WINAPI_CALL(CloseHandle(hSection) == TRUE); 5615 5624 # else 5616 5625 RTTESTI_CHECK(munmap(pbMapping, cbMapping) == 0); … … 5659 5668 #ifdef RT_OS_WINDOWS 5660 5669 HANDLE hSection = CreateFileMapping((HANDLE)RTFileToNative(hFile2), NULL, PAGE_READWRITE, 0, cbContent, NULL); 5661 RTTESTI_CHECK_MSG(hSection != NULL, ("last error %u\n", GetLastError));5670 CHECK_WINAPI_CALL(hSection != NULL); 5662 5671 uint8_t *pbMapping = (uint8_t *)MapViewOfFile(hSection, FILE_MAP_WRITE, 0, 0, cbContent); 5663 RTTESTI_CHECK_MSG(pbMapping != NULL, ("last error %u\n", GetLastError));5664 RTTESTI_CHECK_MSG(CloseHandle(hSection), ("last error %u\n", GetLastError));5672 CHECK_WINAPI_CALL(pbMapping != NULL); 5673 CHECK_WINAPI_CALL(CloseHandle(hSection) == TRUE); 5665 5674 # else 5666 5675 uint8_t *pbMapping = (uint8_t *)mmap(NULL, cbContent, PROT_READ | PROT_WRITE, MAP_SHARED, … … 5701 5710 /* Sync it all. */ 5702 5711 # ifdef RT_OS_WINDOWS 5703 RTTESTI_CHECK(FlushViewOfFile(pbMapping, cbContent));5712 CHECK_WINAPI_CALL(FlushViewOfFile(pbMapping, cbContent) == TRUE); 5704 5713 # else 5705 5714 RTTESTI_CHECK(msync(pbMapping, cbContent, MS_SYNC) == 0); … … 5708 5717 /* Unmap it. */ 5709 5718 # ifdef RT_OS_WINDOWS 5710 RTTESTI_CHECK(UnmapViewOfFile(pbMapping));5719 CHECK_WINAPI_CALL(UnmapViewOfFile(pbMapping) == TRUE); 5711 5720 # else 5712 5721 RTTESTI_CHECK(munmap(pbMapping, cbContent) == 0);
Note:
See TracChangeset
for help on using the changeset viewer.