From: senthil.gs@samsung.com Date: Thu, 28 Nov 2019 06:47:49 +0000 (+0530) Subject: Enable GCOV Coverage & Logging in UT. (#628) X-Git-Tag: submit/tizen_5.5/20200121.084903~11^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fac672608f0e694aefdb149a6fd5a0ef08aee484;p=platform%2Fupstream%2Fiotivity.git Enable GCOV Coverage & Logging in UT. (#628) https://github.sec.samsung.net/RS7-IOTIVITY/IoTivity/commit/41f3f11cfcbec2eb7a252efcde8d92746bcac327 (cherry-picked from 41f3f11cfcbec2eb7a252efcde8d92746bcac327) Change-Id: I8a0fc10913d1eff4c2012357112b979d028c74ec Signed-off-by: Senthil Kumar G S Signed-off-by: Sudipto --- diff --git a/auto_build.py b/auto_build.py index 4c1330e..d40bf2f 100644 --- a/auto_build.py +++ b/auto_build.py @@ -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) diff --git a/resource/c_common/SConscript b/resource/c_common/SConscript index c023903..2228cfe 100755 --- a/resource/c_common/SConscript +++ b/resource/c_common/SConscript @@ -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']) + ###################################################################### ###################################################################### diff --git a/resource/csdk/SConscript b/resource/csdk/SConscript index f12a87a..6bc1eff 100644 --- a/resource/csdk/SConscript +++ b/resource/csdk/SConscript @@ -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']: diff --git a/resource/csdk/connectivity/src/SConscript b/resource/csdk/connectivity/src/SConscript index 0beba71..12e39e9 100644 --- a/resource/csdk/connectivity/src/SConscript +++ b/resource/csdk/connectivity/src/SConscript @@ -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')) diff --git a/resource/csdk/logger/SConscript b/resource/csdk/logger/SConscript index e3ae6b8..372562e 100644 --- a/resource/csdk/logger/SConscript +++ b/resource/csdk/logger/SConscript @@ -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() diff --git a/resource/src/SConscript b/resource/src/SConscript index 79900ae..70e26f0 100644 --- a/resource/src/SConscript +++ b/resource/src/SConscript @@ -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']) diff --git a/tools/generate_report.sh b/tools/generate_report.sh index 9d3f533..fbe4961 100644 --- a/tools/generate_report.sh +++ b/tools/generate_report.sh @@ -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" );