Make gcov package when --define 'gcov ON' is given 07/208707/2 accepted/tizen_5.5_unified_mobile_hotfix tizen_5.5_mobile_hotfix accepted/tizen/5.5/unified/20191031.021544 accepted/tizen/5.5/unified/mobile/hotfix/20201027.085753 accepted/tizen/unified/20190704.115635 submit/tizen/20190704.082800 submit/tizen_5.5/20191031.000004 submit/tizen_5.5_mobile_hotfix/20201026.185104 tizen_5.5.m2_release
authorYunjin Lee <yunjin-.lee@samsung.com>
Thu, 27 Jun 2019 08:14:21 +0000 (17:14 +0900)
committerYunjin Lee <yunjin-.lee@samsung.com>
Fri, 28 Jun 2019 08:06:28 +0000 (17:06 +0900)
Change-Id: Id552076230ef6415ac02d1f760dca4ae6ddd6c61
Signed-off-by: Yunjin Lee <yunjin-.lee@samsung.com>
packaging/privilege-info.spec

index faf710b..eefdaa9 100644 (file)
@@ -18,6 +18,9 @@ BuildRequires: pkgconfig(cynara-session)
 BuildRequires: pkgconfig(libsmack)
 BuildRequires: pkgconfig(libtzplatform-config)
 BuildRequires: pkgconfig(capi-system-info)
+%if 0%{?gcov:1}
+BuildRequires: lcov
+%endif
 Requires: tizen-locale
 
 %description
@@ -39,6 +42,15 @@ Requires: %{name} = %{version}-%{release}
 %description -n tc-privilege-info
 Privilege Info API Internal Test
 
+%if 0%{?gcov:1}
+%package gcov
+Summary:  Privilege Info(gcov)
+Group:    Security/Testing
+%description gcov
+New Privilege Info gcov objects
+%endif
+
+
 %prep
 %setup -q
 
@@ -48,13 +60,21 @@ export CFLAGS="$CFLAGS -DTIZEN_ENGINEER_MODE"
 export CXXFLAGS="$CXXFLAGS -DTIZEN_ENGINEER_MODE"
 export FFLAGS="$FFLAGS -DTIZEN_ENGINEER_MODE"
 
+%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
+
 echo cmake . -DPREFIX=%{_prefix} \
         -DLIBDIR=%{_libdir} \
         -DINCLUDEDIR=%{_includedir} \
         -DCMAKE_BUILD_TYPE=%{build_type} \
         -DVERSION=%{version} \
         -DTZ_SYS_RO_PACKAGES=%TZ_SYS_RO_PACKAGES \
-        -DTZ_SYS_RO_APP=%TZ_SYS_RO_APP
+        -DTZ_SYS_RO_APP=%TZ_SYS_RO_APP \
+        -DBUILD_GCOV={?gcov:1}%{!?gcov:0}
 
 cmake . -DPREFIX=%{_prefix} \
         -DLIBDIR=%{_libdir} \
@@ -62,15 +82,26 @@ cmake . -DPREFIX=%{_prefix} \
         -DCMAKE_BUILD_TYPE=%{build_type} \
         -DVERSION=%{version} \
         -DTZ_SYS_RO_PACKAGES=%TZ_SYS_RO_PACKAGES \
-        -DTZ_SYS_RO_APP=%TZ_SYS_RO_APP
+        -DTZ_SYS_RO_APP=%TZ_SYS_RO_APP \
+        -DBUILD_GCOV={?gcov:1}%{!?gcov:0}
 
 make %{?jobs:-j%jobs}
 
+%if 0%{?gcov:1}
+mkdir -p gcov-obj
+find . \( -name '*.gcno' ! -name 'tc_*' \) -exec cp '{}' gcov-obj ';'
+%endif
+
 %install
 rm -rf %{buildroot}
 
 %make_install
 
+%if 0%{?gcov:1}
+mkdir -p %{buildroot}%{_datadir}/gcov/obj
+install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj
+%endif
+
 %post -n privilege-info -p /sbin/ldconfig
 %postun -n privilege-info -p /sbin/ldconfig
 
@@ -93,6 +124,10 @@ cyad -s -k MANIFESTS -c User::Pkg::org.tizen.test-privilege-info -u '*' -p http:
 %{TZ_SYS_RO_PACKAGES}/org.tizen.test-privilege-info.xml
 %{_bindir}/tc-privilege-info
 
+%if 0%{?gcov:1}
+%files gcov
+%{_datadir}/gcov/obj/*
+%endif
 
 %clean
 rm -rf %{buildroot}