VirtualBox

忽略:
時間撮記:
2011-12-6 下午04:48:23 (13 年 以前)
作者:
vboxsync
訊息:

HostServices/SharedFolders: starter unit test, try to make Windows happy.

位置:
trunk/src/VBox/HostServices/SharedFolders
檔案:
修改 4 筆資料

圖例:

未更動
新增
刪除
  • trunk/src/VBox/HostServices/SharedFolders/mappings.cpp

    r39540 r39542  
    1616
    1717#ifdef UNITTEST
    18 # include "teststubs.h"
    1918# include "testcase/tstSharedFolderService.h"
    2019#endif
     
    2423#include <iprt/assert.h>
    2524#include <iprt/string.h>
     25
     26#ifdef UNITTEST
     27# include "teststubs.h"
     28#endif
    2629
    2730/* Shared folders order in the saved state and in the FolderMapping can differ.
  • trunk/src/VBox/HostServices/SharedFolders/testcase/tstSharedFolderService.cpp

    r39540 r39542  
    2727******************************************************************************/
    2828
    29 #include "teststubs.h"
    3029#include "tstSharedFolderService.h"
    3130#include "vbsf.h"
     
    3938#include <iprt/test.h>
    4039
     40#include "teststubs.h"
    4141
    4242/******************************************************************************
     
    115115static PRTDIR testRTDirClosepDir;
    116116
    117 RTDECL(int) testRTDirClose(PRTDIR pDir)
     117extern int testRTDirClose(PRTDIR pDir)
    118118{
    119119 /* RTPrintf("%s: pDir=%p\n", __func__, pDir); */
     
    125125static RTFMODE testRTDirCreateMode;
    126126
    127 RTDECL(int) testRTDirCreate(const char *pszPath, RTFMODE fMode)
     127extern int testRTDirCreate(const char *pszPath, RTFMODE fMode)
    128128{
    129129 /* RTPrintf("%s: pszPath=%s, fMode=0x%llx\n", __func__, pszPath,
     
    136136static PRTDIR testRTDirOpenpDir;
    137137
    138 RTDECL(int) testRTDirOpen(PRTDIR *ppDir, const char *pszPath)
     138extern int testRTDirOpen(PRTDIR *ppDir, const char *pszPath)
    139139{
    140140 /* RTPrintf("%s: pszPath=%s\n", __func__, pszPath); */
     
    148148static RTTIMESPEC testRTDirQueryInfoATime;
    149149
    150 RTDECL(int) testRTDirQueryInfo(PRTDIR pDir, PRTFSOBJINFO pObjInfo,
     150extern int testRTDirQueryInfo(PRTDIR pDir, PRTFSOBJINFO pObjInfo,
    151151                               RTFSOBJATTRADD enmAdditionalAttribs)
    152152{
     
    160160}
    161161
    162 RTDECL(int) testRTDirRemove(const char *pszPath) { RTPrintf("%s\n", __func__); return 0; }
     162extern int testRTDirRemove(const char *pszPath) { RTPrintf("%s\n", __func__); return 0; }
    163163
    164164static PRTDIR testRTDirReadExDir;
    165165
    166 RTDECL(int) testRTDirReadEx(PRTDIR pDir, PRTDIRENTRYEX pDirEntry,
     166extern int testRTDirReadEx(PRTDIR pDir, PRTDIRENTRYEX pDirEntry,
    167167                            size_t *pcbDirEntry,
    168168                            RTFSOBJATTRADD enmAdditionalAttribs,
     
    199199static RTFILE testRTFileCloseFile;
    200200
    201 RTDECL(int)  testRTFileClose(RTFILE File)
     201extern int  testRTFileClose(RTFILE File)
    202202{
    203203 /* RTPrintf("%s: File=%p\n", __func__, File); */
     
    206206}
    207207
    208 RTDECL(int)  testRTFileDelete(const char *pszFilename) { RTPrintf("%s\n", __func__); return 0; }
     208extern int  testRTFileDelete(const char *pszFilename) { RTPrintf("%s\n", __func__); return 0; }
    209209
    210210static RTFILE testRTFileFlushFile;
    211211
    212 RTDECL(int)  testRTFileFlush(RTFILE File)
     212extern int  testRTFileFlush(RTFILE File)
    213213{
    214214 /* RTPrintf("%s: File=%p\n", __func__, File); */
     
    222222static uint64_t testRTFileLockSize;
    223223
    224 RTDECL(int)  testRTFileLock(RTFILE hFile, unsigned fLock, int64_t offLock,
     224extern int  testRTFileLock(RTFILE hFile, unsigned fLock, int64_t offLock,
    225225                            uint64_t cbLock)
    226226{
     
    238238static RTFILE testRTFileOpenpFile;
    239239
    240 RTDECL(int)  testRTFileOpen(PRTFILE pFile, const char *pszFilename,
     240extern int  testRTFileOpen(PRTFILE pFile, const char *pszFilename,
    241241                            uint64_t fOpen)
    242242{
     
    254254static uint32_t testRTFileQueryInfoFMode;
    255255
    256 RTDECL(int)  testRTFileQueryInfo(RTFILE hFile, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAdditionalAttribs)
     256extern int  testRTFileQueryInfo(RTFILE hFile, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAdditionalAttribs)
    257257{
    258258 /* RTPrintf("%s, hFile=%p, enmAdditionalAttribs=0x%llx\n", __func__,
     
    269269static const char *testRTFileReadData;
    270270
    271 RTDECL(int)  testRTFileRead(RTFILE File, void *pvBuf, size_t cbToRead,
     271extern int  testRTFileRead(RTFILE File, void *pvBuf, size_t cbToRead,
    272272                            size_t *pcbRead)
    273273{
     
    281281}
    282282
    283 RTDECL(int) testRTFileSeek(RTFILE hFile, int64_t offSeek, unsigned uMethod,
     283extern int testRTFileSeek(RTFILE hFile, int64_t offSeek, unsigned uMethod,
    284284                           uint64_t *poffActual)
    285285{
     
    293293static uint64_t testRTFileSetFMode;
    294294
    295 RTDECL(int) testRTFileSetMode(RTFILE File, RTFMODE fMode)
     295extern int testRTFileSetMode(RTFILE File, RTFMODE fMode)
    296296{
    297297 /* RTPrintf("%s: fMode=%llu\n", __func__, LLUIFY(fMode)); */
     
    303303static RTFOFF testRTFileSetSizeSize;
    304304
    305 RTDECL(int)  testRTFileSetSize(RTFILE File, uint64_t cbSize)
     305extern int  testRTFileSetSize(RTFILE File, uint64_t cbSize)
    306306{
    307307 /* RTPrintf("%s: File=%llu, cbSize=%llu\n", __func__, LLUIFY(File),
     
    314314static RTTIMESPEC testRTFileSetTimesATime;
    315315
    316 RTDECL(int) testRTFileSetTimes(RTFILE File, PCRTTIMESPEC pAccessTime,
     316extern int testRTFileSetTimes(RTFILE File, PCRTTIMESPEC pAccessTime,
    317317                               PCRTTIMESPEC pModificationTime,
    318318                               PCRTTIMESPEC pChangeTime,
     
    337337static uint64_t testRTFileUnlockSize;
    338338
    339 RTDECL(int)  testRTFileUnlock(RTFILE File, int64_t offLock, uint64_t cbLock)
     339extern int  testRTFileUnlock(RTFILE File, int64_t offLock, uint64_t cbLock)
    340340{
    341341 /* RTPrintf("%s: hFile=%p, ofLock=%lli, cbLock=%llu\n", __func__,
     
    349349static char testRTFileWriteData[256];
    350350
    351 RTDECL(int)  testRTFileWrite(RTFILE File, const void *pvBuf, size_t cbToWrite,
     351extern int  testRTFileWrite(RTFILE File, const void *pvBuf, size_t cbToWrite,
    352352                             size_t *pcbWritten)
    353353{
     
    388388}
    389389
    390 RTDECL(int) testRTSymlinkDelete(const char *pszSymlink) { RTPrintf("%s\n", __func__); return 0; }
    391 RTDECL(int) testRTSymlinkRead(const char *pszSymlink, char *pszTarget,
     390extern int testRTSymlinkDelete(const char *pszSymlink) { RTPrintf("%s\n", __func__); return 0; }
     391extern int testRTSymlinkRead(const char *pszSymlink, char *pszTarget,
    392392                              size_t cbTarget) { RTPrintf("%s\n", __func__); return 0; }
    393393
     
    476476    AssertRelease(  strlen(pcszSource) * 2 + 2 < sizeof(*pDest)
    477477                  - RT_UOFFSETOF(SHFLSTRING, String));
    478     pDest->string.u16Size = strlen(pcszSource) * 2 + 2;
    479     pDest->string.u16Length = strlen(pcszSource);
     478    pDest->string.u16Size = (uint16_t)strlen(pcszSource) * 2 + 2;
     479    pDest->string.u16Length = (uint16_t)strlen(pcszSource);
    480480    for (i = 0; i < strlen(pcszSource) + 1; ++i)
    481481        pDest->string.String.ucs2[i] = (uint16_t)pcszSource[i];
     
    778778    testRTFileReadData = pcszReadData;
    779779    rc = readFile(&svcTable, Root, Handle, 0, strlen(pcszReadData) + 1,
    780                   &cbRead, acBuf, sizeof(acBuf));
     780                  &cbRead, acBuf, (uint32_t)sizeof(acBuf));
    781781    RTTEST_CHECK_RC_OK(hTest, rc);
    782782    RTTEST_CHECK_MSG(hTest,
     
    800800    SHFLHANDLE Handle;
    801801    const char *pcszWrittenData = "Data to write";
    802     uint32_t cbToWrite = strlen(pcszWrittenData) + 1;
     802    uint32_t cbToWrite = (uint32_t)strlen(pcszWrittenData) + 1;
    803803    uint32_t cbWritten;
    804804    int rc;
  • trunk/src/VBox/HostServices/SharedFolders/teststubs.h

    r39540 r39542  
    2424#define __VBSF_TEST_STUBS__H
    2525
     26#include <iprt/dir.h>
     27#include <iprt/time.h>
     28
    2629#define RTDirClose           testRTDirClose
     30extern int testRTDirClose(PRTDIR pDir);
    2731#define RTDirCreate          testRTDirCreate
     32extern int testRTDirCreate(const char *pszPath, RTFMODE fMode);
    2833#define RTDirOpen            testRTDirOpen
     34extern int testRTDirOpen(PRTDIR *ppDir, const char *pszPath);
    2935#define RTDirQueryInfo       testRTDirQueryInfo
     36extern int testRTDirQueryInfo(PRTDIR pDir, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAdditionalAttribs);
    3037#define RTDirRemove          testRTDirRemove
     38extern int testRTDirRemove(const char *pszPath);
    3139#define RTDirReadEx          testRTDirReadEx
     40extern int testRTDirReadEx(PRTDIR pDir, PRTDIRENTRYEX pDirEntry, size_t *pcbDirEntry, RTFSOBJATTRADD enmAdditionalAttribs, uint32_t fFlags);
    3241#define RTDirSetTimes        testRTDirSetTimes
     42extern int testRTDirSetTimes(PRTDIR pDir, PCRTTIMESPEC pAccessTime, PCRTTIMESPEC pModificationTime, PCRTTIMESPEC pChangeTime, PCRTTIMESPEC pBirthTime);
    3343#define RTFileClose          testRTFileClose
     44extern int testRTFileClose(RTFILE hFile);
    3445#define RTFileDelete         testRTFileDelete
     46extern int testRTFileDelete(const char *pszFilename);
    3547#define RTFileFlush          testRTFileFlush
     48extern int testRTFileFlush(RTFILE hFile);
    3649#define RTFileLock           testRTFileLock
     50extern int testRTFileLock(RTFILE hFile, unsigned fLock, int64_t offLock, uint64_t cbLock);
    3751#define RTFileOpen           testRTFileOpen
     52extern int testRTFileOpen(PRTFILE pFile, const char *pszFilename, uint64_t fOpen);
    3853#define RTFileQueryInfo      testRTFileQueryInfo
     54extern int testRTFileQueryInfo(RTFILE hFile, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAdditionalAttribs);
    3955#define RTFileRead           testRTFileRead
     56extern int testRTFileRead(RTFILE hFile, void *pvBuf, size_t cbToRead, size_t *pcbRead);
    4057#define RTFileSetMode        testRTFileSetMode
     58extern int testRTFileSetMode(RTFILE hFile, RTFMODE fMode);
    4159#define RTFileSetSize        testRTFileSetSize
     60extern int testRTFileSetSize(RTFILE hFile, uint64_t cbSize);
    4261#define RTFileSetTimes       testRTFileSetTimes
     62extern int testRTFileSetTimes(RTFILE hFile, PCRTTIMESPEC pAccessTime, PCRTTIMESPEC pModificationTime, PCRTTIMESPEC pChangeTime, PCRTTIMESPEC pBirthTime);
    4363#define RTFileSeek           testRTFileSeek
     64extern int testRTFileSeek(RTFILE hFile, int64_t offSeek, unsigned uMethod, uint64_t *poffActual);
    4465#define RTFileUnlock         testRTFileUnlock
     66extern int testRTFileUnlock(RTFILE hFile, int64_t offLock, uint64_t cbLock);
    4567#define RTFileWrite          testRTFileWrite
     68extern int testRTFileWrite(RTFILE hFile, const void *pvBuf, size_t cbToWrite, size_t *pcbWritten);
    4669#define RTFsQueryProperties  testRTFsQueryProperties
     70extern int testRTFsQueryProperties(const char *pszFsPath, PRTFSPROPERTIES pProperties);
    4771#define RTFsQuerySerial      testRTFsQuerySerial
     72extern int testRTFsQuerySerial(const char *pszFsPath, uint32_t *pu32Serial);
    4873#define RTFsQuerySizes       testRTFsQuerySizes
     74extern int testRTFsQuerySizes(const char *pszFsPath, RTFOFF *pcbTotal, RTFOFF *pcbFree, uint32_t *pcbBlock, uint32_t *pcbSector);
    4975#define RTPathQueryInfoEx    testRTPathQueryInfoEx
     76extern int testRTPathQueryInfoEx(const char *pszPath, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAdditionalAttribs, uint32_t fFlags);
    5077#define RTSymlinkDelete      testRTSymlinkDelete
     78extern int testRTSymlinkDelete(const char *pszSymlink);
    5179#define RTSymlinkRead        testRTSymlinkRead
     80extern int testRTSymlinkRead(const char *pszSymlink, char *pszTarget, size_t cbTarget);
    5281
    5382#endif /* __VBSF_TEST_STUBS__H */
  • trunk/src/VBox/HostServices/SharedFolders/vbsf.cpp

    r39540 r39542  
    1717
    1818#ifdef UNITTEST
    19 # include "teststubs.h"
    2019# include "testcase/tstSharedFolderService.h"
    2120#endif
     
    3736#ifdef RT_OS_DARWIN
    3837# include <Carbon/Carbon.h>
     38#endif
     39
     40#ifdef UNITTEST
     41# include "teststubs.h"
    3942#endif
    4043
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

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