[RE]Fixed Unit test cases for SECURED=1 and TEST=0 flag.
authorJay Sharma <jay.sharma@samsung.com>
Tue, 25 Apr 2017 03:10:20 +0000 (08:40 +0530)
committerUze Choi <uzchoi@samsung.com>
Thu, 27 Apr 2017 12:29:08 +0000 (12:29 +0000)
Bug:https://jira.iotivity.org/browse/IOT-2091
Change-Id: Ie121edeea0e824313a2bc9de906420af12d22055
Signed-off-by: Jay Sharma <jay.sharma@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/19231
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Phil Coval <philippe.coval@osg.samsung.com>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
service/resource-encapsulation/unittests/DiscoveryManagerTest.cpp
service/resource-encapsulation/unittests/SConscript

index 346d30a..e158db2 100644 (file)
@@ -47,11 +47,15 @@ static FILE* client_open(const char * path, const char *mode)
 {
     if (0 == strcmp(path, OC_SECURITY_DB_DAT_FILE_NAME))
     {
-        std::string file_name = SVR_DB_FILE_NAME;
 #ifndef LOCAL_RUNNING
-        file_name = "./service/resource-encapsulation/unittests/oic_svr_db_re_client.dat";
+        std::string file_name =
+            "./service/resource-encapsulation/unittests/oic_svr_db_re_client.dat";
+        if (0 == access(file_name.c_str(), F_OK))
+        {
+            return fopen(file_name.c_str(), mode);
+        }
 #endif
-        return fopen(file_name.c_str(), mode);
+        return fopen(SVR_DB_FILE_NAME, mode);
     }
     return fopen(path, mode);
 }
index baf9450..dffcd80 100644 (file)
@@ -100,11 +100,12 @@ if rcs_test_env.get('TEST') == '1':
                  'service/resource-encapsulation/unittests/rcs_client_test')
 else:
     rcs_test_env.AppendUnique(CPPDEFINES = ['LOCAL_RUNNING'])
-    if lib_env.get('SECURED') == '1':
-        src_dir = rcs_test_env.get('SRC_DIR')
-        svr_db_src_dir = os.path.join(src_dir, 'service/resource-encapsulation/unittests/')
-        svr_db_build_dir = os.path.join(rcs_test_env.get('BUILD_DIR'), 'service', 'resource-encapsulation', 'unittests') + os.sep
-        rcs_test_env.Alias("install",
-            rcs_test_env.Install(svr_db_build_dir,
-                  os.path.join(svr_db_src_dir,
-                               'oic_svr_db_re_client.dat')))
+
+if lib_env.get('SECURED') == '1':
+    src_dir = rcs_test_env.get('SRC_DIR')
+    svr_db_src_dir = os.path.join(src_dir, 'service/resource-encapsulation/unittests/')
+    svr_db_build_dir = os.path.join(rcs_test_env.get('BUILD_DIR'), 'service', 'resource-encapsulation', 'unittests') + os.sep
+    rcs_test_env.Alias("install",
+        rcs_test_env.Install(svr_db_build_dir,
+              os.path.join(svr_db_src_dir,
+                           'oic_svr_db_re_client.dat')))
\ No newline at end of file