vbox的更動 39540 路徑 trunk/src/VBox/HostServices/SharedFolders
- 時間撮記:
- 2011-12-6 下午03:17:59 (13 年 以前)
- 位置:
- trunk/src/VBox/HostServices/SharedFolders
- 檔案:
-
- 新增 3 筆資料
- 修改 4 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/HostServices/SharedFolders/mappings.cpp
r31055 r39540 14 14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. 15 15 */ 16 17 #ifdef UNITTEST 18 # include "teststubs.h" 19 # include "testcase/tstSharedFolderService.h" 20 #endif 16 21 17 22 #include "mappings.h" … … 170 175 171 176 177 #ifdef UNITTEST 178 /** Unit test the SHFL_FN_ADD_MAPPING API. Located here as a form of API 179 * documentation. */ 180 void testMappingsAdd(RTTEST hTest) 181 { 182 /* If the number or types of parameters are wrong the API should fail. */ 183 testMappingsAddBadParameters(hTest); 184 /* Add tests as required... */ 185 } 186 #endif 172 187 /* 173 188 * We are always executed from one specific HGCM thread. So thread safe. … … 255 270 } 256 271 272 #ifdef UNITTEST 273 /** Unit test the SHFL_FN_REMOVE_MAPPING API. Located here as a form of API 274 * documentation. */ 275 void testMappingsRemove(RTTEST hTest) 276 { 277 /* If the number or types of parameters are wrong the API should fail. */ 278 testMappingsRemoveBadParameters(hTest); 279 /* Add tests as required... */ 280 } 281 #endif 257 282 int vbsfMappingsRemove(PSHFLSTRING pMapName) 258 283 { … … 331 356 } 332 357 358 #ifdef UNITTEST 359 /** Unit test the SHFL_FN_QUERY_MAPPINGS API. Located here as a form of API 360 * documentation (or should it better be inline in include/VBox/shflsvc.h?) */ 361 void testMappingsQuery(RTTEST hTest) 362 { 363 /* The API should return all mappings if we provide enough buffers. */ 364 testMappingsQuerySimple(hTest); 365 /* If we provide too few buffers that should be signalled correctly. */ 366 testMappingsQueryTooFewBuffers(hTest); 367 /* The SHFL_MF_AUTOMOUNT flag means return only auto-mounted mappings. */ 368 testMappingsQueryAutoMount(hTest); 369 /* The mappings return array must have numberOfMappings entries. */ 370 testMappingsQueryArrayWrongSize(hTest); 371 } 372 #endif 333 373 /** 334 374 * Note: If pMappings / *pcMappings is smaller than the actual amount of mappings … … 376 416 } 377 417 418 #ifdef UNITTEST 419 /** Unit test the SHFL_FN_QUERY_MAP_NAME API. Located here as a form of API 420 * documentation. */ 421 void testMappingsQueryName(RTTEST hTest) 422 { 423 /* If we query an valid mapping it should be returned. */ 424 testMappingsQueryNameValid(hTest); 425 /* If we query an invalid mapping that should be signalled. */ 426 testMappingsQueryNameInvalid(hTest); 427 /* If we pass in a bad string buffer that should be detected. */ 428 testMappingsQueryNameBadBuffer(hTest); 429 } 430 #endif 378 431 int vbsfMappingsQueryName(PSHFLCLIENTDATA pClient, SHFLROOT root, SHFLSTRING *pString) 379 432 { … … 455 508 } 456 509 510 #ifdef UNITTEST 511 /** Unit test the SHFL_FN_MAP_FOLDER API. Located here as a form of API 512 * documentation. */ 513 void testMapFolder(RTTEST hTest) 514 { 515 /* If we try to map a valid name we should get the root. */ 516 testMapFolderValid(hTest); 517 /* If we try to map a valid name we should get VERR_FILE_NOT_FOUND. */ 518 testMapFolderInvalid(hTest); 519 /* If we map a folder twice we can unmap it twice. 520 * Currently unmapping too often is only asserted but not signalled. */ 521 testMapFolderTwice(hTest); 522 /* The delimiter should be converted in e.g. file delete operations. */ 523 testMapFolderDelimiter(hTest); 524 /* Test case sensitive mapping by opening a file with the wrong case. */ 525 testMapFolderCaseSensitive(hTest); 526 /* Test case insensitive mapping by opening a file with the wrong case. */ 527 testMapFolderCaseInsensitive(hTest); 528 /* If the number or types of parameters are wrong the API should fail. */ 529 testMapFolderBadParameters(hTest); 530 } 531 #endif 457 532 int vbsfMapFolder(PSHFLCLIENTDATA pClient, PSHFLSTRING pszMapName, 458 533 RTUTF16 delimiter, bool fCaseSensitive, SHFLROOT *pRoot) … … 506 581 } 507 582 583 #ifdef UNITTEST 584 /** Unit test the SHFL_FN_UNMAP_FOLDER API. Located here as a form of API 585 * documentation. */ 586 void testUnmapFolder(RTTEST hTest) 587 { 588 /* Unmapping a mapped folder should succeed. 589 * If the folder is not mapped this is only asserted, not signalled. */ 590 testUnmapFolderValid(hTest); 591 /* Unmapping a non-existant root should fail. */ 592 testUnmapFolderInvalid(hTest); 593 /* If the number or types of parameters are wrong the API should fail. */ 594 testUnmapFolderBadParameters(hTest); 595 } 596 #endif 508 597 int vbsfUnmapFolder(PSHFLCLIENTDATA pClient, SHFLROOT root) 509 598 { -
trunk/src/VBox/HostServices/SharedFolders/service.cpp
r38735 r39540 112 112 static DECLCALLBACK(int) svcSaveState(void *, uint32_t u32ClientID, void *pvClient, PSSMHANDLE pSSM) 113 113 { 114 #ifndef UNITTEST /* Read this as not yet tested */ 114 115 SHFLCLIENTDATA *pClient = (SHFLCLIENTDATA *)pvClient; 115 116 … … 167 168 } 168 169 170 #endif 169 171 return VINF_SUCCESS; 170 172 } … … 172 174 static DECLCALLBACK(int) svcLoadState(void *, uint32_t u32ClientID, void *pvClient, PSSMHANDLE pSSM) 173 175 { 176 #ifndef UNITTEST /* Read this as not yet tested */ 174 177 uint32_t nrMappings; 175 178 SHFLCLIENTDATA *pClient = (SHFLCLIENTDATA *)pvClient; … … 260 263 } 261 264 Log(("SharedFolders host service: successfully loaded state\n")); 265 #endif 262 266 return VINF_SUCCESS; 263 267 } -
trunk/src/VBox/HostServices/SharedFolders/testcase/Makefile.kmk
r38152 r39540 51 51 tstShflCase_LIBS = $(LIB_RUNTIME) 52 52 53 # 54 # HGCM service testcase. 55 # 56 57 # As there are differences between the Windows build of the service and others, 58 # we do an additional build with RT_OS_WINDOWS defined on non-Windows targets. 59 PROGRAMS += \ 60 tstSharedFolderService \ 61 $(if $(eq $(KBUILD_TARGET),win),,tstSharedFolderService-win) 62 63 tstSharedFolderService_TEMPLATE = VBOXR3TSTEXE 64 tstSharedFolderService_DEFS = VBOX_WITH_HGCM UNITTEST 65 tstSharedFolderService_INCS = .. 66 tstSharedFolderService_SOURCES = \ 67 tstSharedFolderService.cpp \ 68 ../mappings.cpp \ 69 ../service.cpp \ 70 ../shflhandle.cpp \ 71 ../vbsf.cpp 72 tstSharedFolderService_LIBS = $(LIB_RUNTIME) 73 74 tstSharedFolderService-win_TEMPLATE = $(tstSharedFolderService_TEMPLATE) 75 tstSharedFolderService-win_DEFS = \ 76 $(tstSharedFolderService_DEFS) \ 77 RT_OS_WINDOWS 78 tstSharedFolderService-win_INCS = $(tstSharedFolderService_INCS) 79 tstSharedFolderService-win_SOURCES = $(tstSharedFolderService_SOURCES) 80 tstSharedFolderService-win_LIBS = $(tstSharedFolderService_LIBS) 81 53 82 endif # VBOX_WITH_TESTCASES 54 83 -
trunk/src/VBox/HostServices/SharedFolders/vbsf.cpp
r38736 r39540 15 15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. 16 16 */ 17 18 #ifdef UNITTEST 19 # include "teststubs.h" 20 # include "testcase/tstSharedFolderService.h" 21 #endif 17 22 18 23 #include "mappings.h" … … 1189 1194 } 1190 1195 1196 #ifdef UNITTEST 1197 /** Unit test the SHFL_FN_CREATE API. Located here as a form of API 1198 * documentation. */ 1199 void testCreate(RTTEST hTest) 1200 { 1201 /* Simple opening of an existing file. */ 1202 testCreateFileSimple(hTest); 1203 /* Simple opening of an existing directory. */ 1204 testCreateDirSimple(hTest); 1205 /* If the number or types of parameters are wrong the API should fail. */ 1206 testCreateBadParameters(hTest); 1207 /* Add tests as required... */ 1208 } 1209 #endif 1191 1210 /** 1192 1211 * Create or open a file or folder. Perform character set and case … … 1325 1344 } 1326 1345 1346 #ifdef UNITTEST 1347 /** Unit test the SHFL_FN_CLOSE API. Located here as a form of API 1348 * documentation. */ 1349 void testClose(RTTEST hTest) 1350 { 1351 /* If the API parameters are invalid the API should fail. */ 1352 testCloseBadParameters(hTest); 1353 /* Add tests as required... */ 1354 } 1355 #endif 1327 1356 int vbsfClose (SHFLCLIENTDATA *pClient, SHFLROOT root, SHFLHANDLE Handle) 1328 1357 { … … 1360 1389 } 1361 1390 1391 #ifdef UNITTEST 1392 /** Unit test the SHFL_FN_READ API. Located here as a form of API 1393 * documentation. */ 1394 void testRead(RTTEST hTest) 1395 { 1396 /* If the number or types of parameters are wrong the API should fail. */ 1397 testReadBadParameters(hTest); 1398 /* Basic reading from a file. */ 1399 testReadFileSimple(hTest); 1400 /* Add tests as required... */ 1401 } 1402 #endif 1362 1403 int vbsfRead (SHFLCLIENTDATA *pClient, SHFLROOT root, SHFLHANDLE Handle, uint64_t offset, uint32_t *pcbBuffer, uint8_t *pBuffer) 1363 1404 { … … 1391 1432 } 1392 1433 1434 #ifdef UNITTEST 1435 /** Unit test the SHFL_FN_WRITE API. Located here as a form of API 1436 * documentation. */ 1437 void testWrite(RTTEST hTest) 1438 { 1439 /* If the number or types of parameters are wrong the API should fail. */ 1440 testWriteBadParameters(hTest); 1441 /* Simple test of writing to a file. */ 1442 testWriteFileSimple(hTest); 1443 /* Add tests as required... */ 1444 } 1445 #endif 1393 1446 int vbsfWrite (SHFLCLIENTDATA *pClient, SHFLROOT root, SHFLHANDLE Handle, uint64_t offset, uint32_t *pcbBuffer, uint8_t *pBuffer) 1394 1447 { … … 1429 1482 1430 1483 1484 #ifdef UNITTEST 1485 /** Unit test the SHFL_FN_FLUSH API. Located here as a form of API 1486 * documentation. */ 1487 void testFlush(RTTEST hTest) 1488 { 1489 /* If the number or types of parameters are wrong the API should fail. */ 1490 testFlushBadParameters(hTest); 1491 /* Simple opening and flushing of a file. */ 1492 testFlushFileSimple(hTest); 1493 /* Add tests as required... */ 1494 } 1495 #endif 1431 1496 int vbsfFlush(SHFLCLIENTDATA *pClient, SHFLROOT root, SHFLHANDLE Handle) 1432 1497 { … … 1446 1511 } 1447 1512 1513 #ifdef UNITTEST 1514 /** Unit test the SHFL_FN_LIST API. Located here as a form of API 1515 * documentation. */ 1516 void testDirList(RTTEST hTest) 1517 { 1518 /* If the number or types of parameters are wrong the API should fail. */ 1519 testDirListBadParameters(hTest); 1520 /* Test listing an empty directory (simple edge case). */ 1521 testDirListEmpty(hTest); 1522 /* Add tests as required... */ 1523 } 1524 #endif 1448 1525 int vbsfDirList(SHFLCLIENTDATA *pClient, SHFLROOT root, SHFLHANDLE Handle, SHFLSTRING *pPath, uint32_t flags, 1449 1526 uint32_t *pcbBuffer, uint8_t *pBuffer, uint32_t *pIndex, uint32_t *pcFiles) … … 1650 1727 } 1651 1728 1729 #ifdef UNITTEST 1730 /** Unit test the SHFL_FN_READLINK API. Located here as a form of API 1731 * documentation. */ 1732 void testReadLink(RTTEST hTest) 1733 { 1734 /* If the number or types of parameters are wrong the API should fail. */ 1735 testReadLinkBadParameters(hTest); 1736 /* Add tests as required... */ 1737 } 1738 #endif 1652 1739 int vbsfReadLink(SHFLCLIENTDATA *pClient, SHFLROOT root, SHFLSTRING *pPath, uint32_t cbPath, uint8_t *pBuffer, uint32_t cbBuffer) 1653 1740 { … … 1923 2010 } 1924 2011 2012 #ifdef UNITTEST 2013 /** Unit test the SHFL_FN_INFORMATION API. Located here as a form of API 2014 * documentation. */ 2015 void testFSInfo(RTTEST hTest) 2016 { 2017 /* If the number or types of parameters are wrong the API should fail. */ 2018 testFSInfoBadParameters(hTest); 2019 /* Basic get and set file size test. */ 2020 testFSInfoQuerySetFMode(hTest); 2021 /* Basic get and set dir atime test. */ 2022 testFSInfoQuerySetDirATime(hTest); 2023 /* Basic get and set file atime test. */ 2024 testFSInfoQuerySetFileATime(hTest); 2025 /* Basic set end of file. */ 2026 testFSInfoQuerySetEndOfFile(hTest); 2027 /* Add tests as required... */ 2028 } 2029 #endif 1925 2030 int vbsfSetFSInfo(SHFLCLIENTDATA *pClient, SHFLROOT root, SHFLHANDLE Handle, uint32_t flags, uint32_t *pcbBuffer, uint8_t *pBuffer) 1926 2031 { … … 1951 2056 } 1952 2057 2058 #ifdef UNITTEST 2059 /** Unit test the SHFL_FN_LOCK API. Located here as a form of API 2060 * documentation. */ 2061 void testLock(RTTEST hTest) 2062 { 2063 /* If the number or types of parameters are wrong the API should fail. */ 2064 testLockBadParameters(hTest); 2065 /* Simple file locking and unlocking test. */ 2066 testLockFileSimple(hTest); 2067 /* Add tests as required... */ 2068 } 2069 #endif 1953 2070 int vbsfLock(SHFLCLIENTDATA *pClient, SHFLROOT root, SHFLHANDLE Handle, uint64_t offset, uint64_t length, uint32_t flags) 1954 2071 { … … 2036 2153 2037 2154 2155 #ifdef UNITTEST 2156 /** Unit test the SHFL_FN_REMOVE API. Located here as a form of API 2157 * documentation. */ 2158 void testRemove(RTTEST hTest) 2159 { 2160 /* If the number or types of parameters are wrong the API should fail. */ 2161 testRemoveBadParameters(hTest); 2162 /* Add tests as required... */ 2163 } 2164 #endif 2038 2165 int vbsfRemove(SHFLCLIENTDATA *pClient, SHFLROOT root, SHFLSTRING *pPath, uint32_t cbPath, uint32_t flags) 2039 2166 { … … 2084 2211 2085 2212 2213 #ifdef UNITTEST 2214 /** Unit test the SHFL_FN_RENAME API. Located here as a form of API 2215 * documentation. */ 2216 void testRename(RTTEST hTest) 2217 { 2218 /* If the number or types of parameters are wrong the API should fail. */ 2219 testRenameBadParameters(hTest); 2220 /* Add tests as required... */ 2221 } 2222 #endif 2086 2223 int vbsfRename(SHFLCLIENTDATA *pClient, SHFLROOT root, SHFLSTRING *pSrc, SHFLSTRING *pDest, uint32_t flags) 2087 2224 { … … 2142 2279 } 2143 2280 2281 #ifdef UNITTEST 2282 /** Unit test the SHFL_FN_SYMLINK API. Located here as a form of API 2283 * documentation. */ 2284 void testSymlink(RTTEST hTest) 2285 { 2286 /* If the number or types of parameters are wrong the API should fail. */ 2287 testSymlinkBadParameters(hTest); 2288 /* Add tests as required... */ 2289 } 2290 #endif 2144 2291 int vbsfSymlink(SHFLCLIENTDATA *pClient, SHFLROOT root, SHFLSTRING *pNewPath, SHFLSTRING *pOldPath, SHFLFSOBJINFO *pInfo) 2145 2292 {
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器