%cmake . -DFULLVER=%{version} -DMAJORVER=${MAJORVER}
%__make %{?_smp_mflags}
-%if 0%{?gcov:1}
-mkdir -p gcov-obj
-find . -name '*.gcno' -exec cp '{}' gcov-obj ';'
-%endif
-
%check
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:../../component_based/app_control" >& /dev/null
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:../../component_based/base" >& /dev/null
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:../../component_based/widget_base" >& /dev/null
ctest -V
%if 0%{?gcov:1}
-lcov -c --ignore-errors graph --no-external -q -d . -o component-based.info
-genhtml component-based.info -o component-based.out
-zip -r component-based.zip component-based.out
-install -m 0644 component-based.zip %{buildroot}%{_datadir}/gcov/
+lcov -c --ignore-errors graph --no-external -b . -d . -o %{name}.info
+genhtml %{name}.info -o %{name}.out --legend --show-details
+zip -r %{name}.zip %{name}.out
+install -m 0644 %{name}.zip %{buildroot}%{_datadir}/gcov/
%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/component-based_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}/
+
%preun
%post -p /sbin/ldconfig
# unittests
#################################################
%files unittests
-%{_bindir}/component-based_unittests
+%attr(0755,root,root) %{_bindir}/component-based_unittests
+%attr(0755,root,root) %{_bindir}/tizen-unittests/%{name}/run-unittest.sh
#################################################
# component-based-gcov