Add and run CSDK provisioning unit tests
authorDavid Antler <david.a.antler@intel.com>
Mon, 6 Jun 2016 17:48:42 +0000 (10:48 -0700)
committerDavid Antler <david.a.antler@intel.com>
Tue, 7 Jun 2016 22:19:23 +0000 (22:19 +0000)
Change-Id: Id328851efa68b1167c27d8fb3270aab2d5db82d7
Signed-off-by: David Antler <david.a.antler@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/8499
Reviewed-by: Dave Thaler <dthaler@microsoft.com>
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
resource/csdk/security/provisioning/unittest/SConscript
resource/unit_tests.scons
run.bat

index ee406d5..14605cf 100644 (file)
@@ -25,6 +25,7 @@ import os.path
 sptest_env = env.Clone()
 
 src_dir = sptest_env.get('SRC_DIR')
+target_os = env.get('TARGET_OS')
 
 ######################################################################
 # Build flags
@@ -58,6 +59,7 @@ sptest_env.PrependUnique(LIBS = [   'ocpmapi',
                                     'gtest_main'])
 
 if env.get('SECURED') == '1':
+    sptest_env.AppendUnique(LIBS = ['timer'])
     sptest_env.AppendUnique(LIBS = ['tinydtls'])
 if env.get('DTLS_WITH_X509') == '1':
        sptest_env.AppendUnique(LIBS = ['CKManager'])
@@ -66,6 +68,12 @@ if env.get('DTLS_WITH_X509') == '1':
 if not env.get('RELEASE'):
        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'])
+
 ######################################################################
 # Source files and Targets
 ######################################################################
@@ -78,7 +86,6 @@ Alias("test", [unittest])
 
 env.AppendTarget('test')
 if env.get('TEST') == '1':
-       target_os = env.get('TARGET_OS')
        if target_os == 'linux':
                out_dir = env.get('BUILD_DIR')
                result_dir = env.get('BUILD_DIR') + '/test_out/'
@@ -86,6 +93,7 @@ if env.get('TEST') == '1':
                        os.makedirs(result_dir)
                sptest_env.AppendENVPath('GTEST_OUTPUT', ['xml:'+ result_dir])
                sptest_env.AppendENVPath('LD_LIBRARY_PATH', [out_dir])
+               sptest_env.AppendENVPath('PATH', env.get('BUILD_DIR'))
                sptest_env.AppendENVPath('LD_LIBRARY_PATH', ['./extlibs/gtest/gtest-1.7.0/lib/.libs'])
                ut = sptest_env.Command ('ut', None, out_dir + '/resource/csdk/security/provisioning/unittest/unittest')
                AlwaysBuild ('ut')
index b4be2de..50a38cc 100644 (file)
@@ -72,6 +72,10 @@ elif target_os == 'windows' and env.get('TEST') == '1':
        # Build Security Resource Manager unit tests
        SConscript('csdk/security/unittest/SConscript')
 
+       # Build Provisioning API unit test
+       if env.get('SECURED') == '1':
+               SConscript('csdk/security/provisioning/unittest/SConscript')
+
 elif target_os in ['darwin', 'msys_nt']:
        # Verify that 'google unit test' library is installed.  If not,
        # get it and install it
diff --git a/run.bat b/run.bat
index 2714376..5a97d6f 100644 (file)
--- a/run.bat
+++ b/run.bat
@@ -77,6 +77,7 @@ if "!CURRENT_ARG!"=="server" (
   %DEBUG% %BUILD_DIR%\resource\csdk\stack\test\stacktests.exe
   %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
 ) else if "!CURRENT_ARG!"=="build" (
   echo Starting IoTivity build with these options:
   echo   TARGET_OS=%TARGET_OS%