From: Hwankyu Jhun Date: Wed, 25 May 2022 22:43:06 +0000 (+0900) Subject: Fix spec file for coverage measurement X-Git-Tag: accepted/tizen/unified/20220530.140738~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F81%2F275481%2F1;p=platform%2Fcore%2Fbase%2Fbundle.git Fix spec file for coverage measurement To measure code coverages automatically, a run-unittest.sh is needed. Change-Id: I2882a61191a206b3c4fd2f37837f8d7e9ba4f5c9 Signed-off-by: Hwankyu Jhun --- diff --git a/packaging/bundle.spec b/packaging/bundle.spec index 8f7599c..c6ea371 100644 --- a/packaging/bundle.spec +++ b/packaging/bundle.spec @@ -96,28 +96,77 @@ export LDFLAGS+=" -lgcov" %cmake -DVERSION=%{version} . %__make %{?_smp_mflags} -%if 0%{?gcov:1} -mkdir -p gcov-obj -find . -name '*.gcno' -exec cp '{}' gcov-obj ';' -%endif - %check ctest --verbose %{?_smp_mflags} %if 0%{?gcov:1} -lcov -c --ignore-errors graph --no-external -q -d . -o bundle.info -genhtml bundle.info -o bundle.out -zip -r bundle.zip bundle.out bundle.info -install -m 0644 bundle.zip %{buildroot}%{_datadir}/gcov/ +lcov -c --ignore-errors graph --no-external -b . -d . -o %{name}.info +genhtml %{name}.info -o out --legend --show-details %endif %install %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/bundle_unittests +} + +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}/ + +cat << EOF > run-parcel-unittest.sh +#!/bin/sh +setup() { + echo "setup start" +} + +test_main() { + echo "test_main start" + /usr/bin/parcel_unittests +} + +teardown() { + echo "teardown start" +} + +main() { + setup + test_main + teardown +} + +main "\$*" +EOF + +mkdir -p %{buildroot}%{_bindir}/tizen-unittests/parcel +install -m 0755 run-parcel-unittest.sh %{buildroot}%{_bindir}/tizen-unittests/parcel/run-unittest.sh + %post -p /sbin/ldconfig %postun -p /sbin/ldconfig @@ -151,13 +200,14 @@ install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj/%{name} ################################################# %files unittests %{_bindir}/bundle_unittests +%{_bindir}/tizen-unittests/%{name}/run-unittest.sh ################################################# # bundle-gcov ################################################# %if 0%{?gcov:1} %files gcov -%{_datadir}/gcov/* +%{_datadir}/gcov/obj/* %endif ################################################# @@ -176,3 +226,4 @@ install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj/%{name} %files -n parcel-unittests %{_bindir}/parcel_unittests +%{_bindir}/tizen-unittests/parcel/run-unittest.sh