gtest_env.AppendUnique(CXXFLAGS = ['-pthread'])
gtest_env.PrependUnique(LIBS = ['pthread'])
gtest_env.PrependUnique(LIBS = ['gtest', 'gtest_main'])
+ if target_os in ['windows']:
+ gtest_env.AppendUnique(LINKFLAGS = ['/subsystem:CONSOLE'])
Return('gtest_env')
target_os = env.get('TARGET_OS')
src_dir = env.get('SRC_DIR')
-# Only verify/install on linux
-if target_os in ['linux']:
+if target_os in ['linux', 'windows']:
print '*** Checking for installation of hippomocks ***'
hippomocks_sha = '8e210c5808d490b26fff69151c801fa28d291fcb'
randomtest_env.AppendTarget('test')
if randomtest_env.get('TEST') == '1':
- if target_os in ['linux']:
+ if target_os in ['linux', 'windows']:
from tools.scons.RunTest import *
run_test(randomtest_env,
'resource_csdk_random_test.memcheck',
malloctest_env.AppendTarget('test')
if malloctest_env.get('TEST') == '1':
- if target_os in ['linux']:
+ if target_os in ['linux', 'windows']:
from tools.scons.RunTest import *
run_test(malloctest_env,
'resource_ccommon_malloc_test.memcheck',
//
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+#include "iotivity_config.h"
extern "C" {
#include "oic_malloc.h"
#include <sys/stat.h>
#include <errno.h>
#include <fcntl.h>
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <stdlib.h>
#include <stdint.h>
stringtest_env.AppendTarget('test')
if stringtest_env.get('TEST') == '1':
- if target_os in ['linux']:
+ if target_os in ['linux', 'windows']:
from tools.scons.RunTest import *
run_test(stringtest_env,
'resource_ccommon_string_test.memcheck',
// tests a copy where the destination is of length 0
TEST(StringTests, StrcpyZeroDestination)
{
- char target[0];
+ char target[1] = { (char)0xde };
char source[] = "123456789";
+ char beforeValue = target[0];
- char *result = OICStrcpy(target, sizeof(target), source);
+ char *result = OICStrcpy(target, 0, source);
+ char afterValue = target[0];
EXPECT_EQ(target, result);
+ EXPECT_EQ(beforeValue, afterValue);
}
// tests a copy where the destination is of length 0
// Tests a cat where the Destination is zero length
TEST(StringTests, StrcatZeroDestination)
{
- char target[0];
+ char target[1] = { (char)0xde };
char source[] = "12345";
+ char beforeValue = target[0];
- char *result = OICStrcat(target, sizeof(target), source);
+ char *result = OICStrcat(target, 0, source);
+
+ char afterValue = target[0];
EXPECT_EQ(target, result);
+ EXPECT_EQ(beforeValue, afterValue);
}
// Tests a cat where the Destination is zero length
timetest_env.AppendUnique(LIBPATH = [os.path.join(timetest_env.get('BUILD_DIR'), 'resource', 'c_common')])
timetest_env.PrependUnique(LIBS = ['c_common'])
-timetest_env.Append(LIBS = ['rt']);
if timetest_env.get('LOGGING'):
timetest_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
timetest_env.AppendTarget('test')
if timetest_env.get('TEST') == '1':
- if target_os in ['linux']:
+ if target_os in ['linux', 'windows']:
from tools.scons.RunTest import *
run_test(timetest_env,
'resource_ccommon_time_test.memcheck',
catest_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
if target_os in ['msys_nt', 'windows']:
- catest_env.AppendUnique(LINKFLAGS = ['/subsystem:CONSOLE'])
catest_env.AppendUnique(LIBS = ['ws2_32',
'advapi32',
'iphlpapi'])
OCCreateResource
OCDeleteResource
OCDiscoverDirectPairingDevices
+OCDiscoveryPayloadCreate
+OCDiscoveryPayloadDestroy
+OCDiscoveryPayloadGetResourceCount
OCDoDirectPairing
OCDoResource
OCDoResponse
OCNotifyAllObservers
OCNotifyListOfObservers
OCPayloadDestroy
+OCPlatformPayloadCreate
+OCPresencePayloadCreate
OCProcess
OCRDDelete
OCRDDeleteWithDeviceId
sptest_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
if target_os in ['msys_nt', 'windows']:
- sptest_env.AppendUnique(LINKFLAGS = ['/subsystem:CONSOLE'])
sptest_env.AppendUnique(LIBS = ['ws2_32',
'advapi32',
'iphlpapi'])
srmtest_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
if target_os == 'windows':
- srmtest_env.AppendUnique(LINKFLAGS = ['/subsystem:CONSOLE'])
srmtest_env.AppendUnique(LIBS = ['advapi32', 'kernel32', 'ws2_32', 'iphlpapi'])
else:
# TODO: Implement feature check.
stacktest_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
if target_os in ['msys_nt', 'windows']:
- stacktest_env.AppendUnique(LINKFLAGS = ['/subsystem:CONSOLE'])
stacktest_env.AppendUnique(LIBS = ['ws2_32', 'iphlpapi', 'kernel32'])
else:
stacktest_env.PrependUnique(LIBS = ['m'])
#include "OCApi.h"
#if defined(_MSC_VER)
+
+#include <iostream>
+
namespace OC
{
std::ostream& oclog()
src_dir = env.get('SRC_DIR')
build_dir = env.get('BUILD_DIR')
-if target_os in ['linux']:
+if target_os in ['linux', 'windows']:
# Verify that 'google unit test' library is installed. If not,
# get it and install it
SConscript('#extlibs/gtest/SConscript')
# Build Provisioning API unit test
if env.get('SECURED') == '1':
SConscript('csdk/security/provisioning/unittest/SConscript')
- SConscript('provisioning/unittests/SConscript')
-
-elif target_os == 'windows' and env.get('TEST') == '1':
- # Verify that 'google unit test' library is installed. If not,
- # get it and install it
- SConscript('#extlibs/gtest/SConscript')
-
- # Build C stack's unit tests.
- SConscript('csdk/stack/test/SConscript')
- SConscript('csdk/connectivity/test/SConscript')
-
- # Build Security Resource Manager unit tests
- if env.get('SECURED') == '1':
- SConscript('csdk/security/unittest/SConscript')
-
- # Build Provisioning API unit test
- if env.get('SECURED') == '1':
- SConscript('csdk/security/provisioning/unittest/SConscript')
+ # TODO: Enable provisioning and associated unit tests for Windows
+ if target_os != 'windows':
+ SConscript('provisioning/unittests/SConscript')
elif target_os in ['darwin', 'msys_nt']:
# Verify that 'google unit test' library is installed. If not,
rep[AttrName] = nullptr;
EXPECT_TRUE(rep.isNULL(AttrName));
+// @todo: Re-enable this part of the unit test. MSVC can't assign to nullptr_t.
+#ifndef _MSC_VER
std::nullptr_t repout = rep[AttrName];
std::nullptr_t repout2;
repout2 = rep[AttrName];
EXPECT_EQ(nullptr, repout);
EXPECT_EQ(nullptr, repout2);
+#endif
double badout;
EXPECT_FALSE(rep.getValue<double>(AttrName, badout));
EXPECT_EQ(NULL, response.getRequestHandle());
}
+#ifdef _MSC_VER
+ TEST(ResourceHandleTest, DISABLED_SetGetResourceHandleValidHandle)
+#else
TEST(ResourceHandleTest, SetGetResourceHandleValidHandle)
+#endif
{
OCResourceResponse response;
OCResourceHandle resHandle;
'#extlibs/hippomocks-master/HippoMocksTest'
])
+if target_os in ['windows']:
+ unittests_env.AppendUnique(LIBS = ['ws2_32'])
+ unittests_env.AppendUnique(CPPPATH = ['#extlibs/boost/boost'])
+
unittests_env.AppendUnique(LIBPATH = [unittests_env.get('BUILD_DIR')])
unittests_env.PrependUnique(LIBS = [
'oc',
'OCHeaderOptionTest.cpp'
]
+# TODO: Fix errors in the following Windows tests.
+if target_os in ['windows']:
+ unittests_src.remove('OCPlatformTest.cpp')
+ unittests_src.remove('OCRepresentationEncodingTest.cpp')
+ if '12.0' == unittests_env['MSVC_VERSION']:
+ unittests_src.remove('OCRepresentationTest.cpp')
+ unittests_src.remove('OCResourceTest.cpp')
+
if (('SUB' in with_mq) or ('PUB' in with_mq) or ('BROKER' in with_mq)):
unittests_src = unittests_src + ['OCMQResourceTest.cpp']
unittests_env.AppendTarget('unittests')
if unittests_env.get('TEST') == '1':
- if target_os in ['linux']:
+ if target_os in ['windows']:
+ unittests_env.AppendENVPath('PATH', unittests_env.get('BUILD_DIR'))
+ if target_os in ['linux', 'windows']:
from tools.scons.RunTest import *
run_test(unittests_env,
'resource_unittests_unittests.memcheck',
%DEBUG% %BUILD_DIR%\resource\csdk\stack\test\cbortests.exe
%DEBUG% %BUILD_DIR%\resource\csdk\security\unittest\unittest.exe
%DEBUG% %BUILD_DIR%\resource\csdk\security\provisioning\unittest\unittest.exe
+ %DEBUG% %BUILD_DIR%\resource\c_common\ocrandom\test\randomtests.exe
+ %DEBUG% %BUILD_DIR%\resource\c_common\oic_malloc\test\malloctests.exe
+ %DEBUG% %BUILD_DIR%\resource\c_common\oic_string\test\stringtests.exe
+ %DEBUG% %BUILD_DIR%\resource\c_common\oic_time\test\timetests.exe
+ %DEBUG% %BUILD_DIR%\resource\unittests\unittests.exe
) else if "!CURRENT_ARG!"=="build" (
echo Starting IoTivity build with these options:
echo TARGET_OS=%TARGET_OS%