- Timestamp:
- Oct 8, 2020 9:32:43 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedFolders/testcase/tstSharedFolderService.cpp
r82968 r86490 118 118 #define LLUIFY(a) ((unsigned long long)(a)) 119 119 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) 120 static 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) 135 125 if (*psz == '\\') 136 126 *psz = '/'; … … 139 129 #define ARRAY_FROM_PATH(a, b) \ 140 130 do { \ 141 void *p=(a); NOREF(p); \131 char *p = (a); NOREF(p); \ 142 132 Assert((a) == p); /* Constant parameter */ \ 143 133 Assert(sizeof((a)) > 0); \ … … 160 150 } 161 151 162 static char testRTDirCreatePath[256];152 static char g_testRTDirCreate_szPath[256]; 163 153 //static RTFMODE testRTDirCreateMode; - unused 164 154 … … 170 160 if (g_fFailIfNotLowercase && !RTStrIsLowerCased(strpbrk(pszPath, "/\\"))) 171 161 return VERR_FILE_NOT_FOUND; 172 ARRAY_FROM_PATH( testRTDirCreatePath, pszPath);162 ARRAY_FROM_PATH(g_testRTDirCreate_szPath, pszPath); 173 163 return 0; 174 164 } 175 165 176 static char testRTDirOpenName[256];166 static char g_testRTDirOpen_szName[256]; 177 167 static struct TESTDIRHANDLE 178 168 { … … 181 171 } g_aTestDirHandles[4]; 182 172 static int g_iNextDirHandle = 0; 183 static RTDIR testRTDirOpen_hDir;173 static RTDIR g_testRTDirOpen_hDir; 184 174 185 175 extern int testRTDirOpen(RTDIR *phDir, const char *pszPath) … … 188 178 if (g_fFailIfNotLowercase && !RTStrIsLowerCased(strpbrk(pszPath, "/\\"))) 189 179 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; 193 183 if (!*phDir && g_fFailIfNotLowercase) 194 184 *phDir = (RTDIR)&g_aTestDirHandles[g_iNextDirHandle++ % RT_ELEMENTS(g_aTestDirHandles)]; … … 212 202 if (g_fFailIfNotLowercase && !RTStrIsLowerCased(strpbrk(pszPath, "/\\"))) 213 203 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; 217 207 if (!*phDir && g_fFailIfNotLowercase) 218 208 *phDir = (RTDIR)&g_aTestDirHandles[g_iNextDirHandle++ % RT_ELEMENTS(g_aTestDirHandles)]; … … 232 222 233 223 static RTDIR g_testRTDirQueryInfo_hDir; 234 static RTTIMESPEC testRTDirQueryInfoATime;224 static RTTIMESPEC g_testRTDirQueryInfo_ATime; 235 225 236 226 extern int testRTDirQueryInfo(RTDIR hDir, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAdditionalAttribs) … … 241 231 g_testRTDirQueryInfo_hDir = hDir; 242 232 RT_ZERO(*pObjInfo); 243 pObjInfo->AccessTime = testRTDirQueryInfoATime;244 RT_ZERO( testRTDirQueryInfoATime);233 pObjInfo->AccessTime = g_testRTDirQueryInfo_ATime; 234 RT_ZERO(g_testRTDirQueryInfo_ATime); 245 235 return VINF_SUCCESS; 246 236 } … … 302 292 } 303 293 304 static uint64_t testRTDirSetFMode;294 static uint64_t g_testRTDirSetMode_fMode; 305 295 306 296 extern int testRTDirSetMode(RTDIR hDir, RTFMODE fMode) … … 308 298 RT_NOREF1(hDir); 309 299 /* 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 304 static RTTIMESPEC g_testRTDirSetTimes_ATime; 315 305 316 306 extern int testRTDirSetTimes(RTDIR hDir, PCRTTIMESPEC pAccessTime, PCRTTIMESPEC pModificationTime, … … 326 316 pBirthTime ? (long long)RTTimeSpecGetNano(pBirthTime) : -1); */ 327 317 if (pAccessTime) 328 testRTDirSetTimesATime = *pAccessTime;318 g_testRTDirSetTimes_ATime = *pAccessTime; 329 319 else 330 RT_ZERO( testRTDirSetTimesATime);331 return VINF_SUCCESS; 332 } 333 334 static RTFILE g_testRTFileClose File;320 RT_ZERO(g_testRTDirSetTimes_ATime); 321 return VINF_SUCCESS; 322 } 323 324 static RTFILE g_testRTFileClose_hFile; 335 325 336 326 extern int testRTFileClose(RTFILE File) 337 327 { 338 328 /* RTPrintf("%s: File=%p\n", __PRETTY_FUNCTION__, File); */ 339 g_testRTFileClose File = File;329 g_testRTFileClose_hFile = File; 340 330 return 0; 341 331 } … … 349 339 } 350 340 351 static RTFILE g_testRTFileFlush File;341 static RTFILE g_testRTFileFlush_hFile; 352 342 353 343 extern int testRTFileFlush(RTFILE File) 354 344 { 355 345 /* RTPrintf("%s: File=%p\n", __PRETTY_FUNCTION__, File); */ 356 g_testRTFileFlush File = File;357 return VINF_SUCCESS; 358 } 359 360 static RTFILE g_testRTFileLock File;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 350 static RTFILE g_testRTFileLock_hFile; 351 static unsigned g_testRTFileLock_fLock; 352 static int64_t g_testRTFileLock_offLock; 353 static uint64_t g_testRTFileLock_cbLock; 364 354 365 355 extern int testRTFileLock(RTFILE hFile, unsigned fLock, int64_t offLock, uint64_t cbLock) … … 368 358 __PRETTY_FUNCTION__, hFile, fLock, (long long) offLock, 369 359 LLUIFY(cbLock)); */ 370 g_testRTFileLock File = 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 367 static char g_testRTFileOpen_szName[256]; 368 static uint64_t g_testRTFileOpen_fOpen; 369 static RTFILE g_testRTFileOpen_hFile; 380 370 381 371 extern int testRTFileOpenEx(const char *pszFilename, uint64_t fOpen, PRTFILE phFile, PRTFILEACTION penmActionTaken) … … 383 373 /* RTPrintf("%s, pszFilename=%s, fOpen=0x%llx\n", __PRETTY_FUNCTION__, 384 374 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; 387 377 if (g_fFailIfNotLowercase && !RTStrIsLowerCased(strpbrk(pszFilename, "/\\"))) 388 378 return VERR_FILE_NOT_FOUND; 389 *phFile = testRTFileOpenpFile;379 *phFile = g_testRTFileOpen_hFile; 390 380 *penmActionTaken = RTFILEACTION_CREATED; 391 testRTFileOpenpFile = 0;392 return VINF_SUCCESS; 393 } 394 395 static RTFILE g_testRTFileQueryInfo File;396 static RTTIMESPEC testRTFileQueryInfoATime;397 static uint32_t testRTFileQueryInfoFMode;381 g_testRTFileOpen_hFile = 0; 382 return VINF_SUCCESS; 383 } 384 385 static RTFILE g_testRTFileQueryInfo_hFile; 386 static RTTIMESPEC g_testRTFileQueryInfo_ATime; 387 static uint32_t g_testRTFileQueryInfo_fMode; 398 388 399 389 extern int testRTFileQueryInfo(RTFILE hFile, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAdditionalAttribs) … … 402 392 /* RTPrintf("%s, hFile=%p, enmAdditionalAttribs=0x%llx\n", 403 393 __PRETTY_FUNCTION__, hFile, LLUIFY(enmAdditionalAttribs)); */ 404 g_testRTFileQueryInfo File = hFile;394 g_testRTFileQueryInfo_hFile = hFile; 405 395 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 403 static const char *g_testRTFileRead_pszData; 414 404 415 405 extern int testRTFileRead(RTFILE File, void *pvBuf, size_t cbToRead, size_t *pcbRead) … … 418 408 /* RTPrintf("%s : File=%p, cbToRead=%llu\n", __PRETTY_FUNCTION__, File, 419 409 LLUIFY(cbToRead)); */ 420 bufferFromPath( pvBuf, cbToRead, testRTFileReadData);410 bufferFromPath((char *)pvBuf, cbToRead, g_testRTFileRead_pszData); 421 411 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; 424 414 return VINF_SUCCESS; 425 415 } … … 431 421 /* RTPrintf("%s : File=%p, cbToRead=%llu\n", __PRETTY_FUNCTION__, File, 432 422 LLUIFY(cbToRead)); */ 433 bufferFromPath( pvBuf, cbToRead, testRTFileReadData);423 bufferFromPath((char *)pvBuf, cbToRead, g_testRTFileRead_pszData); 434 424 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; 437 427 return VINF_SUCCESS; 438 428 } … … 448 438 } 449 439 450 static uint64_t testRTFileSetFMode;440 static uint64_t g_testRTFileSet_fMode; 451 441 452 442 extern int testRTFileSetMode(RTFILE File, RTFMODE fMode) … … 454 444 RT_NOREF1(File); 455 445 /* RTPrintf("%s: fMode=%llu\n", __PRETTY_FUNCTION__, LLUIFY(fMode)); */ 456 testRTFileSetFMode = fMode;457 return VINF_SUCCESS; 458 } 459 460 static RTFILE g_testRTFileSetSize File;461 static RTFOFF testRTFileSetSizeSize;446 g_testRTFileSet_fMode = fMode; 447 return VINF_SUCCESS; 448 } 449 450 static RTFILE g_testRTFileSetSize_hFile; 451 static RTFOFF g_testRTFileSetSize_cbSize; 462 452 463 453 extern int testRTFileSetSize(RTFILE File, uint64_t cbSize) … … 465 455 /* RTPrintf("%s: File=%llu, cbSize=%llu\n", __PRETTY_FUNCTION__, LLUIFY(File), 466 456 LLUIFY(cbSize)); */ 467 g_testRTFileSetSize File = 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 462 static RTTIMESPEC g_testRTFileSetTimes_ATime; 473 463 474 464 extern int testRTFileSetTimes(RTFILE File, PCRTTIMESPEC pAccessTime, PCRTTIMESPEC pModificationTime, … … 484 474 pBirthTime ? (long long)RTTimeSpecGetNano(pBirthTime) : -1); */ 485 475 if (pAccessTime) 486 testRTFileSetTimesATime = *pAccessTime;476 g_testRTFileSetTimes_ATime = *pAccessTime; 487 477 else 488 RT_ZERO( testRTFileSetTimesATime);489 return VINF_SUCCESS; 490 } 491 492 static RTFILE g_testRTFileUnlock File;493 static int64_t testRTFileUnlockOffset;494 static uint64_t testRTFileUnlockSize;478 RT_ZERO(g_testRTFileSetTimes_ATime); 479 return VINF_SUCCESS; 480 } 481 482 static RTFILE g_testRTFileUnlock_hFile; 483 static int64_t g_testRTFileUnlock_offLock; 484 static uint64_t g_testRTFileUnlock_cbLock; 495 485 496 486 extern int testRTFileUnlock(RTFILE File, int64_t offLock, uint64_t cbLock) … … 498 488 /* RTPrintf("%s: hFile=%p, ofLock=%lli, cbLock=%llu\n", __PRETTY_FUNCTION__, 499 489 File, (long long) offLock, LLUIFY(cbLock)); */ 500 g_testRTFileUnlock File = 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 496 static char g_testRTFileWrite_szData[256]; 507 497 508 498 extern int testRTFileWrite(RTFILE File, const void *pvBuf, size_t cbToWrite, size_t *pcbWritten) … … 511 501 /* RTPrintf("%s: File=%p, pvBuf=%.*s, cbToWrite=%llu\n", __PRETTY_FUNCTION__, 512 502 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); 514 504 if (pcbWritten) 515 *pcbWritten = strlen( testRTFileWriteData) + 1;505 *pcbWritten = strlen(g_testRTFileWrite_szData) + 1; 516 506 return VINF_SUCCESS; 517 507 } … … 522 512 /* RTPrintf("%s: File=%p, pvBuf=%.*s, cbToWrite=%llu\n", __PRETTY_FUNCTION__, 523 513 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); 525 515 if (pcbWritten) 526 *pcbWritten = strlen( testRTFileWriteData) + 1;516 *pcbWritten = strlen(g_testRTFileWrite_szData) + 1; 527 517 return VINF_SUCCESS; 528 518 } … … 903 893 Root = initWithWritableMapping(hTest, &svcTable, &svcHelpers, 904 894 "/test/mapping", "testname"); 905 testRTFileOpenpFile = hFile;895 g_testRTFileOpen_hFile = hFile; 906 896 rc = createFile(&svcTable, Root, "/test/file", SHFL_CF_ACCESS_READ, NULL, 907 897 &Result); 908 898 RTTEST_CHECK_RC_OK(hTest, rc); 909 899 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], 911 901 "/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))); 915 905 RTTEST_CHECK_MSG(hTest, Result == SHFL_FILE_CREATED, 916 906 (hTest, "Result=%d\n", (int) Result)); … … 919 909 AssertReleaseRC(svcTable.pfnUnload(NULL)); 920 910 RTTestGuardedFree(hTest, svcTable.pvService); 921 RTTEST_CHECK_MSG(hTest, g_testRTFileClose File == hFile,922 (hTest, "File=%u\n", (uintptr_t)g_testRTFileClose File));911 RTTEST_CHECK_MSG(hTest, g_testRTFileClose_hFile == hFile, 912 (hTest, "File=%u\n", (uintptr_t)g_testRTFileClose_hFile)); 923 913 } 924 914 … … 937 927 Root = initWithWritableMapping(hTest, &svcTable, &svcHelpers, 938 928 "/test/mapping", "testname", false /*fCaseSensitive*/); 939 testRTFileOpenpFile = hFile;929 g_testRTFileOpen_hFile = hFile; 940 930 rc = createFile(&svcTable, Root, "/TesT/FilE", SHFL_CF_ACCESS_READ, NULL, 941 931 &Result); … … 943 933 944 934 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], 946 936 "/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))); 950 940 RTTEST_CHECK_MSG(hTest, Result == SHFL_FILE_CREATED, 951 941 (hTest, "Result=%d\n", (int) Result)); … … 954 944 AssertReleaseRC(svcTable.pfnUnload(NULL)); 955 945 RTTestGuardedFree(hTest, svcTable.pvService); 956 RTTEST_CHECK_MSG(hTest, g_testRTFileClose File == hFile,957 (hTest, "File=%u\n", (uintptr_t)g_testRTFileClose File));946 RTTEST_CHECK_MSG(hTest, g_testRTFileClose_hFile == hFile, 947 (hTest, "File=%u\n", (uintptr_t)g_testRTFileClose_hFile)); 958 948 959 949 g_fFailIfNotLowercase = false; … … 972 962 Root = initWithWritableMapping(hTest, &svcTable, &svcHelpers, 973 963 "/test/mapping", "testname"); 974 testRTDirOpen_hDir = hDir;964 g_testRTDirOpen_hDir = hDir; 975 965 rc = createFile(&svcTable, Root, "test/dir", 976 966 SHFL_CF_DIRECTORY | SHFL_CF_ACCESS_READ, NULL, &Result); 977 967 RTTEST_CHECK_RC_OK(hTest, rc); 978 968 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], 980 970 "/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])); 982 972 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], 984 974 "/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])); 986 976 RTTEST_CHECK_MSG(hTest, Result == SHFL_FILE_CREATED, 987 977 (hTest, "Result=%d\n", (int) Result)); … … 1008 998 Root = initWithWritableMapping(hTest, &svcTable, &svcHelpers, 1009 999 "/test/mapping", "testname"); 1010 testRTFileOpenpFile = hFile;1000 g_testRTFileOpen_hFile = hFile; 1011 1001 rc = createFile(&svcTable, Root, "/test/file", SHFL_CF_ACCESS_READ, 1012 1002 &Handle, NULL); 1013 1003 RTTEST_CHECK_RC_OK(hTest, rc); 1014 testRTFileReadData = pcszReadData;1004 g_testRTFileRead_pszData = pcszReadData; 1015 1005 memset(achBuf, 'f', sizeof(achBuf)); 1016 1006 rc = readFile(&svcTable, Root, Handle, 0, (uint32_t)strlen(pcszReadData) + 1, … … 1023 1013 (hTest, "cbRead=%llu\n", LLUIFY(cbRead))); 1024 1014 unmapAndRemoveMapping(hTest, &svcTable, Root, "testname"); 1025 RTTEST_CHECK_MSG(hTest, g_testRTFileClose File == hFile, (hTest, "File=%u\n", g_testRTFileCloseFile));1015 RTTEST_CHECK_MSG(hTest, g_testRTFileClose_hFile == hFile, (hTest, "File=%u\n", g_testRTFileClose_hFile)); 1026 1016 AssertReleaseRC(svcTable.pfnDisconnect(NULL, 0, svcTable.pvService)); 1027 1017 AssertReleaseRC(svcTable.pfnUnload(NULL)); … … 1044 1034 Root = initWithWritableMapping(hTest, &svcTable, &svcHelpers, 1045 1035 "/test/mapping", "testname"); 1046 testRTFileOpenpFile = hFile;1036 g_testRTFileOpen_hFile = hFile; 1047 1037 rc = createFile(&svcTable, Root, "/test/file", SHFL_CF_ACCESS_READ, 1048 1038 &Handle, NULL); … … 1052 1042 RTTEST_CHECK_RC_OK(hTest, rc); 1053 1043 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)); 1056 1046 RTTEST_CHECK_MSG(hTest, cbWritten == cbToWrite, 1057 1047 (hTest, "cbWritten=%llu\n", LLUIFY(cbWritten))); 1058 1048 unmapAndRemoveMapping(hTest, &svcTable, Root, "testname"); 1059 RTTEST_CHECK_MSG(hTest, g_testRTFileClose File == hFile, (hTest, "File=%u\n", g_testRTFileCloseFile));1049 RTTEST_CHECK_MSG(hTest, g_testRTFileClose_hFile == hFile, (hTest, "File=%u\n", g_testRTFileClose_hFile)); 1060 1050 AssertReleaseRC(svcTable.pfnDisconnect(NULL, 0, svcTable.pvService)); 1061 1051 AssertReleaseRC(svcTable.pfnUnload(NULL)); … … 1075 1065 Root = initWithWritableMapping(hTest, &svcTable, &svcHelpers, 1076 1066 "/test/mapping", "testname"); 1077 testRTFileOpenpFile = hFile;1067 g_testRTFileOpen_hFile = hFile; 1078 1068 rc = createFile(&svcTable, Root, "/test/file", SHFL_CF_ACCESS_READ, 1079 1069 &Handle, NULL); … … 1081 1071 rc = flushFile(&svcTable, Root, Handle); 1082 1072 RTTEST_CHECK_RC_OK(hTest, rc); 1083 RTTEST_CHECK_MSG(hTest, g_testRTFileFlush File == hFile, (hTest, "File=%u\n", g_testRTFileFlushFile));1073 RTTEST_CHECK_MSG(hTest, g_testRTFileFlush_hFile == hFile, (hTest, "File=%u\n", g_testRTFileFlush_hFile)); 1084 1074 unmapAndRemoveMapping(hTest, &svcTable, Root, "testname"); 1085 1075 AssertReleaseRC(svcTable.pfnDisconnect(NULL, 0, svcTable.pvService)); 1086 1076 AssertReleaseRC(svcTable.pfnUnload(NULL)); 1087 1077 RTTestGuardedFree(hTest, svcTable.pvService); 1088 RTTEST_CHECK_MSG(hTest, g_testRTFileClose File == hFile, (hTest, "File=%u\n", g_testRTFileCloseFile));1078 RTTEST_CHECK_MSG(hTest, g_testRTFileClose_hFile == hFile, (hTest, "File=%u\n", g_testRTFileClose_hFile)); 1089 1079 } 1090 1080 … … 1107 1097 Root = initWithWritableMapping(hTest, &svcTable, &svcHelpers, 1108 1098 "/test/mapping", "testname"); 1109 testRTDirOpen_hDir = hDir;1099 g_testRTDirOpen_hDir = hDir; 1110 1100 rc = createFile(&svcTable, Root, "test/dir", 1111 1101 SHFL_CF_DIRECTORY | SHFL_CF_ACCESS_READ, &Handle, NULL); … … 1137 1127 "/test/mapping", "testname"); 1138 1128 SHFLHANDLE Handle = SHFL_HANDLE_NIL; 1139 testRTFileOpenpFile = hFile;1129 g_testRTFileOpen_hFile = hFile; 1140 1130 rc = createFile(&svcTable, Root, "/test/file", SHFL_CF_ACCESS_READ, 1141 1131 &Handle, NULL); … … 1143 1133 1144 1134 RT_ZERO(Info); 1145 testRTFileQueryInfoFMode = fMode;1135 g_testRTFileQueryInfo_fMode = fMode; 1146 1136 rc = sfInformation(&svcTable, Root, Handle, SHFL_INFO_FILE, sizeof(Info), 1147 1137 &Info); 1148 1138 RTTEST_CHECK_RC_OK(hTest, rc); 1149 RTTEST_CHECK_MSG(hTest, g_testRTFileQueryInfo File == hFile, (hTest, "File=%u\n", g_testRTFileQueryInfoFile));1139 RTTEST_CHECK_MSG(hTest, g_testRTFileQueryInfo_hFile == hFile, (hTest, "File=%u\n", g_testRTFileQueryInfo_hFile)); 1150 1140 RTTEST_CHECK_MSG(hTest, Info.Attr.fMode == fMode, 1151 1141 (hTest, "cbObject=%llu\n", LLUIFY(Info.cbObject))); … … 1155 1145 sizeof(Info), &Info); 1156 1146 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))); 1159 1149 unmapAndRemoveMapping(hTest, &svcTable, Root, "testname"); 1160 1150 AssertReleaseRC(svcTable.pfnDisconnect(NULL, 0, svcTable.pvService)); 1161 1151 AssertReleaseRC(svcTable.pfnUnload(NULL)); 1162 1152 RTTestGuardedFree(hTest, svcTable.pvService); 1163 RTTEST_CHECK_MSG(hTest, g_testRTFileClose File == hFile, (hTest, "File=%u\n", g_testRTFileCloseFile));1153 RTTEST_CHECK_MSG(hTest, g_testRTFileClose_hFile == hFile, (hTest, "File=%u\n", g_testRTFileClose_hFile)); 1164 1154 } 1165 1155 … … 1178 1168 Root = initWithWritableMapping(hTest, &svcTable, &svcHelpers, 1179 1169 "/test/mapping", "testname"); 1180 testRTDirOpen_hDir = hDir;1170 g_testRTDirOpen_hDir = hDir; 1181 1171 rc = createFile(&svcTable, Root, "test/dir", 1182 1172 SHFL_CF_DIRECTORY | SHFL_CF_ACCESS_READ, &Handle, NULL); 1183 1173 RTTEST_CHECK_RC_OK(hTest, rc); 1184 1174 RT_ZERO(Info); 1185 RTTimeSpecSetNano(& testRTDirQueryInfoATime, ccAtimeNano);1175 RTTimeSpecSetNano(&g_testRTDirQueryInfo_ATime, ccAtimeNano); 1186 1176 rc = sfInformation(&svcTable, Root, Handle, SHFL_INFO_FILE, sizeof(Info), 1187 1177 &Info); … … 1196 1186 sizeof(Info), &Info); 1197 1187 RTTEST_CHECK_RC_OK(hTest, rc); 1198 RTTEST_CHECK_MSG(hTest, RTTimeSpecGetNano(& testRTDirSetTimesATime)1188 RTTEST_CHECK_MSG(hTest, RTTimeSpecGetNano(&g_testRTDirSetTimes_ATime) 1199 1189 == ccAtimeNano, 1200 1190 (hTest, "ATime=%llu\n", 1201 LLUIFY(RTTimeSpecGetNano(& testRTDirSetTimesATime))));1191 LLUIFY(RTTimeSpecGetNano(&g_testRTDirSetTimes_ATime)))); 1202 1192 unmapAndRemoveMapping(hTest, &svcTable, Root, "testname"); 1203 1193 AssertReleaseRC(svcTable.pfnDisconnect(NULL, 0, svcTable.pvService)); … … 1221 1211 Root = initWithWritableMapping(hTest, &svcTable, &svcHelpers, 1222 1212 "/test/mapping", "testname"); 1223 testRTFileOpenpFile = hFile;1213 g_testRTFileOpen_hFile = hFile; 1224 1214 rc = createFile(&svcTable, Root, "/test/file", SHFL_CF_ACCESS_READ, 1225 1215 &Handle, NULL); 1226 1216 RTTEST_CHECK_RC_OK(hTest, rc); 1227 1217 RT_ZERO(Info); 1228 RTTimeSpecSetNano(& testRTFileQueryInfoATime, ccAtimeNano);1218 RTTimeSpecSetNano(&g_testRTFileQueryInfo_ATime, ccAtimeNano); 1229 1219 rc = sfInformation(&svcTable, Root, Handle, SHFL_INFO_FILE, sizeof(Info), 1230 1220 &Info); 1231 1221 RTTEST_CHECK_RC_OK(hTest, rc); 1232 RTTEST_CHECK_MSG(hTest, g_testRTFileQueryInfo File == hFile, (hTest, "File=%u\n", g_testRTFileQueryInfoFile));1222 RTTEST_CHECK_MSG(hTest, g_testRTFileQueryInfo_hFile == hFile, (hTest, "File=%u\n", g_testRTFileQueryInfo_hFile)); 1233 1223 RTTEST_CHECK_MSG(hTest, RTTimeSpecGetNano(&Info.AccessTime) == ccAtimeNano, 1234 1224 (hTest, "ATime=%llu\n", … … 1239 1229 sizeof(Info), &Info); 1240 1230 RTTEST_CHECK_RC_OK(hTest, rc); 1241 RTTEST_CHECK_MSG(hTest, RTTimeSpecGetNano(& testRTFileSetTimesATime)1231 RTTEST_CHECK_MSG(hTest, RTTimeSpecGetNano(&g_testRTFileSetTimes_ATime) 1242 1232 == ccAtimeNano, 1243 1233 (hTest, "ATime=%llu\n", 1244 LLUIFY(RTTimeSpecGetNano(& testRTFileSetTimesATime))));1234 LLUIFY(RTTimeSpecGetNano(&g_testRTFileSetTimes_ATime)))); 1245 1235 unmapAndRemoveMapping(hTest, &svcTable, Root, "testname"); 1246 1236 AssertReleaseRC(svcTable.pfnDisconnect(NULL, 0, svcTable.pvService)); 1247 1237 AssertReleaseRC(svcTable.pfnUnload(NULL)); 1248 1238 RTTestGuardedFree(hTest, svcTable.pvService); 1249 RTTEST_CHECK_MSG(hTest, g_testRTFileClose File == hFile, (hTest, "File=%u\n", g_testRTFileCloseFile));1239 RTTEST_CHECK_MSG(hTest, g_testRTFileClose_hFile == hFile, (hTest, "File=%u\n", g_testRTFileClose_hFile)); 1250 1240 } 1251 1241 … … 1264 1254 Root = initWithWritableMapping(hTest, &svcTable, &svcHelpers, 1265 1255 "/test/mapping", "testname"); 1266 testRTFileOpenpFile = hFile;1256 g_testRTFileOpen_hFile = hFile; 1267 1257 rc = createFile(&svcTable, Root, "/test/file", SHFL_CF_ACCESS_READ, 1268 1258 &Handle, NULL); … … 1273 1263 sizeof(Info), &Info); 1274 1264 RTTEST_CHECK_RC_OK(hTest, rc); 1275 RTTEST_CHECK_MSG(hTest, g_testRTFileSetSize File == 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))); 1278 1268 unmapAndRemoveMapping(hTest, &svcTable, Root, "testname"); 1279 1269 AssertReleaseRC(svcTable.pfnDisconnect(NULL, 0, svcTable.pvService)); 1280 1270 AssertReleaseRC(svcTable.pfnUnload(NULL)); 1281 1271 RTTestGuardedFree(hTest, svcTable.pvService); 1282 RTTEST_CHECK_MSG(hTest, g_testRTFileClose File == hFile, (hTest, "File=%u\n", g_testRTFileCloseFile));1272 RTTEST_CHECK_MSG(hTest, g_testRTFileClose_hFile == hFile, (hTest, "File=%u\n", g_testRTFileClose_hFile)); 1283 1273 } 1284 1274 … … 1297 1287 Root = initWithWritableMapping(hTest, &svcTable, &svcHelpers, 1298 1288 "/test/mapping", "testname"); 1299 testRTFileOpenpFile = hFile;1289 g_testRTFileOpen_hFile = hFile; 1300 1290 rc = createFile(&svcTable, Root, "/test/file", SHFL_CF_ACCESS_READ, 1301 1291 &Handle, NULL); … … 1304 1294 RTTEST_CHECK_RC_OK(hTest, rc); 1305 1295 #ifdef RT_OS_WINDOWS /* Locking is a no-op elsewhere. */ 1306 RTTEST_CHECK_MSG(hTest, g_testRTFileLock File == 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))); 1313 1303 #endif 1314 1304 rc = lockFile(&svcTable, Root, Handle, offLock, cbLock, SHFL_LOCK_CANCEL); 1315 1305 RTTEST_CHECK_RC_OK(hTest, rc); 1316 1306 #ifdef RT_OS_WINDOWS 1317 RTTEST_CHECK_MSG(hTest, g_testRTFileUnlock File == 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, 1319 1309 (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))); 1323 1313 #endif 1324 1314 unmapAndRemoveMapping(hTest, &svcTable, Root, "testname"); … … 1326 1316 AssertReleaseRC(svcTable.pfnUnload(NULL)); 1327 1317 RTTestGuardedFree(hTest, svcTable.pvService); 1328 RTTEST_CHECK_MSG(hTest, g_testRTFileClose File == hFile, (hTest, "File=%u\n", g_testRTFileCloseFile));1318 RTTEST_CHECK_MSG(hTest, g_testRTFileClose_hFile == hFile, (hTest, "File=%u\n", g_testRTFileClose_hFile)); 1329 1319 } 1330 1320
Note:
See TracChangeset
for help on using the changeset viewer.