revise spec file for analyzing coverage
authorYoungjae Shin <yj99.shin@samsung.com>
Thu, 12 Mar 2020 08:33:05 +0000 (17:33 +0900)
committerYoungjae Shin <yj99.shin@samsung.com>
Wed, 18 Mar 2020 08:53:50 +0000 (17:53 +0900)
packaging/modes.spec

index 3ee23a79cf51af30bbd5b7e9a5b17d006c8852ed..a055c3a7441c5508edff961eaedbd776a1be81c1 100644 (file)
@@ -20,6 +20,9 @@ BuildRequires: pkgconfig(gmock)
 BuildRequires: pkgconfig(cynara-client)
 BuildRequires: pkgconfig(cynara-creds-gdbus)
 BuildRequires: pkgconfig(cynara-session)
+%if 0%{?gcov:1}
+BuildRequires: lcov
+%endif
 
 %description
 The modes(Mode Supervisor) manages configurations which is described at a mode.
@@ -58,6 +61,15 @@ Group: System/Testing
 %description unittests
 The %{name}-unittests pacakge contains programs for checking quality the %{name}.
 
+%if 0%{?gcov:1}
+%package gcov
+Summary:  Coverage Data of %{name}
+Group: System/Testing
+
+%description gcov
+The %{name}-gcov pacakge contains gcov objects
+%endif
+
 %define _dbus_interface org.tizen.%{name}.dbus
 %define modes_plugin_dir %{_libdir}/modes-plugins
 %define modes_ro_dir %{_datadir}/%{name}
@@ -95,6 +107,11 @@ MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
        -DSTDOUT_LOG=%{?stdlog:1}%{!?stdlog:0}
 make %{?_smp_mflags}
 
+%if 0%{?gcov:1}
+mkdir -p gcov-obj
+#find . -name '*.gcno' -exec cp '{}' gcov-obj ';'
+%endif
+
 %install
 %make_install
 install -d -m 755 %{buildroot}%{modes_ro_dir}/mode
@@ -108,11 +125,22 @@ install -m 0755 unittest/modes-gtest-run.sh %{buildroot}%{modes_test_dir}/
 
 %install_service multi-user.target.wants %{name}.path
 
+%if 0%{?gcov:1}
+mkdir -p %{buildroot}%{_datadir}/gcov/obj
+#install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj
+%endif
+
 %check
 xmllint --noout --schema schema/tizen_mode.xsd example/mode/tizen_*_mode.xml
 xmllint --noout --schema schema/tizen_action_rule.xsd plugin/tizen_test_rule.xml
 xmllint --noout --schema schema/tizen_action_rule.xsd example/rule/tizen_*_rule.xml
 bash ./unittest/modes-gtest-run.sh %{buildroot}%{modes_ro_dir} %{buildroot}%{modes_test_dir} Building
+%if 0%{?gcov:1}
+lcov -c --ignore-errors graph --no-external -d . -o %{name}.info
+genhtml ./%{name}.info -o ./out --legend --show-details
+install -m 0644 %{name}.info %{buildroot}%{_datadir}/gcov/
+%endif
+
 
 %post
 /sbin/ldconfig
@@ -174,3 +202,8 @@ systemctl try-restart %{name}.service
 %{modes_ro_dir}/rule/*
 %{modes_test_dir}/*.xml
 %license LICENSE.APLv2
+
+%if 0%{?gcov:1}
+%files gcov
+%{_datadir}/gcov/*
+%endif