From 9003eb047d46ef36e2f19cd42d4a06bd95e974d4 Mon Sep 17 00:00:00 2001 From: "joon.c.baek" Date: Fri, 28 Jun 2019 11:30:40 +0900 Subject: make a gcov package for measuring coverage easier Change-Id: I8bc65b1d0767ad5cc940d6ebdb31cd622fca4c6f Signed-off-by: joon.c.baek --- packaging/ttrace.spec | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/packaging/ttrace.spec b/packaging/ttrace.spec index f922f60..5ee3a9e 100644 --- a/packaging/ttrace.spec +++ b/packaging/ttrace.spec @@ -48,16 +48,36 @@ Requires: %{name} = %{version}-%{release} %description devel T-trace library devel +%if 0%{?gcov:1} +%package gcov +Summary: ttrace(gcov) +Group: Development/Libraries +%description gcov +New T-trace library cov objects +%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 CFLAGS="$CFLAGS -g -Wall -std=gnu99" export CXXFLAGS="$CXXFLAGS -std=c++0x -fPIE -pie -fno-exceptions" %cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DLIBDIR=%{_libdir} -DINCLUDEDIR=%{_includedir} \ -DTTRACE_PROFILE=%{TTRACE_PROFILE} -DTTRACE_TIZEN_VERSION_MAJOR=%{TTRACE_TIZEN_VERSION_MAJOR} 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 @@ -71,6 +91,11 @@ cp %{SOURCE103} %{buildroot}%{_bindir} %install_service sysinit.target.wants ttrace-marker.service %install_service sysinit.target.wants sys-kernel-debug-tracing.mount +%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 @@ -95,3 +120,8 @@ cp %{SOURCE103} %{buildroot}%{_bindir} %{_libdir}/libttrace.so %{_libdir}/libttrace.a %{_libdir}/pkgconfig/*.pc + +%if 0%{?gcov:1} +%files gcov +%{_datadir}/gcov/obj/* +%endif -- cgit v1.2.3