Make a gcov package for measuring coverage easier 49/209149/1 accepted/tizen/unified/20190705.110722 submit/tizen/20190704.043443 submit/tizen/20190705.002959
authorhyunuktak <hyunuk.tak@samsung.com>
Wed, 3 Jul 2019 01:50:33 +0000 (10:50 +0900)
committerhyunuktak <hyunuk.tak@samsung.com>
Wed, 3 Jul 2019 01:50:35 +0000 (10:50 +0900)
Change-Id: I8da9a40a67eca37f457c3df9f32731f60aac7c4d
Signed-off-by: hyunuktak <hyunuk.tak@samsung.com>
packaging/capi-vpn-service.spec

index 7032c7c..b91cd44 100755 (executable)
@@ -15,6 +15,10 @@ BuildRequires:  pkgconfig(capi-appfw-application)
 BuildRequires:  pkgconfig(capi-appfw-package-manager)
 BuildRequires:  pkgconfig(capi-appfw-app-manager)
 BuildRequires: pkgconfig(capi-system-info)
+%if 0%{?gcov:1}
+BuildRequires: lcov
+%endif
+
 Requires(post): /sbin/ldconfig
 Requires(postun): /sbin/ldconfig
 
@@ -44,10 +48,25 @@ capi-vpnsvc CAPI devel package
 #%description -n vpnsvc_test
 #vpnsvc test package
 
+%if 0%{?gcov:1}
+%package gcov
+Summary:  VPN service library(gcov)
+Group:    Network/Testing
+%description gcov
+gcov objects for coverage test
+%endif
+
 %prep
 %setup -q
 
 %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
+
 export LDFLAGS+="-Wl,--rpath=%{_libdir}"
 
 MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
@@ -60,11 +79,21 @@ MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
 
 make %{?jobs:-j%jobs}
 
+%if 0%{?gcov:1}
+mkdir -p gcov-obj
+find . -name '*.gcno' -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
+
 %clean
 rm -rf %{buildroot}
 
@@ -87,3 +116,8 @@ ln -s %{_libdir}/libcapi-vpnsvc.so.0 %{_libdir}/libcapi-vpnsvc.so
 #%files -n vpnsvc_test
 #%manifest test/vpnsvc-test.manifest
 #%{_bindir}/vpnsvc_test
+
+%if 0%{?gcov:1}
+%files gcov
+%{_datadir}/gcov/obj/*
+%endif