VirtualBox

Changeset 80908 in vbox for trunk/src/VBox/ValidationKit


Ignore:
Timestamp:
Sep 19, 2019 7:45:06 PM (5 years ago)
Author:
vboxsync
Message:

FsPerf: Better error reporting on that windows flush problem. bugref:9172

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/utils/fs/FsPerf.cpp

    r80585 r80908  
    250250#endif
    251251
     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
    252261
    253262/*********************************************************************************************************************************
     
    53735382        *(size_t volatile *)&pbCur[offFlush + 8] = cbFlush;
    53745383# ifdef RT_OS_WINDOWS
    5375     RTTESTI_CHECK(FlushViewOfFile(pbCur, cbFlush));
     5384    CHECK_WINAPI_CALL(FlushViewOfFile(pbCur, cbFlush) == TRUE);
    53765385# else
    53775386    RTTESTI_CHECK(msync(pbCur, cbFlush, MS_SYNC) == 0);
     
    54215430                    break;
    54225431                dwErr2 = GetLastError();
    5423                 CloseHandle(hSection);
     5432                CHECK_WINAPI_CALL(CloseHandle(hSection) == TRUE);
    54245433            }
    54255434            if (cbMapping <= _2M)
     
    54795488                }
    54805489# ifdef RT_OS_WINDOWS
    5481                 RTTESTI_CHECK(FlushViewOfFile(pbMapping, _2M));
     5490                CHECK_WINAPI_CALL(FlushViewOfFile(pbMapping, _2M) == TRUE);
    54825491# else
    54835492                RTTESTI_CHECK(msync(pbMapping, _2M, MS_SYNC) == 0);
     
    55505559                fsPerfFillWriteBuf(0, pbMapping, cbMapping, 0xf6);
    55515560#  ifdef RT_OS_WINDOWS
    5552                 RTTESTI_CHECK(FlushViewOfFile(pbMapping, cbMapping));
     5561                CHECK_WINAPI_CALL(FlushViewOfFile(pbMapping, cbMapping) == TRUE);
    55535562#  else
    55545563                RTTESTI_CHECK(msync(pbMapping, cbMapping, MS_SYNC) == 0);
     
    56115620         */
    56125621# 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);
    56155624# else
    56165625        RTTESTI_CHECK(munmap(pbMapping, cbMapping) == 0);
     
    56595668#ifdef RT_OS_WINDOWS
    56605669            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);
    56625671            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);
    56655674# else
    56665675            uint8_t *pbMapping = (uint8_t *)mmap(NULL, cbContent, PROT_READ | PROT_WRITE, MAP_SHARED,
     
    57015710                /* Sync it all. */
    57025711#  ifdef RT_OS_WINDOWS
    5703                 RTTESTI_CHECK(FlushViewOfFile(pbMapping, cbContent));
     5712                CHECK_WINAPI_CALL(FlushViewOfFile(pbMapping, cbContent) == TRUE);
    57045713#  else
    57055714                RTTESTI_CHECK(msync(pbMapping, cbContent, MS_SYNC) == 0);
     
    57085717                /* Unmap it. */
    57095718# ifdef RT_OS_WINDOWS
    5710                 RTTESTI_CHECK(UnmapViewOfFile(pbMapping));
     5719                CHECK_WINAPI_CALL(UnmapViewOfFile(pbMapping) == TRUE);
    57115720# else
    57125721                RTTESTI_CHECK(munmap(pbMapping, cbContent) == 0);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette