Add gcov build environment 39/188739/1
authorSeokHoon Lee <andy.shlee@samsung.com>
Mon, 10 Sep 2018 03:04:09 +0000 (12:04 +0900)
committerSeokHoon Lee <andy.shlee@samsung.com>
Mon, 10 Sep 2018 03:04:43 +0000 (12:04 +0900)
- Add define gcov for coverage test
- build command --define "gcov 1" can enable this feature

Signed-off-by: SeokHoon Lee <andy.shlee@samsung.com>
Change-Id: Ibbdf9111efb0625727da11d64fbb2bc7e8261369

CMakeLists.txt
packaging/capi-media-streamrecorder.spec

index cdf2b4a..1876fec 100644 (file)
@@ -53,6 +53,10 @@ ADD_DEFINITIONS("-DTIZEN_DEBUG")
 
 SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=${LIB_INSTALL_DIR}")
 
+IF(BUILD_GCOV)
+       ADD_DEFINITIONS("-DTIZEN_TEST_GCOV")
+ENDIF(BUILD_GCOV)
+
 aux_source_directory(src SOURCES)
 ADD_LIBRARY(${fw_name} SHARED ${SOURCES})
 
index fe9a241..ec8acc9 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-streamrecorder
 Summary:    A Streamrecorder library in Tizen Native API
-Version:    0.0.20
+Version:    0.0.21
 Release:    0
 Group:      Multimedia/Other
 License:    Apache-2.0
@@ -13,6 +13,9 @@ BuildRequires:  pkgconfig(capi-media-tool)
 BuildRequires:  pkgconfig(libtbm)
 Requires(post): /sbin/ldconfig
 Requires(postun): /sbin/ldconfig
+%if 0%{?gcov:1}
+BuildRequires: lcov
+%endif
 
 %description
 A StreamRecorder library in Tizen Native API to record live buffer sent by the application
@@ -32,8 +35,16 @@ A MediaStreamRecorder library in Tizen Native API Development Package to record
 
 
 %build
+%if 0%{?gcov:1}
+export CFLAGS+=" -fprofile-arcs -ftest-coverage"
+export CXXFLAGS+=" -fprofile-arcs -ftest-coverage"
+export FFLAGS+=" -fprofile-arcs -ftest-coverage"
+export LDFLAGS+=" -lgcov"
+%endif
+
 MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
-%cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DFULLVER=%{version} -DMAJORVER=${MAJORVER}
+%cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DFULLVER=%{version} -DMAJORVER=${MAJORVER} \
+       -DBUILD_GCOV=%{?gcov:1}%{!?gcov:0}
 
 
 make %{?jobs:-j%jobs}