Windows: Start building provisiontests 81/18781/9
authorDan Mihai <Daniel.Mihai@microsoft.com>
Wed, 12 Apr 2017 01:08:17 +0000 (18:08 -0700)
committerDan Mihai <Daniel.Mihai@microsoft.com>
Tue, 18 Apr 2017 22:18:44 +0000 (22:18 +0000)
Change-Id: I7200fb8b61cb02f2be0b25e1a663c8ec456919f6
Signed-off-by: Dan Mihai <Daniel.Mihai@microsoft.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/18781
Reviewed-by: Kevin Kane <kkane@microsoft.com>
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
resource/provisioning/unittests/OCCloudProvisioningTest.cpp
resource/provisioning/unittests/OCProvisioningTest.cpp
resource/provisioning/unittests/SConscript
resource/unit_tests.scons

index d459277..4362acd 100755 (executable)
@@ -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));
     }
 }
index 09086a1..b16bd20 100644 (file)
@@ -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
 
index 7f7a139..48011b0 100755 (executable)
@@ -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/'
index 02ffff6..b42b454 100644 (file)
@@ -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']: