Commit ee12046d authored by Dan Mihai's avatar Dan Mihai

Windows: Start building provisiontests

Change-Id: I7200fb8b61cb02f2be0b25e1a663c8ec456919f6
Signed-off-by: default avatarDan Mihai <Daniel.Mihai@microsoft.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/18781Reviewed-by: default avatarKevin Kane <kkane@microsoft.com>
Tested-by: default avatarjenkins-iotivity <jenkins@iotivity.org>
parent d484ec77
......@@ -45,27 +45,27 @@ namespace OCCloudProvisioningTest
TEST(RequestCertTest, TestNullCallback)
{
OCCloudProvisioning cloud(IP, PORT);
EXPECT_EQ(OC_STACK_INVALID_CALLBACK, cloud.requestCertificate(NULL));
EXPECT_EQ(OC_STACK_INVALID_CALLBACK, cloud.requestCertificate(nullptr));
}
TEST(AclIdByDeviceTest, AclIdNullCallback)
{
OCCloudProvisioning cloud(IP, PORT);
std::string devId("");
EXPECT_EQ(OC_STACK_INVALID_CALLBACK, cloud.getAclIdByDevice(devId, NULL));
EXPECT_EQ(OC_STACK_INVALID_CALLBACK, cloud.getAclIdByDevice(devId, nullptr));
}
TEST(AclInfoTest, AclInfoNullCallback)
{
OCCloudProvisioning cloud(IP, PORT);
std::string aclId("");
EXPECT_EQ(OC_STACK_INVALID_CALLBACK, cloud.getIndividualAclInfo(aclId, NULL));
EXPECT_EQ(OC_STACK_INVALID_CALLBACK, cloud.getIndividualAclInfo(aclId, nullptr));
}
TEST(GetCRLTest, GetCrlNullCallback)
{
OCCloudProvisioning cloud(IP, PORT);
EXPECT_EQ(OC_STACK_INVALID_CALLBACK, cloud.getCRL(NULL));
EXPECT_EQ(OC_STACK_INVALID_CALLBACK, cloud.getCRL(nullptr));
}
TEST(PostCRLTest, PostCrlNullCallback)
......@@ -77,6 +77,6 @@ namespace OCCloudProvisioningTest
OCCloudProvisioning cloud(IP, PORT);
EXPECT_EQ(OC_STACK_INVALID_CALLBACK, cloud.postCRL(thisUpdate,
nextUpdate,
&crl, &serials, NULL));
&crl, &serials, nullptr));
}
}
......@@ -137,20 +137,20 @@ namespace OCProvisioningTest
{
OCSecureResource device;
const OicSecOxm_t stsecOxm = OIC_PRECONFIG_PIN;
EXPECT_EQ(OC_STACK_INVALID_CALLBACK, device.selectMOTMethod(stsecOxm, NULL));
EXPECT_EQ(OC_STACK_INVALID_CALLBACK, device.selectMOTMethod(stsecOxm, nullptr));
}
TEST(changeMOTModeTest, changeMOTModeNullCallback)
{
OCSecureResource device;
const OicSecMomType_t momType = OIC_MULTIPLE_OWNER_ENABLE;
EXPECT_EQ(OC_STACK_INVALID_CALLBACK, device.changeMOTMode(momType, NULL));
EXPECT_EQ(OC_STACK_INVALID_CALLBACK, device.changeMOTMode(momType, nullptr));
}
TEST(addPreconfigPINTest, addPreconfigPINNullPin)
{
OCSecureResource device;
EXPECT_EQ(OC_STACK_INVALID_PARAM, device.addPreconfigPIN(NULL, 0));
EXPECT_EQ(OC_STACK_INVALID_PARAM, device.addPreconfigPIN(nullptr, 0));
}
TEST(provisionPreconfPinTest, provisionPreconfPinNullCallback)
......@@ -158,7 +158,7 @@ namespace OCProvisioningTest
OCSecureResource device;
const char *pin = "test";
size_t PinLength = 4;
EXPECT_EQ(OC_STACK_INVALID_CALLBACK, device.provisionPreconfPin(pin, PinLength, NULL));
EXPECT_EQ(OC_STACK_INVALID_CALLBACK, device.provisionPreconfPin(pin, PinLength, nullptr));
}
TEST(isMOTEnabledTest, isMOTEnabledWithoutDeviceInst)
......@@ -176,7 +176,7 @@ namespace OCProvisioningTest
TEST(getMOTMethodTest, getMOTMethodNullOxM)
{
OCSecureResource device;
EXPECT_EQ(OC_STACK_INVALID_PARAM, device.getMOTMethod(NULL));
EXPECT_EQ(OC_STACK_INVALID_PARAM, device.getMOTMethod(nullptr));
}
#endif
......
......@@ -35,64 +35,72 @@ with_ra_ibb = provisiontests_env.get('WITH_RA_IBB')
# Build flags
######################################################################
provisiontests_env.PrependUnique(CPPPATH = [
'../../include',
'../../oc_logger/include',
'../../csdk/include',
'../../csdk/stack/include',
'../../csdk/security/include',
'../../csdk/security/provisioning/include',
'../../csdk/security/provisioning/include/oxm',
'../../csdk/security/provisioning/include/internal',
'../../csdk/security/provisioning/include/cloud',
'../../csdk/stack/include/internal',
'../../csdk/connectivity/api',
'../../csdk/connectivity/inc/pkix',
'../../csdk/connectivity/external/inc',
'../../csdk/ocsocket/include',
'../../csdk/ocrandom/include',
'../../csdk/logger/include',
'../../csdk/connectivity/lib/libcoap-4.1.1/include',
'../../../extlibs/hippomocks/hippomocks/',
'../../../extlibs/hippomocks/hippomocks/'
])
'../../include',
'../../oc_logger/include',
'../../csdk/include',
'../../csdk/stack/include',
'../../csdk/security/include',
'../../csdk/security/provisioning/include',
'../../csdk/security/provisioning/include/oxm',
'../../csdk/security/provisioning/include/internal',
'../../csdk/security/provisioning/include/cloud',
'../../csdk/stack/include/internal',
'../../csdk/connectivity/api',
'../../csdk/connectivity/inc/pkix',
'../../csdk/connectivity/external/inc',
'../../csdk/ocsocket/include',
'../../csdk/ocrandom/include',
'../../csdk/logger/include',
'../../csdk/connectivity/lib/libcoap-4.1.1/include',
'../../../extlibs/hippomocks/hippomocks/',
'../../../extlibs/hippomocks/hippomocks/'
])
if target_os in ['windows']:
# Non-Windows platforms find the boost headers under /usr/include or similar path.
provisiontests_env.AppendUnique(CPPPATH = ['#extlibs/boost/boost'])
provisiontests_env.AppendUnique(LIBS = ['sqlite3'])
elif target_os in ['tizen', 'linux']:
provisiontests_env.ParseConfig('pkg-config --cflags --libs sqlite3')
provisiontests_env.PrependUnique(LIBS = [
'ocprovision',
'oc',
'ocpmapi',
'octbstack_test',
'oc_logger',
'connectivity_abstraction',
'coap'
])
'oc',
'ocpmapi_internal',
'octbstack_test',
'oc_logger_internal',
'connectivity_abstraction',
'coap',
'ocsrm'
])
if with_ra_ibb:
provisiontests_env.AppendUnique(LIBS = provisiontests_env['RALIBS'], LIBPATH = provisiontests_env['RALIBPATH'], RPATH = provisiontests_env['RARPATH'])
print "RALIBS = %s" % provisiontests_env['RALIBS']
print "RALIBPATH = %s" % provisiontests_env['RALIBPATH']
print "RARPATH = %s" % provisiontests_env['RARPATH']
provisiontests_env.AppendUnique(LIBS = provisiontests_env['RALIBS'], LIBPATH = provisiontests_env['RALIBPATH'], RPATH = provisiontests_env['RARPATH'])
print "RALIBS = %s" % provisiontests_env['RALIBS']
print "RALIBPATH = %s" % provisiontests_env['RALIBPATH']
print "RARPATH = %s" % provisiontests_env['RARPATH']
else :
if with_ra:
provisiontests_env.AppendUnique(LIBS = ['ra_xmpp'])
if with_ra:
provisiontests_env.AppendUnique(LIBS = ['ra_xmpp'])
if provisiontests_env.get('SECURED') == '1':
provisiontests_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509','mbedcrypto'])
provisiontests_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509','mbedcrypto'])
if provisiontests_env.get('LOGGING'):
provisiontests_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
provisiontests_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
######################################################################
# Source files and Targets
######################################################################
ocprovisiontest_src = [
'OCProvisioningTest.cpp'
]
'OCProvisioningTest.cpp'
]
if provisiontests_env.get('WITH_TCP') == True:
ocprovisiontest_src = ocprovisiontest_src + [
'OCCloudProvisioningTest.cpp'
]
ocprovisiontest_src = ocprovisiontest_src + [
'OCCloudProvisioningTest.cpp'
]
unittests = provisiontests_env.Program('provisiontests', ocprovisiontest_src)
......@@ -100,17 +108,18 @@ Alias("provisiontests", [unittests])
provisiontests_env.AppendTarget('provisiontests')
if provisiontests_env.get('TEST') == '1':
if target_os in ['linux']:
out_dir = provisiontests_env.get('BUILD_DIR')
result_dir = os.path.join(provisiontests_env.get('BUILD_DIR'), 'test_out') + os.sep
if not os.path.isdir(result_dir):
os.makedirs(result_dir)
provisiontests_env.AppendENVPath('GTEST_OUTPUT', ['xml:'+ result_dir])
provisiontests_env.AppendENVPath('LD_LIBRARY_PATH', [out_dir])
run_test(provisiontests_env,
'resource/provisioning/unittests/provisiontests.memcheck',
'resource/provisioning/unittests/provisiontests',
unittests)
# Workaround for IOT-2038: don't run this test on Windows yet, because Jenkins times out.
if target_os in ['linux']:
out_dir = provisiontests_env.get('BUILD_DIR')
result_dir = os.path.join(provisiontests_env.get('BUILD_DIR'), 'test_out') + os.sep
if not os.path.isdir(result_dir):
os.makedirs(result_dir)
provisiontests_env.AppendENVPath('GTEST_OUTPUT', ['xml:'+ result_dir])
provisiontests_env.AppendENVPath('LD_LIBRARY_PATH', [out_dir])
run_test(provisiontests_env,
'resource/provisioning/unittests/provisiontests.memcheck',
'resource/provisioning/unittests/provisiontests',
unittests)
src_dir = provisiontests_env.get('SRC_DIR')
svr_db_src_dir = src_dir + '/resource/provisioning/examples/'
......
......@@ -44,8 +44,7 @@ if target_os in ['linux', 'windows', 'darwin', 'msys_nt']:
SConscript('unittests/SConscript', 'test_env')
# Build Security Resource Manager and Provisioning API unit test
# TODO: Enable provisioning and associated unit tests for Windows
if (env.get('SECURED') == '1') and (target_os != 'windows'):
if env.get('SECURED') == '1':
SConscript('provisioning/unittests/SConscript', 'test_env')
if target_os in ['windows']:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment