Enable GCOV Coverage & Logging in UT. (#628) 95/221595/1
authorsenthil.gs@samsung.com <senthil.gs@samsung.com>
Thu, 28 Nov 2019 06:47:49 +0000 (12:17 +0530)
committerSudipto Bal <sudipto.bal@samsung.com>
Mon, 6 Jan 2020 05:42:27 +0000 (05:42 +0000)
https://github.sec.samsung.net/RS7-IOTIVITY/IoTivity/commit/41f3f11cfcbec2eb7a252efcde8d92746bcac327
(cherry-picked from 41f3f11cfcbec2eb7a252efcde8d92746bcac327)

Change-Id: I8a0fc10913d1eff4c2012357112b979d028c74ec
Signed-off-by: Senthil Kumar G S <senthil.gs@samsung.com>
Signed-off-by: Sudipto <sudipto.bal@samsung.com>
auto_build.py
resource/c_common/SConscript
resource/csdk/SConscript
resource/csdk/connectivity/src/SConscript
resource/csdk/logger/SConscript
resource/src/SConscript
tools/generate_report.sh

index 4c1330e..d40bf2f 100644 (file)
@@ -384,12 +384,13 @@ def unit_tests():
     print ("*********** Unit test Start *************")
     build_options = {
                         'RELEASE':'false',
+                        'LOGGING':'true'
                     }
     extra_option_str = "resource -c"
     call_scons(build_options, extra_option_str)
 
     build_options = {
-                        'LOGGING':'false',
+                        'LOGGING':'true',
                         'RELEASE':'false',
                     }
     extra_option_str = "resource"
@@ -398,12 +399,14 @@ def unit_tests():
     build_options = {
                         'TEST':1,
                         'RELEASE':'false',
+                        'LOGGING':'true',
                     }
     call_scons(build_options, extra_option_str)
     build_options = {
                         'TEST':1,
                         'SECURED':1,
                         'RELEASE':'false',
+                        'LOGGING':'true',
                     }
     call_scons(build_options, extra_option_str)
 
index c023903..2228cfe 100755 (executable)
@@ -135,6 +135,10 @@ env.UserInstallTargetHeader(config_h_file_path, 'c_common', 'iotivity_config.h')
 # Use the generated file internally
 env.AppendUnique(CPPPATH = [os.path.join(src_dir, 'resource', 'c_common')])
 
+if not env.get('RELEASE'):
+    env.PrependUnique(LIBS = ['gcov'])
+    env.AppendUnique(CCFLAGS = ['--coverage'])
+
 ######################################################################
 
 ######################################################################
index f12a87a..6bc1eff 100644 (file)
@@ -195,6 +195,10 @@ if with_tcp == True:
        liboctbstack_src.append(OCTBSTACK_SRC + 'oickeepalive.c')
        liboctbstack_env.UserInstallTargetHeader('stack/include/oickeepalive.h', 'resource', 'oickeepalive.h')
 
+if not env.get('RELEASE'):
+    liboctbstack_env.PrependUnique(LIBS = ['gcov'])
+    liboctbstack_env.AppendUnique(CCFLAGS = ['--coverage'])
+
 if 'SERVER' in rd_mode:
     liboctbstack_src.append(OCTBSTACK_SRC + 'oicresourcedirectory.c')
     if target_os not in ['tizen']:
index 0beba71..12e39e9 100644 (file)
@@ -51,6 +51,10 @@ if ca_os not in ['darwin', 'ios', 'windows']:
 if ca_os in ['darwin','ios']:
        env.AppendUnique(CPPDEFINES = ['_DARWIN_C_SOURCE'])
 
+if not env.get('RELEASE'):
+    env.PrependUnique(LIBS = ['gcov'])
+    env.AppendUnique(CCFLAGS = ['--coverage'])
+
 # Getting common source files
 env.SConscript(os.path.join(root_dir, 'common', 'SConscript'))
 
index e3ae6b8..372562e 100644 (file)
@@ -16,6 +16,10 @@ else:
 if env.get('OIC_SUPPORT_TIZEN_TRACE') == 'True':
     env.AppendUnique(CPPDEFINES = ['OIC_SUPPORT_TIZEN_TRACE'])
 
+if not env.get('RELEASE'):
+    env.PrependUnique(LIBS = ['gcov'])
+    env.AppendUnique(CCFLAGS = ['--coverage'])
+
 env.PrependUnique(LIBS = ['logger'])
 
 local_env = env.Clone()
index 79900ae..70e26f0 100644 (file)
@@ -60,6 +60,10 @@ oclib_env.AppendUnique(LIBPATH = [oclib_env.get('BUILD_DIR')])
 oclib_env.AppendUnique(LIBS = ['oc_logger'])
 oclib_env.PrependUnique(LIBS = ['octbstack', 'connectivity_abstraction', 'ocsrm'])
 
+if not oclib_env.get('RELEASE'):
+    oclib_env.PrependUnique(LIBS = ['gcov'])
+    oclib_env.AppendUnique(CCFLAGS = ['--coverage'])
+
 if 'g++' in oclib_env.get('CXX'):
        oclib_env.AppendUnique(CXXFLAGS = ['-std=c++0x'])
        oclib_env.AppendUnique(CXXFLAGS = ['-Wall'])
index 9d3f533..fbe4961 100644 (file)
@@ -200,6 +200,13 @@ generate_report_CA()
 
     tests_list=(
                 "${IOTIVITY_BASE}/out/${IOTIVITY_TARGET_OS}/${IOTIVITY_TARGET_ARCH}/debug/resource/csdk/connectivity/test/catests"
+                "${IOTIVITY_BASE}/out/${IOTIVITY_TARGET_OS}/${IOTIVITY_TARGET_ARCH}/debug/resource/csdk/stack/test/stacktests"
+                "${IOTIVITY_BASE}/out/${IOTIVITY_TARGET_OS}/${IOTIVITY_TARGET_ARCH}/debug/resource/csdk/stack/test/cbortests"
+                "${IOTIVITY_BASE}/out/${IOTIVITY_TARGET_OS}/${IOTIVITY_TARGET_ARCH}/debug/resource/unittests/unittests"
+                "${IOTIVITY_BASE}/out/${IOTIVITY_TARGET_OS}/${IOTIVITY_TARGET_ARCH}/debug/resource/c_common/ocrandom/test/randomtests"
+                "${IOTIVITY_BASE}/out/${IOTIVITY_TARGET_OS}/${IOTIVITY_TARGET_ARCH}/debug/resource/c_common/oic_malloc/test/malloctests"
+                "${IOTIVITY_BASE}/out/${IOTIVITY_TARGET_OS}/${IOTIVITY_TARGET_ARCH}/debug/resource/c_common/oic_string/test/stringtests"
+                "${IOTIVITY_BASE}/out/${IOTIVITY_TARGET_OS}/${IOTIVITY_TARGET_ARCH}/debug/resource/c_common/oic_time/test/timetests"
                );
 
     for exe in ${tests_list[@]}; do
@@ -472,8 +479,7 @@ generate_report_RE()
 
     tests_list=(
                 "${IOTIVITY_BASE}/out/${IOTIVITY_TARGET_OS}/${IOTIVITY_TARGET_ARCH}/debug/service/resource-encapsulation/src/serverBuilder/rcs_server_test"
-                "${IOTIVITY_BASE}/out/${IOTIVITY_TARGET_OS}/${IOTIVITY_TARGET_ARCH}/debug/service/resource-encapsulation/unittests/rcs_client_test"
-                "${IOTIVITY_BASE}/out/${IOTIVITY_TARGET_OS}/${IOTIVITY_TARGET_ARCH}/debug/service/resource-encapsulation/src/common/primitiveResource/unittests/rcs_common_test"
+                "${IOTIVITY_BASE}/out/${IOTIVITY_TARGET_OS}/${IOTIVITY_TARGET_ARCH}/debug/service/resource-encapsulation/src/common/rcs_common_test"
                 "${IOTIVITY_BASE}/out/${IOTIVITY_TARGET_OS}/${IOTIVITY_TARGET_ARCH}/debug/service/resource-encapsulation/src/resourceCache/unittests/cache_test"
                 "${IOTIVITY_BASE}/out/${IOTIVITY_TARGET_OS}/${IOTIVITY_TARGET_ARCH}/debug/service/resource-encapsulation/src/resourceBroker/unittest/broker_test"
                );