From 2c0d1296c208de87cf5a2e1940304e844bf866df Mon Sep 17 00:00:00 2001 From: Youngjae Shin Date: Tue, 30 Jan 2018 16:47:12 +0900 Subject: [PATCH] for checking line coverage usage: gbs build -A armv7l --define "gcov ON" Change-Id: Id12cf253bb5422bfe194be571d7c05bf2114f6c3 --- packaging/tidl.spec | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/packaging/tidl.spec b/packaging/tidl.spec index 0356bd8..5ba5098 100644 --- a/packaging/tidl.spec +++ b/packaging/tidl.spec @@ -16,6 +16,9 @@ BuildRequires: flex BuildRequires: bison BuildRequires: gtest-devel BuildRequires: pkgconfig(glib-2.0) +%if 0%{?gcov:1} +BuildRequires: lcov +%endif %description Tizen Interface Definition Language @@ -36,11 +39,15 @@ cp %{SOURCE1001} . cp %{SOURCE1002} . %build -MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'` -%cmake -DFULLVER=%{version} \ - -DMAJORVER=${MAJORVER} \ - . +%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 +MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'` +%cmake . -DFULLVER=%{version} -DMAJORVER=${MAJORVER} %__make %{?_smp_mflags} %install @@ -49,6 +56,10 @@ rm -rf %{buildroot} %check ctest --output-on-failure %{?_smp_mflags} +%if 0%{?gcov:1} +lcov -c --ignore-errors graph --no-external -q -d . -o gcov.info +genhtml gcov.info +%endif %preun -- 2.7.4