summaryrefslogtreecommitdiff
path: root/src/VBox/HostServices/SharedFolders/testcase
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2014-03-26 19:21:20 +0000
committer <>2014-05-08 15:03:54 +0000
commitfb123f93f9f5ce42c8e5785d2f8e0edaf951740e (patch)
treec2103d76aec5f1f10892cd1d3a38e24f665ae5db /src/VBox/HostServices/SharedFolders/testcase
parent58ed4748338f9466599adfc8a9171280ed99e23f (diff)
downloadVirtualBox-master.tar.gz
Imported from /home/lorry/working-area/delta_VirtualBox/VirtualBox-4.3.10.tar.bz2.HEADVirtualBox-4.3.10master
Diffstat (limited to 'src/VBox/HostServices/SharedFolders/testcase')
-rw-r--r--src/VBox/HostServices/SharedFolders/testcase/Makefile.kmk14
-rw-r--r--src/VBox/HostServices/SharedFolders/testcase/tstSharedFolderService.cpp41
-rw-r--r--src/VBox/HostServices/SharedFolders/testcase/tstShflSizes.cpp2
3 files changed, 30 insertions, 27 deletions
diff --git a/src/VBox/HostServices/SharedFolders/testcase/Makefile.kmk b/src/VBox/HostServices/SharedFolders/testcase/Makefile.kmk
index a6f327ef..a2f6120d 100644
--- a/src/VBox/HostServices/SharedFolders/testcase/Makefile.kmk
+++ b/src/VBox/HostServices/SharedFolders/testcase/Makefile.kmk
@@ -54,12 +54,7 @@ tstShflCase_LIBS = $(LIB_RUNTIME)
# HGCM service testcase.
#
-# As there are differences between the Windows build of the service and others,
-# we do an additional build with RT_OS_WINDOWS defined on non-Windows targets.
-PROGRAMS += \
- tstSharedFolderService \
- $(if $(eq $(KBUILD_TARGET),win),,tstSharedFolderService-win)
-
+PROGRAMS += tstSharedFolderService
tstSharedFolderService_TEMPLATE = VBOXR3TSTEXE
tstSharedFolderService_DEFS = VBOX_WITH_HGCM UNITTEST
tstSharedFolderService_INCS = ..
@@ -73,6 +68,12 @@ tstSharedFolderService_LDFLAGS.darwin = \
-framework Carbon
tstSharedFolderService_LIBS = $(LIB_RUNTIME)
+if 0 # Cannot define two RT_OS_XXX macros!
+# As there are differences between the Windows build of the service and others,
+# we do an additional build with RT_OS_WINDOWS defined on non-Windows targets.
+PROGRAMS += \
+ tstSharedFolderService \
+ $(if $(eq $(KBUILD_TARGET),win),,tstSharedFolderService-win)
tstSharedFolderService-win_TEMPLATE = $(tstSharedFolderService_TEMPLATE)
tstSharedFolderService-win_DEFS = \
$(tstSharedFolderService_DEFS) \
@@ -82,6 +83,7 @@ tstSharedFolderService-win_SOURCES = $(tstSharedFolderService_SOURCES)
tstSharedFolderService-win_LDFLAGS.darwin = \
$(tstSharedFolderService_LDFLAGS.darwin)
tstSharedFolderService-win_LIBS = $(tstSharedFolderService_LIBS)
+endif
endif # VBOX_WITH_TESTCASES
diff --git a/src/VBox/HostServices/SharedFolders/testcase/tstSharedFolderService.cpp b/src/VBox/HostServices/SharedFolders/testcase/tstSharedFolderService.cpp
index b72e724b..1215090a 100644
--- a/src/VBox/HostServices/SharedFolders/testcase/tstSharedFolderService.cpp
+++ b/src/VBox/HostServices/SharedFolders/testcase/tstSharedFolderService.cpp
@@ -1,6 +1,5 @@
/* $Id: tstSharedFolderService.cpp $ */
/** @file
- *
* Testcase for the shared folder service vbsf API.
*
* Note that this is still very threadbare (there is an awful lot which should
@@ -11,7 +10,7 @@
*/
/*
- * Copyright (C) 2011 Oracle Corporation
+ * Copyright (C) 2011-2013 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -39,17 +38,19 @@
#include "teststubs.h"
+
/******************************************************************************
* Global Variables *
******************************************************************************/
static RTTEST g_hTest = NIL_RTTEST;
+
/******************************************************************************
* Declarations *
******************************************************************************/
-
extern "C" DECLCALLBACK(DECLEXPORT(int)) VBoxHGCMSvcLoad (VBOXHGCMSVCFNTABLE *ptable);
+
/******************************************************************************
* Helpers *
******************************************************************************/
@@ -102,14 +103,15 @@ static void bufferFromPath(void *pvDest, size_t cb, const char *pcszSrc)
}
#define ARRAY_FROM_PATH(a, b) \
-do { \
- Assert((a) == (a)); /* Constant parameter */ \
- Assert(sizeof((a)) > 0); \
- bufferFromPath(a, sizeof(a), b); \
-} while(0)
+ do { \
+ Assert((a) == (a)); /* Constant parameter */ \
+ Assert(sizeof((a)) > 0); \
+ bufferFromPath(a, sizeof(a), b); \
+ } while (0)
+
/******************************************************************************
-* Stub functions *
+* Stub functions and data *
******************************************************************************/
static PRTDIR testRTDirClosepDir;
@@ -306,7 +308,7 @@ static uint64_t testRTFileSetFMode;
extern int testRTFileSetMode(RTFILE File, RTFMODE fMode)
{
/* RTPrintf("%s: fMode=%llu\n", __PRETTY_FUNCTION__, LLUIFY(fMode)); */
- testRTFileSetFMode = fMode;
+ testRTFileSetFMode = fMode;
return VINF_SUCCESS;
}
@@ -369,7 +371,7 @@ extern int testRTFileWrite(RTFILE File, const void *pvBuf, size_t cbToWrite,
*pcbWritten = strlen(testRTFileWriteData) + 1;
return VINF_SUCCESS;
}
-
+
extern int testRTFsQueryProperties(const char *pszFsPath,
PRTFSPROPERTIES pProperties)
{
@@ -383,7 +385,7 @@ extern int testRTFsQueryProperties(const char *pszFsPath,
extern int testRTFsQuerySerial(const char *pszFsPath, uint32_t *pu32Serial)
{ RTPrintf("%s\n", __PRETTY_FUNCTION__); return 0; }
extern int testRTFsQuerySizes(const char *pszFsPath, PRTFOFF pcbTotal,
- RTFOFF *pcbFree, uint32_t *pcbBlock,
+ RTFOFF *pcbFree, uint32_t *pcbBlock,
uint32_t *pcbSector) { RTPrintf("%s\n", __PRETTY_FUNCTION__); return 0; }
extern int testRTPathQueryInfoEx(const char *pszPath,
@@ -398,12 +400,13 @@ extern int testRTPathQueryInfoEx(const char *pszPath,
return VINF_SUCCESS;
}
-extern int testRTSymlinkDelete(const char *pszSymlink, uint32_t fDelete)
+extern int testRTSymlinkDelete(const char *pszSymlink, uint32_t fDelete)
{ RTPrintf("%s\n", __PRETTY_FUNCTION__); return 0; }
extern int testRTSymlinkRead(const char *pszSymlink, char *pszTarget,
size_t cbTarget, uint32_t fRead)
{ RTPrintf("%s\n", __PRETTY_FUNCTION__); return 0; }
+
/******************************************************************************
* Tests *
******************************************************************************/
@@ -484,13 +487,11 @@ struct TESTSHFLSTRING
static void fillTestShflString(struct TESTSHFLSTRING *pDest,
const char *pcszSource)
{
- unsigned i;
-
- AssertRelease( strlen(pcszSource) * 2 + 2 < sizeof(*pDest)
- - RT_UOFFSETOF(SHFLSTRING, String));
- pDest->string.u16Size = (uint16_t)strlen(pcszSource) * 2 + 2;
- pDest->string.u16Length = (uint16_t)strlen(pcszSource);
- for (i = 0; i < strlen(pcszSource) + 1; ++i)
+ AssertRelease( strlen(pcszSource) * 2 + 2
+ < sizeof(*pDest) - RT_UOFFSETOF(SHFLSTRING, String));
+ pDest->string.u16Length = (uint16_t)(strlen(pcszSource) * sizeof(RTUTF16));
+ pDest->string.u16Size = pDest->string.u16Length + sizeof(RTUTF16);
+ for (unsigned i = 0; i <= pDest->string.u16Length; ++i)
pDest->string.String.ucs2[i] = (uint16_t)pcszSource[i];
}
diff --git a/src/VBox/HostServices/SharedFolders/testcase/tstShflSizes.cpp b/src/VBox/HostServices/SharedFolders/testcase/tstShflSizes.cpp
index 96d27cfa..ce94fdb4 100644
--- a/src/VBox/HostServices/SharedFolders/testcase/tstShflSizes.cpp
+++ b/src/VBox/HostServices/SharedFolders/testcase/tstShflSizes.cpp
@@ -4,7 +4,7 @@
*/
/*
- * Copyright (C) 2006-2007 Oracle Corporation
+ * Copyright (C) 2006-2010 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;