Tizen Coverage Automation 52/218352/1 submit/tizen/20191128.120907
authorchakradhar <v.pogiri@samsung.com>
Thu, 21 Nov 2019 11:01:50 +0000 (16:31 +0530)
committerchakradhar <v.pogiri@samsung.com>
Thu, 21 Nov 2019 11:01:50 +0000 (16:31 +0530)
Change-Id: Ic2b0e814dbfbe6f3fec915bf5a0f2ac2dd7b6136
Signed-off-by: chakradhar <v.pogiri@samsung.com>
packaging/capi-system-sensor.spec

index e88a7d4..28e6815 100644 (file)
@@ -40,17 +40,43 @@ Requires: %{name} = %{version}-%{release}
 A Sensor library in TIZEN C API package (Development).
 %devel_desc
 
+%if 0%{?gcov:1}
+%package gcov
+Summary:    Tizen Sensor Library API (gcov)
+Group:      Service Framework/Testing
+
+%description gcov
+gcov objects for coverage test
+%endif
+
 %prep
 %setup -q
 
 %build
 MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
+
+%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
+
 %cmake . -DFULLVER=%{version} -DMAJORVER=${MAJORVER} -DSENSOR_RECORDER=%{SENSOR_RECORDER}
 %__make %{?_smp_mflags}
+%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
@@ -65,3 +91,8 @@ MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
 %{_libdir}/pkgconfig/*.pc
 %{_includedir}/sensor/*.h
 %{_libdir}/libcapi-system-sensor.so
+
+%if 0%{?gcov:1}
+%files gcov
+%{_datadir}/gcov/obj/*
+%endif