%install_service multi-user.target.wants %{name}.path
%if 0%{gcov}
-find .. -name '*.gcno' | tar cf %{name}-gcov.tar -T -
-install -d -m 0755 %{buildroot}%{_datadir}/gcov/obj/%{name}
-tar xf %{name}-gcov.tar -C %{buildroot}%{_datadir}/gcov/obj/%{name}
+gcno_obj_dir=%{buildroot}%{_datadir}/gcov/obj/%{name}/"$(basename $PWD)"
+mkdir -p "$gcno_obj_dir"
+find . -name '*.gcno' -exec cp --parents '{}' "$gcno_obj_dir" ';'
%endif
+# ÀÚµ¿ unittest ½ÇÇàÀ» À§ÇÑ Ç¥ÁØ ½ÇÇà ½ºÅ©¸³Æ®
+cat << EOF > run-unittest.sh
+#!/bin/sh
+setup() {
+ echo "setup start"
+}
+
+test_main() {
+ echo "test_main start"
+ %{modes_test_dir}/modes-gtest-run.sh %{modes_ro_dir} %{modes_test_dir}
+}
+
+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}/
+
%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
%posttrans unittests
systemctl try-restart %{name}.path
systemctl try-restart %{name}.service
-%{modes_test_dir}/modes-gtest-run.sh %{modes_ro_dir} %{modes_test_dir}
%preun unittests
rm -rf %{modes_test_dir}/*ex*.xml %{modes_test_dir}/*.xsd %{modes_test_dir}/extra
%{modes_ro_dir}/mode/*
%{modes_ro_dir}/rule/*
%{modes_test_dir}/*.xml
+%{_bindir}/tizen-unittests/%{name}/run-unittest.sh
%license LICENSE.APLv2
%if 0%{gcov}
%files gcov
-%{_datadir}/gcov/*
+%{_datadir}/gcov/obj/*
%endif