VirtualBox

Changeset 86490 in vbox for trunk/src


Ignore:
Timestamp:
Oct 8, 2020 9:32:43 AM (4 years ago)
Author:
vboxsync
Message:

tstSharedFolderService: gcc 10 build fix. bugref:9746

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/SharedFolders/testcase/tstSharedFolderService.cpp

    r82968 r86490  
    118118#define LLUIFY(a) ((unsigned long long)(a))
    119119
    120 static void bufferFromString(void *pvDest, size_t cb, const char *pcszSrc)
    121 {
    122     char *pchDest = (char *)pvDest;
    123 
    124     Assert((cb) > 0);
    125     strncpy((pchDest), (pcszSrc), (cb) - 1);
    126     (pchDest)[(cb) - 1] = 0;
    127 }
    128 
    129 static void bufferFromPath(void *pvDest, size_t cb, const char *pcszSrc)
    130 {
    131     char *psz;
    132 
    133     bufferFromString(pvDest, cb, pcszSrc);
    134     for (psz = (char *)pvDest; psz && psz < (char *)pvDest + cb; ++psz)
     120static void bufferFromPath(char *pszDst, size_t cbDst, const char *pcszSrc)
     121{
     122    RTStrCopy(pszDst, cbDst, pcszSrc);
     123    uintptr_t const uDstEnd = (uintptr_t)&pszDst[cbDst];
     124    for (char *psz = pszDst; psz && (uintptr_t)psz < uDstEnd; ++psz)
    135125        if (*psz == '\\')
    136126            *psz = '/';
     
    139129#define ARRAY_FROM_PATH(a, b) \
    140130    do { \
    141         void *p=(a); NOREF(p); \
     131        char *p = (a); NOREF(p); \
    142132        Assert((a) == p); /* Constant parameter */ \
    143133        Assert(sizeof((a)) > 0); \
     
    160150}
    161151
    162 static char testRTDirCreatePath[256];
     152static char g_testRTDirCreate_szPath[256];
    163153//static RTFMODE testRTDirCreateMode; - unused
    164154
     
    170160    if (g_fFailIfNotLowercase && !RTStrIsLowerCased(strpbrk(pszPath, "/\\")))
    171161        return VERR_FILE_NOT_FOUND;
    172     ARRAY_FROM_PATH(testRTDirCreatePath, pszPath);
     162    ARRAY_FROM_PATH(g_testRTDirCreate_szPath, pszPath);
    173163    return 0;
    174164}
    175165
    176 static char testRTDirOpenName[256];
     166static char g_testRTDirOpen_szName[256];
    177167static struct TESTDIRHANDLE
    178168{
     
    181171} g_aTestDirHandles[4];
    182172static int g_iNextDirHandle = 0;
    183 static RTDIR testRTDirOpen_hDir;
     173static RTDIR g_testRTDirOpen_hDir;
    184174
    185175extern int testRTDirOpen(RTDIR *phDir, const char *pszPath)
     
    188178    if (g_fFailIfNotLowercase && !RTStrIsLowerCased(strpbrk(pszPath, "/\\")))
    189179        return VERR_FILE_NOT_FOUND;
    190     ARRAY_FROM_PATH(testRTDirOpenName, pszPath);
    191     *phDir = testRTDirOpen_hDir;
    192     testRTDirOpen_hDir = NIL_RTDIR;
     180    ARRAY_FROM_PATH(g_testRTDirOpen_szName, pszPath);
     181    *phDir = g_testRTDirOpen_hDir;
     182    g_testRTDirOpen_hDir = NIL_RTDIR;
    193183    if (!*phDir && g_fFailIfNotLowercase)
    194184        *phDir = (RTDIR)&g_aTestDirHandles[g_iNextDirHandle++ % RT_ELEMENTS(g_aTestDirHandles)];
     
    212202    if (g_fFailIfNotLowercase && !RTStrIsLowerCased(strpbrk(pszPath, "/\\")))
    213203        return VERR_FILE_NOT_FOUND;
    214     ARRAY_FROM_PATH(testRTDirOpenName, pszPath);
    215     *phDir = testRTDirOpen_hDir;
    216     testRTDirOpen_hDir = NIL_RTDIR;
     204    ARRAY_FROM_PATH(g_testRTDirOpen_szName, pszPath);
     205    *phDir = g_testRTDirOpen_hDir;
     206    g_testRTDirOpen_hDir = NIL_RTDIR;
    217207    if (!*phDir && g_fFailIfNotLowercase)
    218208        *phDir = (RTDIR)&g_aTestDirHandles[g_iNextDirHandle++ % RT_ELEMENTS(g_aTestDirHandles)];
     
    232222
    233223static RTDIR g_testRTDirQueryInfo_hDir;
    234 static RTTIMESPEC testRTDirQueryInfoATime;
     224static RTTIMESPEC g_testRTDirQueryInfo_ATime;
    235225
    236226extern int testRTDirQueryInfo(RTDIR hDir, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAdditionalAttribs)
     
    241231    g_testRTDirQueryInfo_hDir = hDir;
    242232    RT_ZERO(*pObjInfo);
    243     pObjInfo->AccessTime = testRTDirQueryInfoATime;
    244     RT_ZERO(testRTDirQueryInfoATime);
     233    pObjInfo->AccessTime = g_testRTDirQueryInfo_ATime;
     234    RT_ZERO(g_testRTDirQueryInfo_ATime);
    245235    return VINF_SUCCESS;
    246236}
     
    302292}
    303293
    304 static uint64_t testRTDirSetFMode;
     294static uint64_t g_testRTDirSetMode_fMode;
    305295
    306296extern int testRTDirSetMode(RTDIR hDir, RTFMODE fMode)
     
    308298    RT_NOREF1(hDir);
    309299 /* RTPrintf("%s: fMode=%llu\n", __PRETTY_FUNCTION__, LLUIFY(fMode)); */
    310     testRTDirSetFMode = fMode;
    311     return VINF_SUCCESS;
    312 }
    313 
    314 static RTTIMESPEC testRTDirSetTimesATime;
     300    g_testRTDirSetMode_fMode = fMode;
     301    return VINF_SUCCESS;
     302}
     303
     304static RTTIMESPEC g_testRTDirSetTimes_ATime;
    315305
    316306extern int testRTDirSetTimes(RTDIR hDir, PCRTTIMESPEC pAccessTime, PCRTTIMESPEC pModificationTime,
     
    326316             pBirthTime ? (long long)RTTimeSpecGetNano(pBirthTime) : -1); */
    327317    if (pAccessTime)
    328         testRTDirSetTimesATime = *pAccessTime;
     318        g_testRTDirSetTimes_ATime = *pAccessTime;
    329319    else
    330         RT_ZERO(testRTDirSetTimesATime);
    331     return VINF_SUCCESS;
    332 }
    333 
    334 static RTFILE g_testRTFileCloseFile;
     320        RT_ZERO(g_testRTDirSetTimes_ATime);
     321    return VINF_SUCCESS;
     322}
     323
     324static RTFILE g_testRTFileClose_hFile;
    335325
    336326extern int  testRTFileClose(RTFILE File)
    337327{
    338328 /* RTPrintf("%s: File=%p\n", __PRETTY_FUNCTION__, File); */
    339     g_testRTFileCloseFile = File;
     329    g_testRTFileClose_hFile = File;
    340330    return 0;
    341331}
     
    349339}
    350340
    351 static RTFILE g_testRTFileFlushFile;
     341static RTFILE g_testRTFileFlush_hFile;
    352342
    353343extern int  testRTFileFlush(RTFILE File)
    354344{
    355345 /* RTPrintf("%s: File=%p\n", __PRETTY_FUNCTION__, File); */
    356     g_testRTFileFlushFile = File;
    357     return VINF_SUCCESS;
    358 }
    359 
    360 static RTFILE g_testRTFileLockFile;
    361 static unsigned testRTFileLockfLock;
    362 static int64_t testRTFileLockOffset;
    363 static uint64_t testRTFileLockSize;
     346    g_testRTFileFlush_hFile = File;
     347    return VINF_SUCCESS;
     348}
     349
     350static RTFILE g_testRTFileLock_hFile;
     351static unsigned g_testRTFileLock_fLock;
     352static int64_t g_testRTFileLock_offLock;
     353static uint64_t g_testRTFileLock_cbLock;
    364354
    365355extern int  testRTFileLock(RTFILE hFile, unsigned fLock, int64_t offLock, uint64_t cbLock)
     
    368358             __PRETTY_FUNCTION__, hFile, fLock, (long long) offLock,
    369359             LLUIFY(cbLock)); */
    370     g_testRTFileLockFile = hFile;
    371     testRTFileLockfLock = fLock;
    372     testRTFileLockOffset = offLock;
    373     testRTFileLockSize = cbLock;
    374     return VINF_SUCCESS;
    375 }
    376 
    377 static char testRTFileOpenName[256];
    378 static uint64_t testRTFileOpenFlags;
    379 static RTFILE testRTFileOpenpFile;
     360    g_testRTFileLock_hFile = hFile;
     361    g_testRTFileLock_fLock = fLock;
     362    g_testRTFileLock_offLock = offLock;
     363    g_testRTFileLock_cbLock = cbLock;
     364    return VINF_SUCCESS;
     365}
     366
     367static char g_testRTFileOpen_szName[256];
     368static uint64_t g_testRTFileOpen_fOpen;
     369static RTFILE g_testRTFileOpen_hFile;
    380370
    381371extern int  testRTFileOpenEx(const char *pszFilename, uint64_t fOpen, PRTFILE phFile, PRTFILEACTION penmActionTaken)
     
    383373 /* RTPrintf("%s, pszFilename=%s, fOpen=0x%llx\n", __PRETTY_FUNCTION__,
    384374             pszFilename, LLUIFY(fOpen)); */
    385     ARRAY_FROM_PATH(testRTFileOpenName, pszFilename);
    386     testRTFileOpenFlags = fOpen;
     375    ARRAY_FROM_PATH(g_testRTFileOpen_szName, pszFilename);
     376    g_testRTFileOpen_fOpen = fOpen;
    387377    if (g_fFailIfNotLowercase && !RTStrIsLowerCased(strpbrk(pszFilename, "/\\")))
    388378        return VERR_FILE_NOT_FOUND;
    389     *phFile = testRTFileOpenpFile;
     379    *phFile = g_testRTFileOpen_hFile;
    390380    *penmActionTaken = RTFILEACTION_CREATED;
    391     testRTFileOpenpFile = 0;
    392     return VINF_SUCCESS;
    393 }
    394 
    395 static RTFILE g_testRTFileQueryInfoFile;
    396 static RTTIMESPEC testRTFileQueryInfoATime;
    397 static uint32_t testRTFileQueryInfoFMode;
     381    g_testRTFileOpen_hFile = 0;
     382    return VINF_SUCCESS;
     383}
     384
     385static RTFILE g_testRTFileQueryInfo_hFile;
     386static RTTIMESPEC g_testRTFileQueryInfo_ATime;
     387static uint32_t g_testRTFileQueryInfo_fMode;
    398388
    399389extern int  testRTFileQueryInfo(RTFILE hFile, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAdditionalAttribs)
     
    402392 /* RTPrintf("%s, hFile=%p, enmAdditionalAttribs=0x%llx\n",
    403393             __PRETTY_FUNCTION__, hFile, LLUIFY(enmAdditionalAttribs)); */
    404     g_testRTFileQueryInfoFile = hFile;
     394    g_testRTFileQueryInfo_hFile = hFile;
    405395    RT_ZERO(*pObjInfo);
    406     pObjInfo->AccessTime = testRTFileQueryInfoATime;
    407     RT_ZERO(testRTDirQueryInfoATime);
    408     pObjInfo->Attr.fMode = testRTFileQueryInfoFMode;
    409     testRTFileQueryInfoFMode = 0;
    410     return VINF_SUCCESS;
    411 }
    412 
    413 static const char *testRTFileReadData;
     396    pObjInfo->AccessTime = g_testRTFileQueryInfo_ATime;
     397    RT_ZERO(g_testRTDirQueryInfo_ATime);
     398    pObjInfo->Attr.fMode = g_testRTFileQueryInfo_fMode;
     399    g_testRTFileQueryInfo_fMode = 0;
     400    return VINF_SUCCESS;
     401}
     402
     403static const char *g_testRTFileRead_pszData;
    414404
    415405extern int  testRTFileRead(RTFILE File, void *pvBuf, size_t cbToRead, size_t *pcbRead)
     
    418408 /* RTPrintf("%s : File=%p, cbToRead=%llu\n", __PRETTY_FUNCTION__, File,
    419409             LLUIFY(cbToRead)); */
    420     bufferFromPath(pvBuf, cbToRead, testRTFileReadData);
     410    bufferFromPath((char *)pvBuf, cbToRead, g_testRTFileRead_pszData);
    421411    if (pcbRead)
    422         *pcbRead = RT_MIN(cbToRead, strlen(testRTFileReadData) + 1);
    423     testRTFileReadData = 0;
     412        *pcbRead = RT_MIN(cbToRead, strlen(g_testRTFileRead_pszData) + 1);
     413    g_testRTFileRead_pszData = 0;
    424414    return VINF_SUCCESS;
    425415}
     
    431421 /* RTPrintf("%s : File=%p, cbToRead=%llu\n", __PRETTY_FUNCTION__, File,
    432422             LLUIFY(cbToRead)); */
    433     bufferFromPath(pvBuf, cbToRead, testRTFileReadData);
     423    bufferFromPath((char *)pvBuf, cbToRead, g_testRTFileRead_pszData);
    434424    if (pcbRead)
    435         *pcbRead = RT_MIN(cbToRead, strlen(testRTFileReadData) + 1);
    436     testRTFileReadData = 0;
     425        *pcbRead = RT_MIN(cbToRead, strlen(g_testRTFileRead_pszData) + 1);
     426    g_testRTFileRead_pszData = 0;
    437427    return VINF_SUCCESS;
    438428}
     
    448438}
    449439
    450 static uint64_t testRTFileSetFMode;
     440static uint64_t g_testRTFileSet_fMode;
    451441
    452442extern int testRTFileSetMode(RTFILE File, RTFMODE fMode)
     
    454444    RT_NOREF1(File);
    455445 /* RTPrintf("%s: fMode=%llu\n", __PRETTY_FUNCTION__, LLUIFY(fMode)); */
    456     testRTFileSetFMode = fMode;
    457     return VINF_SUCCESS;
    458 }
    459 
    460 static RTFILE g_testRTFileSetSizeFile;
    461 static RTFOFF testRTFileSetSizeSize;
     446    g_testRTFileSet_fMode = fMode;
     447    return VINF_SUCCESS;
     448}
     449
     450static RTFILE g_testRTFileSetSize_hFile;
     451static RTFOFF g_testRTFileSetSize_cbSize;
    462452
    463453extern int  testRTFileSetSize(RTFILE File, uint64_t cbSize)
     
    465455 /* RTPrintf("%s: File=%llu, cbSize=%llu\n", __PRETTY_FUNCTION__, LLUIFY(File),
    466456             LLUIFY(cbSize)); */
    467     g_testRTFileSetSizeFile = File;
    468     testRTFileSetSizeSize = (RTFOFF) cbSize; /* Why was this signed before? */
    469     return VINF_SUCCESS;
    470 }
    471 
    472 static RTTIMESPEC testRTFileSetTimesATime;
     457    g_testRTFileSetSize_hFile = File;
     458    g_testRTFileSetSize_cbSize = (RTFOFF) cbSize; /* Why was this signed before? */
     459    return VINF_SUCCESS;
     460}
     461
     462static RTTIMESPEC g_testRTFileSetTimes_ATime;
    473463
    474464extern int testRTFileSetTimes(RTFILE File, PCRTTIMESPEC pAccessTime, PCRTTIMESPEC pModificationTime,
     
    484474             pBirthTime ? (long long)RTTimeSpecGetNano(pBirthTime) : -1); */
    485475    if (pAccessTime)
    486         testRTFileSetTimesATime = *pAccessTime;
     476        g_testRTFileSetTimes_ATime = *pAccessTime;
    487477    else
    488         RT_ZERO(testRTFileSetTimesATime);
    489     return VINF_SUCCESS;
    490 }
    491 
    492 static RTFILE g_testRTFileUnlockFile;
    493 static int64_t testRTFileUnlockOffset;
    494 static uint64_t testRTFileUnlockSize;
     478        RT_ZERO(g_testRTFileSetTimes_ATime);
     479    return VINF_SUCCESS;
     480}
     481
     482static RTFILE g_testRTFileUnlock_hFile;
     483static int64_t g_testRTFileUnlock_offLock;
     484static uint64_t g_testRTFileUnlock_cbLock;
    495485
    496486extern int  testRTFileUnlock(RTFILE File, int64_t offLock, uint64_t cbLock)
     
    498488 /* RTPrintf("%s: hFile=%p, ofLock=%lli, cbLock=%llu\n", __PRETTY_FUNCTION__,
    499489             File, (long long) offLock, LLUIFY(cbLock)); */
    500     g_testRTFileUnlockFile = File;
    501     testRTFileUnlockOffset = offLock;
    502     testRTFileUnlockSize = cbLock;
    503     return VINF_SUCCESS;
    504 }
    505 
    506 static char testRTFileWriteData[256];
     490    g_testRTFileUnlock_hFile = File;
     491    g_testRTFileUnlock_offLock = offLock;
     492    g_testRTFileUnlock_cbLock = cbLock;
     493    return VINF_SUCCESS;
     494}
     495
     496static char g_testRTFileWrite_szData[256];
    507497
    508498extern int  testRTFileWrite(RTFILE File, const void *pvBuf, size_t cbToWrite, size_t *pcbWritten)
     
    511501 /* RTPrintf("%s: File=%p, pvBuf=%.*s, cbToWrite=%llu\n", __PRETTY_FUNCTION__,
    512502             File, cbToWrite, (const char *)pvBuf, LLUIFY(cbToWrite)); */
    513     ARRAY_FROM_PATH(testRTFileWriteData, (const char *)pvBuf);
     503    ARRAY_FROM_PATH(g_testRTFileWrite_szData, (const char *)pvBuf);
    514504    if (pcbWritten)
    515         *pcbWritten = strlen(testRTFileWriteData) + 1;
     505        *pcbWritten = strlen(g_testRTFileWrite_szData) + 1;
    516506    return VINF_SUCCESS;
    517507}
     
    522512 /* RTPrintf("%s: File=%p, pvBuf=%.*s, cbToWrite=%llu\n", __PRETTY_FUNCTION__,
    523513             File, cbToWrite, (const char *)pvBuf, LLUIFY(cbToWrite)); */
    524     ARRAY_FROM_PATH(testRTFileWriteData, (const char *)pvBuf);
     514    ARRAY_FROM_PATH(g_testRTFileWrite_szData, (const char *)pvBuf);
    525515    if (pcbWritten)
    526         *pcbWritten = strlen(testRTFileWriteData) + 1;
     516        *pcbWritten = strlen(g_testRTFileWrite_szData) + 1;
    527517    return VINF_SUCCESS;
    528518}
     
    903893    Root = initWithWritableMapping(hTest, &svcTable, &svcHelpers,
    904894                                   "/test/mapping", "testname");
    905     testRTFileOpenpFile = hFile;
     895    g_testRTFileOpen_hFile = hFile;
    906896    rc = createFile(&svcTable, Root, "/test/file", SHFL_CF_ACCESS_READ, NULL,
    907897                    &Result);
    908898    RTTEST_CHECK_RC_OK(hTest, rc);
    909899    RTTEST_CHECK_MSG(hTest,
    910                      !strcmp(&testRTFileOpenName[RTPATH_STYLE == RTPATH_STR_F_STYLE_DOS ? 2 : 0],
     900                     !strcmp(&g_testRTFileOpen_szName[RTPATH_STYLE == RTPATH_STR_F_STYLE_DOS ? 2 : 0],
    911901                             "/test/mapping/test/file"),
    912                      (hTest, "pszFilename=%s\n", &testRTFileOpenName[RTPATH_STYLE == RTPATH_STR_F_STYLE_DOS ? 2 : 0]));
    913     RTTEST_CHECK_MSG(hTest, testRTFileOpenFlags == 0x181,
    914                      (hTest, "fOpen=%llu\n", LLUIFY(testRTFileOpenFlags)));
     902                     (hTest, "pszFilename=%s\n", &g_testRTFileOpen_szName[RTPATH_STYLE == RTPATH_STR_F_STYLE_DOS ? 2 : 0]));
     903    RTTEST_CHECK_MSG(hTest, g_testRTFileOpen_fOpen == 0x181,
     904                     (hTest, "fOpen=%llu\n", LLUIFY(g_testRTFileOpen_fOpen)));
    915905    RTTEST_CHECK_MSG(hTest, Result == SHFL_FILE_CREATED,
    916906                     (hTest, "Result=%d\n", (int) Result));
     
    919909    AssertReleaseRC(svcTable.pfnUnload(NULL));
    920910    RTTestGuardedFree(hTest, svcTable.pvService);
    921     RTTEST_CHECK_MSG(hTest, g_testRTFileCloseFile == hFile,
    922                      (hTest, "File=%u\n", (uintptr_t)g_testRTFileCloseFile));
     911    RTTEST_CHECK_MSG(hTest, g_testRTFileClose_hFile == hFile,
     912                     (hTest, "File=%u\n", (uintptr_t)g_testRTFileClose_hFile));
    923913}
    924914
     
    937927    Root = initWithWritableMapping(hTest, &svcTable, &svcHelpers,
    938928                                   "/test/mapping", "testname", false /*fCaseSensitive*/);
    939     testRTFileOpenpFile = hFile;
     929    g_testRTFileOpen_hFile = hFile;
    940930    rc = createFile(&svcTable, Root, "/TesT/FilE", SHFL_CF_ACCESS_READ, NULL,
    941931                    &Result);
     
    943933
    944934    RTTEST_CHECK_MSG(hTest,
    945                      !strcmp(&testRTFileOpenName[RTPATH_STYLE == RTPATH_STR_F_STYLE_DOS ? 2 : 0],
     935                     !strcmp(&g_testRTFileOpen_szName[RTPATH_STYLE == RTPATH_STR_F_STYLE_DOS ? 2 : 0],
    946936                             "/test/mapping/test/file"),
    947                      (hTest, "pszFilename=%s\n", &testRTFileOpenName[RTPATH_STYLE == RTPATH_STR_F_STYLE_DOS ? 2 : 0]));
    948     RTTEST_CHECK_MSG(hTest, testRTFileOpenFlags == 0x181,
    949                      (hTest, "fOpen=%llu\n", LLUIFY(testRTFileOpenFlags)));
     937                     (hTest, "pszFilename=%s\n", &g_testRTFileOpen_szName[RTPATH_STYLE == RTPATH_STR_F_STYLE_DOS ? 2 : 0]));
     938    RTTEST_CHECK_MSG(hTest, g_testRTFileOpen_fOpen == 0x181,
     939                     (hTest, "fOpen=%llu\n", LLUIFY(g_testRTFileOpen_fOpen)));
    950940    RTTEST_CHECK_MSG(hTest, Result == SHFL_FILE_CREATED,
    951941                     (hTest, "Result=%d\n", (int) Result));
     
    954944    AssertReleaseRC(svcTable.pfnUnload(NULL));
    955945    RTTestGuardedFree(hTest, svcTable.pvService);
    956     RTTEST_CHECK_MSG(hTest, g_testRTFileCloseFile == hFile,
    957                      (hTest, "File=%u\n", (uintptr_t)g_testRTFileCloseFile));
     946    RTTEST_CHECK_MSG(hTest, g_testRTFileClose_hFile == hFile,
     947                     (hTest, "File=%u\n", (uintptr_t)g_testRTFileClose_hFile));
    958948
    959949    g_fFailIfNotLowercase = false;
     
    972962    Root = initWithWritableMapping(hTest, &svcTable, &svcHelpers,
    973963                                   "/test/mapping", "testname");
    974     testRTDirOpen_hDir = hDir;
     964    g_testRTDirOpen_hDir = hDir;
    975965    rc = createFile(&svcTable, Root, "test/dir",
    976966                    SHFL_CF_DIRECTORY | SHFL_CF_ACCESS_READ, NULL, &Result);
    977967    RTTEST_CHECK_RC_OK(hTest, rc);
    978968    RTTEST_CHECK_MSG(hTest,
    979                      !strcmp(&testRTDirCreatePath[RTPATH_STYLE == RTPATH_STR_F_STYLE_DOS ? 2 : 0],
     969                     !strcmp(&g_testRTDirCreate_szPath[RTPATH_STYLE == RTPATH_STR_F_STYLE_DOS ? 2 : 0],
    980970                             "/test/mapping/test/dir"),
    981                      (hTest, "pszPath=%s\n", &testRTDirCreatePath[RTPATH_STYLE == RTPATH_STR_F_STYLE_DOS ? 2 : 0]));
     971                     (hTest, "pszPath=%s\n", &g_testRTDirCreate_szPath[RTPATH_STYLE == RTPATH_STR_F_STYLE_DOS ? 2 : 0]));
    982972    RTTEST_CHECK_MSG(hTest,
    983                      !strcmp(&testRTDirOpenName[RTPATH_STYLE == RTPATH_STR_F_STYLE_DOS ? 2 : 0],
     973                     !strcmp(&g_testRTDirOpen_szName[RTPATH_STYLE == RTPATH_STR_F_STYLE_DOS ? 2 : 0],
    984974                             "/test/mapping/test/dir"),
    985                      (hTest, "pszFilename=%s\n", &testRTDirOpenName[RTPATH_STYLE == RTPATH_STR_F_STYLE_DOS ? 2 : 0]));
     975                     (hTest, "pszFilename=%s\n", &g_testRTDirOpen_szName[RTPATH_STYLE == RTPATH_STR_F_STYLE_DOS ? 2 : 0]));
    986976    RTTEST_CHECK_MSG(hTest, Result == SHFL_FILE_CREATED,
    987977                     (hTest, "Result=%d\n", (int) Result));
     
    1008998    Root = initWithWritableMapping(hTest, &svcTable, &svcHelpers,
    1009999                                   "/test/mapping", "testname");
    1010     testRTFileOpenpFile = hFile;
     1000    g_testRTFileOpen_hFile = hFile;
    10111001    rc = createFile(&svcTable, Root, "/test/file", SHFL_CF_ACCESS_READ,
    10121002                    &Handle, NULL);
    10131003    RTTEST_CHECK_RC_OK(hTest, rc);
    1014     testRTFileReadData = pcszReadData;
     1004    g_testRTFileRead_pszData = pcszReadData;
    10151005    memset(achBuf, 'f', sizeof(achBuf));
    10161006    rc = readFile(&svcTable, Root, Handle, 0, (uint32_t)strlen(pcszReadData) + 1,
     
    10231013                     (hTest, "cbRead=%llu\n", LLUIFY(cbRead)));
    10241014    unmapAndRemoveMapping(hTest, &svcTable, Root, "testname");
    1025     RTTEST_CHECK_MSG(hTest, g_testRTFileCloseFile == hFile, (hTest, "File=%u\n", g_testRTFileCloseFile));
     1015    RTTEST_CHECK_MSG(hTest, g_testRTFileClose_hFile == hFile, (hTest, "File=%u\n", g_testRTFileClose_hFile));
    10261016    AssertReleaseRC(svcTable.pfnDisconnect(NULL, 0, svcTable.pvService));
    10271017    AssertReleaseRC(svcTable.pfnUnload(NULL));
     
    10441034    Root = initWithWritableMapping(hTest, &svcTable, &svcHelpers,
    10451035                                   "/test/mapping", "testname");
    1046     testRTFileOpenpFile = hFile;
     1036    g_testRTFileOpen_hFile = hFile;
    10471037    rc = createFile(&svcTable, Root, "/test/file", SHFL_CF_ACCESS_READ,
    10481038                    &Handle, NULL);
     
    10521042    RTTEST_CHECK_RC_OK(hTest, rc);
    10531043    RTTEST_CHECK_MSG(hTest,
    1054                      !strcmp(testRTFileWriteData, pcszWrittenData),
    1055                      (hTest, "pvBuf=%s\n", testRTFileWriteData));
     1044                     !strcmp(g_testRTFileWrite_szData, pcszWrittenData),
     1045                     (hTest, "pvBuf=%s\n", g_testRTFileWrite_szData));
    10561046    RTTEST_CHECK_MSG(hTest, cbWritten == cbToWrite,
    10571047                     (hTest, "cbWritten=%llu\n", LLUIFY(cbWritten)));
    10581048    unmapAndRemoveMapping(hTest, &svcTable, Root, "testname");
    1059     RTTEST_CHECK_MSG(hTest, g_testRTFileCloseFile == hFile, (hTest, "File=%u\n", g_testRTFileCloseFile));
     1049    RTTEST_CHECK_MSG(hTest, g_testRTFileClose_hFile == hFile, (hTest, "File=%u\n", g_testRTFileClose_hFile));
    10601050    AssertReleaseRC(svcTable.pfnDisconnect(NULL, 0, svcTable.pvService));
    10611051    AssertReleaseRC(svcTable.pfnUnload(NULL));
     
    10751065    Root = initWithWritableMapping(hTest, &svcTable, &svcHelpers,
    10761066                                   "/test/mapping", "testname");
    1077     testRTFileOpenpFile = hFile;
     1067    g_testRTFileOpen_hFile = hFile;
    10781068    rc = createFile(&svcTable, Root, "/test/file", SHFL_CF_ACCESS_READ,
    10791069                    &Handle, NULL);
     
    10811071    rc = flushFile(&svcTable, Root, Handle);
    10821072    RTTEST_CHECK_RC_OK(hTest, rc);
    1083     RTTEST_CHECK_MSG(hTest, g_testRTFileFlushFile == hFile, (hTest, "File=%u\n", g_testRTFileFlushFile));
     1073    RTTEST_CHECK_MSG(hTest, g_testRTFileFlush_hFile == hFile, (hTest, "File=%u\n", g_testRTFileFlush_hFile));
    10841074    unmapAndRemoveMapping(hTest, &svcTable, Root, "testname");
    10851075    AssertReleaseRC(svcTable.pfnDisconnect(NULL, 0, svcTable.pvService));
    10861076    AssertReleaseRC(svcTable.pfnUnload(NULL));
    10871077    RTTestGuardedFree(hTest, svcTable.pvService);
    1088     RTTEST_CHECK_MSG(hTest, g_testRTFileCloseFile == hFile, (hTest, "File=%u\n", g_testRTFileCloseFile));
     1078    RTTEST_CHECK_MSG(hTest, g_testRTFileClose_hFile == hFile, (hTest, "File=%u\n", g_testRTFileClose_hFile));
    10891079}
    10901080
     
    11071097    Root = initWithWritableMapping(hTest, &svcTable, &svcHelpers,
    11081098                                   "/test/mapping", "testname");
    1109     testRTDirOpen_hDir = hDir;
     1099    g_testRTDirOpen_hDir = hDir;
    11101100    rc = createFile(&svcTable, Root, "test/dir",
    11111101                    SHFL_CF_DIRECTORY | SHFL_CF_ACCESS_READ, &Handle, NULL);
     
    11371127                                   "/test/mapping", "testname");
    11381128    SHFLHANDLE Handle = SHFL_HANDLE_NIL;
    1139     testRTFileOpenpFile = hFile;
     1129    g_testRTFileOpen_hFile = hFile;
    11401130    rc = createFile(&svcTable, Root, "/test/file", SHFL_CF_ACCESS_READ,
    11411131                    &Handle, NULL);
     
    11431133
    11441134    RT_ZERO(Info);
    1145     testRTFileQueryInfoFMode = fMode;
     1135    g_testRTFileQueryInfo_fMode = fMode;
    11461136    rc = sfInformation(&svcTable, Root, Handle, SHFL_INFO_FILE, sizeof(Info),
    11471137                       &Info);
    11481138    RTTEST_CHECK_RC_OK(hTest, rc);
    1149     RTTEST_CHECK_MSG(hTest, g_testRTFileQueryInfoFile == hFile, (hTest, "File=%u\n", g_testRTFileQueryInfoFile));
     1139    RTTEST_CHECK_MSG(hTest, g_testRTFileQueryInfo_hFile == hFile, (hTest, "File=%u\n", g_testRTFileQueryInfo_hFile));
    11501140    RTTEST_CHECK_MSG(hTest, Info.Attr.fMode == fMode,
    11511141                     (hTest, "cbObject=%llu\n", LLUIFY(Info.cbObject)));
     
    11551145                       sizeof(Info), &Info);
    11561146    RTTEST_CHECK_RC_OK(hTest, rc);
    1157     RTTEST_CHECK_MSG(hTest, testRTFileSetFMode == fMode,
    1158                      (hTest, "Size=%llu\n", LLUIFY(testRTFileSetFMode)));
     1147    RTTEST_CHECK_MSG(hTest, g_testRTFileSet_fMode == fMode,
     1148                     (hTest, "Size=%llu\n", LLUIFY(g_testRTFileSet_fMode)));
    11591149    unmapAndRemoveMapping(hTest, &svcTable, Root, "testname");
    11601150    AssertReleaseRC(svcTable.pfnDisconnect(NULL, 0, svcTable.pvService));
    11611151    AssertReleaseRC(svcTable.pfnUnload(NULL));
    11621152    RTTestGuardedFree(hTest, svcTable.pvService);
    1163     RTTEST_CHECK_MSG(hTest, g_testRTFileCloseFile == hFile, (hTest, "File=%u\n", g_testRTFileCloseFile));
     1153    RTTEST_CHECK_MSG(hTest, g_testRTFileClose_hFile == hFile, (hTest, "File=%u\n", g_testRTFileClose_hFile));
    11641154}
    11651155
     
    11781168    Root = initWithWritableMapping(hTest, &svcTable, &svcHelpers,
    11791169                                   "/test/mapping", "testname");
    1180     testRTDirOpen_hDir = hDir;
     1170    g_testRTDirOpen_hDir = hDir;
    11811171    rc = createFile(&svcTable, Root, "test/dir",
    11821172                    SHFL_CF_DIRECTORY | SHFL_CF_ACCESS_READ, &Handle, NULL);
    11831173    RTTEST_CHECK_RC_OK(hTest, rc);
    11841174    RT_ZERO(Info);
    1185     RTTimeSpecSetNano(&testRTDirQueryInfoATime, ccAtimeNano);
     1175    RTTimeSpecSetNano(&g_testRTDirQueryInfo_ATime, ccAtimeNano);
    11861176    rc = sfInformation(&svcTable, Root, Handle, SHFL_INFO_FILE, sizeof(Info),
    11871177                       &Info);
     
    11961186                       sizeof(Info), &Info);
    11971187    RTTEST_CHECK_RC_OK(hTest, rc);
    1198     RTTEST_CHECK_MSG(hTest,    RTTimeSpecGetNano(&testRTDirSetTimesATime)
     1188    RTTEST_CHECK_MSG(hTest,    RTTimeSpecGetNano(&g_testRTDirSetTimes_ATime)
    11991189                            == ccAtimeNano,
    12001190                     (hTest, "ATime=%llu\n",
    1201                       LLUIFY(RTTimeSpecGetNano(&testRTDirSetTimesATime))));
     1191                      LLUIFY(RTTimeSpecGetNano(&g_testRTDirSetTimes_ATime))));
    12021192    unmapAndRemoveMapping(hTest, &svcTable, Root, "testname");
    12031193    AssertReleaseRC(svcTable.pfnDisconnect(NULL, 0, svcTable.pvService));
     
    12211211    Root = initWithWritableMapping(hTest, &svcTable, &svcHelpers,
    12221212                                   "/test/mapping", "testname");
    1223     testRTFileOpenpFile = hFile;
     1213    g_testRTFileOpen_hFile = hFile;
    12241214    rc = createFile(&svcTable, Root, "/test/file", SHFL_CF_ACCESS_READ,
    12251215                    &Handle, NULL);
    12261216    RTTEST_CHECK_RC_OK(hTest, rc);
    12271217    RT_ZERO(Info);
    1228     RTTimeSpecSetNano(&testRTFileQueryInfoATime, ccAtimeNano);
     1218    RTTimeSpecSetNano(&g_testRTFileQueryInfo_ATime, ccAtimeNano);
    12291219    rc = sfInformation(&svcTable, Root, Handle, SHFL_INFO_FILE, sizeof(Info),
    12301220                       &Info);
    12311221    RTTEST_CHECK_RC_OK(hTest, rc);
    1232     RTTEST_CHECK_MSG(hTest, g_testRTFileQueryInfoFile == hFile, (hTest, "File=%u\n", g_testRTFileQueryInfoFile));
     1222    RTTEST_CHECK_MSG(hTest, g_testRTFileQueryInfo_hFile == hFile, (hTest, "File=%u\n", g_testRTFileQueryInfo_hFile));
    12331223    RTTEST_CHECK_MSG(hTest, RTTimeSpecGetNano(&Info.AccessTime) == ccAtimeNano,
    12341224                     (hTest, "ATime=%llu\n",
     
    12391229                       sizeof(Info), &Info);
    12401230    RTTEST_CHECK_RC_OK(hTest, rc);
    1241     RTTEST_CHECK_MSG(hTest,    RTTimeSpecGetNano(&testRTFileSetTimesATime)
     1231    RTTEST_CHECK_MSG(hTest,    RTTimeSpecGetNano(&g_testRTFileSetTimes_ATime)
    12421232                            == ccAtimeNano,
    12431233                     (hTest, "ATime=%llu\n",
    1244                       LLUIFY(RTTimeSpecGetNano(&testRTFileSetTimesATime))));
     1234                      LLUIFY(RTTimeSpecGetNano(&g_testRTFileSetTimes_ATime))));
    12451235    unmapAndRemoveMapping(hTest, &svcTable, Root, "testname");
    12461236    AssertReleaseRC(svcTable.pfnDisconnect(NULL, 0, svcTable.pvService));
    12471237    AssertReleaseRC(svcTable.pfnUnload(NULL));
    12481238    RTTestGuardedFree(hTest, svcTable.pvService);
    1249     RTTEST_CHECK_MSG(hTest, g_testRTFileCloseFile == hFile, (hTest, "File=%u\n", g_testRTFileCloseFile));
     1239    RTTEST_CHECK_MSG(hTest, g_testRTFileClose_hFile == hFile, (hTest, "File=%u\n", g_testRTFileClose_hFile));
    12501240}
    12511241
     
    12641254    Root = initWithWritableMapping(hTest, &svcTable, &svcHelpers,
    12651255                                   "/test/mapping", "testname");
    1266     testRTFileOpenpFile = hFile;
     1256    g_testRTFileOpen_hFile = hFile;
    12671257    rc = createFile(&svcTable, Root, "/test/file", SHFL_CF_ACCESS_READ,
    12681258                    &Handle, NULL);
     
    12731263                       sizeof(Info), &Info);
    12741264    RTTEST_CHECK_RC_OK(hTest, rc);
    1275     RTTEST_CHECK_MSG(hTest, g_testRTFileSetSizeFile == hFile, (hTest, "File=%u\n", g_testRTFileSetSizeFile));
    1276     RTTEST_CHECK_MSG(hTest, testRTFileSetSizeSize == cbNew,
    1277                      (hTest, "Size=%llu\n", LLUIFY(testRTFileSetSizeSize)));
     1265    RTTEST_CHECK_MSG(hTest, g_testRTFileSetSize_hFile == hFile, (hTest, "File=%u\n", g_testRTFileSetSize_hFile));
     1266    RTTEST_CHECK_MSG(hTest, g_testRTFileSetSize_cbSize == cbNew,
     1267                     (hTest, "Size=%llu\n", LLUIFY(g_testRTFileSetSize_cbSize)));
    12781268    unmapAndRemoveMapping(hTest, &svcTable, Root, "testname");
    12791269    AssertReleaseRC(svcTable.pfnDisconnect(NULL, 0, svcTable.pvService));
    12801270    AssertReleaseRC(svcTable.pfnUnload(NULL));
    12811271    RTTestGuardedFree(hTest, svcTable.pvService);
    1282     RTTEST_CHECK_MSG(hTest, g_testRTFileCloseFile == hFile, (hTest, "File=%u\n", g_testRTFileCloseFile));
     1272    RTTEST_CHECK_MSG(hTest, g_testRTFileClose_hFile == hFile, (hTest, "File=%u\n", g_testRTFileClose_hFile));
    12831273}
    12841274
     
    12971287    Root = initWithWritableMapping(hTest, &svcTable, &svcHelpers,
    12981288                                   "/test/mapping", "testname");
    1299     testRTFileOpenpFile = hFile;
     1289    g_testRTFileOpen_hFile = hFile;
    13001290    rc = createFile(&svcTable, Root, "/test/file", SHFL_CF_ACCESS_READ,
    13011291                    &Handle, NULL);
     
    13041294    RTTEST_CHECK_RC_OK(hTest, rc);
    13051295#ifdef RT_OS_WINDOWS  /* Locking is a no-op elsewhere. */
    1306     RTTEST_CHECK_MSG(hTest, g_testRTFileLockFile == hFile, (hTest, "File=%u\n", g_testRTFileLockFile));
    1307     RTTEST_CHECK_MSG(hTest, testRTFileLockfLock == 0,
    1308                      (hTest, "fLock=%u\n", testRTFileLockfLock));
    1309     RTTEST_CHECK_MSG(hTest, testRTFileLockOffset == offLock,
    1310                      (hTest, "Offs=%llu\n", (long long) testRTFileLockOffset));
    1311     RTTEST_CHECK_MSG(hTest, testRTFileLockSize == cbLock,
    1312                      (hTest, "Size=%llu\n", LLUIFY(testRTFileLockSize)));
     1296    RTTEST_CHECK_MSG(hTest, g_testRTFileLock_hFile == hFile, (hTest, "File=%u\n", g_testRTFileLock_hFile));
     1297    RTTEST_CHECK_MSG(hTest, g_testRTFileLock_fLock == 0,
     1298                     (hTest, "fLock=%u\n", g_testRTFileLock_fLock));
     1299    RTTEST_CHECK_MSG(hTest, g_testRTFileLock_offLock == offLock,
     1300                     (hTest, "Offs=%llu\n", (long long) g_testRTFileLock_offLock));
     1301    RTTEST_CHECK_MSG(hTest, g_testRTFileLock_cbLock == cbLock,
     1302                     (hTest, "Size=%llu\n", LLUIFY(g_testRTFileLock_cbLock)));
    13131303#endif
    13141304    rc = lockFile(&svcTable, Root, Handle, offLock, cbLock, SHFL_LOCK_CANCEL);
    13151305    RTTEST_CHECK_RC_OK(hTest, rc);
    13161306#ifdef RT_OS_WINDOWS
    1317     RTTEST_CHECK_MSG(hTest, g_testRTFileUnlockFile == hFile, (hTest, "File=%u\n", g_testRTFileUnlockFile));
    1318     RTTEST_CHECK_MSG(hTest, testRTFileUnlockOffset == offLock,
     1307    RTTEST_CHECK_MSG(hTest, g_testRTFileUnlock_hFile == hFile, (hTest, "File=%u\n", g_testRTFileUnlock_hFile));
     1308    RTTEST_CHECK_MSG(hTest, g_testRTFileUnlock_offLock == offLock,
    13191309                     (hTest, "Offs=%llu\n",
    1320                       (long long) testRTFileUnlockOffset));
    1321     RTTEST_CHECK_MSG(hTest, testRTFileUnlockSize == cbLock,
    1322                      (hTest, "Size=%llu\n", LLUIFY(testRTFileUnlockSize)));
     1310                      (long long) g_testRTFileUnlock_offLock));
     1311    RTTEST_CHECK_MSG(hTest, g_testRTFileUnlock_cbLock == cbLock,
     1312                     (hTest, "Size=%llu\n", LLUIFY(g_testRTFileUnlock_cbLock)));
    13231313#endif
    13241314    unmapAndRemoveMapping(hTest, &svcTable, Root, "testname");
     
    13261316    AssertReleaseRC(svcTable.pfnUnload(NULL));
    13271317    RTTestGuardedFree(hTest, svcTable.pvService);
    1328     RTTEST_CHECK_MSG(hTest, g_testRTFileCloseFile == hFile, (hTest, "File=%u\n", g_testRTFileCloseFile));
     1318    RTTEST_CHECK_MSG(hTest, g_testRTFileClose_hFile == hFile, (hTest, "File=%u\n", g_testRTFileClose_hFile));
    13291319}
    13301320
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