summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChanggyu Choi <changyu.choi@samsung.com>2022-05-26 15:08:25 +0900
committerChanggyu Choi <changyu.choi@samsung.com>2022-05-26 15:08:25 +0900
commit5a5e475537cd874b540ccbf7859fe5050f6fe15d (patch)
tree50c5bb3501b261e7e9ffc076c802ccbfc0f7e9dc
parentda2da8365ab895c945fd1b618f0b350ea437428f (diff)
downloadlibrua-5a5e475537cd874b540ccbf7859fe5050f6fe15d.tar.gz
librua-5a5e475537cd874b540ccbf7859fe5050f6fe15d.tar.bz2
librua-5a5e475537cd874b540ccbf7859fe5050f6fe15d.zip
Fix spec file for coverage measurement
To measure code coverages automatically, a run-unittest.sh is needed. Change-Id: I1c626b6c94af086b0522328c2dbb9c6d34df5bd5 Signed-off-by: Changgyu Choi <changyu.choi@samsung.com>
-rw-r--r--packaging/librua.spec45
1 files changed, 35 insertions, 10 deletions
diff --git a/packaging/librua.spec b/packaging/librua.spec
index c57f611..e69c26a 100644
--- a/packaging/librua.spec
+++ b/packaging/librua.spec
@@ -33,11 +33,11 @@ Requires: %{name} = %{version}
%description devel
Recently used application library (devel)
-%package test
+%package unittests
Summary: Recently used application (test)
Requires: %{name} = %{version}
-%description test
+%description unittests
Recently used application library (test)
%prep
@@ -59,11 +59,6 @@ MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
make %{?_smp_mflags}
-%if 0%{?gcov:1}
-mkdir -p gcov-obj
-find . -name '*.gcno' -exec cp '{}' gcov-obj ';'
-%endif
-
%check
(cd tests && cd unittest && LD_LIBRARY_PATH=../../ ctest -V)
%if 0%{?gcov:1}
@@ -77,10 +72,39 @@ install -m 0644 rua.zip %{buildroot}%{_datadir}/gcov/
%make_install
%if 0%{?gcov:1}
-mkdir -p %{buildroot}%{_datadir}/gcov/obj/%{name}
-install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj/%{name}
+builddir=$(basename $PWD)
+gcno_obj_dir=%{buildroot}%{_datadir}/gcov/obj/%{name}/"$builddir"
+mkdir -p "$gcno_obj_dir"
+find . -name '*.gcno' -exec cp --parents '{}' "$gcno_obj_dir" ';'
%endif
+cat << EOF > run-unittest.sh
+#!/bin/sh
+setup() {
+ echo "setup start"
+}
+
+test_main() {
+ echo "test_main start"
+ /usr/bin/rua-test
+}
+
+teardown() {
+ echo "teardown start"
+}
+
+main() {
+ setup
+ test_main
+ teardown
+}
+
+main "\$*"
+EOF
+
+mkdir -p %{buildroot}%{_bindir}/tizen-unittests/%{name}
+install -m 0755 run-unittest.sh %{buildroot}%{_bindir}/tizen-unittests/%{name}/
+
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
@@ -99,10 +123,11 @@ install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj/%{name}
%{_libdir}/librua.so
%{_libdir}/pkgconfig/rua.pc
-%files test
+%files unittests
%manifest %{name}.manifest
%defattr(-,root,root,-)
%{_bindir}/rua-test
+%{_bindir}/tizen-unittests/%{name}/run-unittest.sh
#################################################
# rua-gcov