summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChanggyu Choi <changyu.choi@samsung.com>2022-05-26 14:59:33 +0900
committerChanggyu Choi <changyu.choi@samsung.com>2022-05-26 14:59:33 +0900
commitb8b15214e79161f8d2d5792329a67bd719698083 (patch)
treeb6d5a1560862693f3ff1b58784fa8f7576494ba2
parentf5b020e49b1be51fd16a2f9b4a74fb505b24b662 (diff)
downloadapplication-b8b15214e79161f8d2d5792329a67bd719698083.tar.gz
application-b8b15214e79161f8d2d5792329a67bd719698083.tar.bz2
application-b8b15214e79161f8d2d5792329a67bd719698083.zip
Fix spec file for coverage measurement
To measure code coverages automatically, a run-unittest.sh is needed. Change-Id: I132d877d53c508763a4f97dc4ac241cb97acb9c4 Signed-off-by: Changgyu Choi <changyu.choi@samsung.com>
-rw-r--r--packaging/capi-appfw-application.spec49
1 files changed, 42 insertions, 7 deletions
diff --git a/packaging/capi-appfw-application.spec b/packaging/capi-appfw-application.spec
index d0e0fe3..785cebe 100644
--- a/packaging/capi-appfw-application.spec
+++ b/packaging/capi-appfw-application.spec
@@ -39,6 +39,14 @@ Requires: %{name} = %{version}
%description devel
An Application library in SLP C API (Development) package.
+%package unittests
+Summary: GTest for application API
+Group: Development/Libraries
+Requires: %{name}
+
+%description unittests
+GTest for application API
+
%if 0%{?gcov:1}
%package gcov
Summary: An application library(gcov)
@@ -66,11 +74,6 @@ MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
-DBUILD_GCOV=%{?gcov:1}%{!?gcov:0}
%__make %{?jobs:-j%jobs}
-%if 0%{?gcov:1}
-mkdir -p gcov-obj
-find . -name '*.gcno' -exec cp '{}' gcov-obj ';'
-%endif
-
%check
export LD_LIBRARY_PATH="../../appcore_ui_app_ambient"
ctest --verbose %{?_smp_mflags}
@@ -86,10 +89,39 @@ rm -rf %{buildroot}
%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/ui-app-ambient_unittest
+}
+
+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
@@ -132,7 +164,10 @@ Header & package configuration of appcore-ui-app-ambient
%manifest appcore-ui-app-ambient.manifest
%license LICENSE
%{_libdir}/libappcore-ui-app-ambient.so.*
+
+%files unittests
%{_bindir}/ui-app-ambient_unittests
+%{_bindir}/tizen-unittests/%{name}/run-unittest.sh
%files -n appcore-ui-app-ambient-devel
%{_includedir}/appcore-ui-app-ambient/*.h