Make gcov package 40/208740/1 accepted/tizen/unified/20190708.052540 submit/tizen/20190705.014328
authorKichan Kwon <k_c.kwon@samsung.com>
Fri, 28 Jun 2019 00:54:21 +0000 (09:54 +0900)
committerKichan Kwon <k_c.kwon@samsung.com>
Fri, 28 Jun 2019 00:54:21 +0000 (09:54 +0900)
- To make, use "gcov" build option

Change-Id: I640223f4f0fbdc86ad4f8707833292f66f64145f
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
CMakeLists.txt
packaging/capi-system-runtime-info.spec

index 653911a1ff17b735f13c7091e993dd6d4d1a0040..ccd525b0c680bad9b6c4179095b9984c021485ad 100755 (executable)
@@ -20,6 +20,9 @@ FOREACH(flag ${${fw_name}_CFLAGS})
 ENDFOREACH(flag)
 
 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror -fvisibility=hidden")
+IF("${GCOV}" STREQUAL "1")
+       SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage")
+ENDIF()
 SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
 
 IF("${ARCH}" STREQUAL "arm")
index 4669d5f5c5c8ce6c768f0dd0e135d6fc1fe34da2..9f7e527374ecd6c475126e81a5c271af926201a6 100644 (file)
@@ -38,25 +38,44 @@ Requires: memps
 Binary for testing Runtime-info APIs
 
 
+%if 0%{?gcov:1}
+%package gcov
+Summary:  A Runtime Information gcov test file
+%description gcov
+gcno files for Runtime-info line coverage test
+%endif
+
+
 %prep
 %setup -q
 cp %{SOURCE1001} .
 
+
 %build
 MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
-%cmake . -DFULLVER=%{version} -DMAJORVER=${MAJORVER}
-
+%cmake . -DFULLVER=%{version} -DMAJORVER=${MAJORVER} -DGCOV=%{?gcov:1}%{!?gcov:0}
 
 make %{?jobs:-j%jobs}
 
+%if 0%{?gcov:1}
+mkdir -p gcov-obj
+find . -name '*.gcno' -exec cp '{}' gcov-obj ';'
+%endif
+
+
 %install
 %make_install
 
+%if 0%{?gcov:1}
+mkdir -p %{buildroot}%{_datadir}/gcov/obj
+install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj
+%endif
+
+
 %post -p /sbin/ldconfig
 
 %postun -p /sbin/ldconfig
 
-
 %files
 %manifest %{name}.manifest
 %license LICENSE.APLv2
@@ -69,3 +88,8 @@ make %{?jobs:-j%jobs}
 
 %files test
 %attr(700,root,root) %{_bindir}/runtime-info-test
+
+%if 0%{?gcov:1}
+%files gcov
+%{_datadir}/gcov/obj/*
+%endif