## Test
ENABLE_TESTING()
-SET(UTC_STICKER capi-ui-sticker_gtest)
+SET(UTC_STICKER capi-ui-sticker-unittest)
ADD_TEST(NAME ${UTC_STICKER} COMMAND ${UTC_STICKER}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
ADD_SUBDIRECTORY(tests)
make %{?jobs:-j%jobs}
-%if 0%{?gcov:1}
-find . -name '*.gcno' | tar cf %{name}-gcov.tar -T -
-%endif
%install
rm -rf %{buildroot}
%make_install
+%if 0%{?gcov:1}
+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/capi-ui-sticker-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}
+
mkdir -p %{buildroot}/%{TZ_SYS_ETC}/dump.d/module.d
cp -af dump/sticker_log_dump.sh %{buildroot}/%{TZ_SYS_ETC}/dump.d/module.d
mkdir -p %{buildroot}%{_sysconfdir}/dbus-1/system.d
install -m 0644 %SOURCE3 %{buildroot}%{_sysconfdir}/dbus-1/system.d/capi-ui-sticker.conf
-%if 0%{?gcov:1}
-install -d -m 755 %{buildroot}%{_datadir}/gcov/obj/%{name}
-tar xf %{name}-gcov.tar -C %{buildroot}%{_datadir}/gcov/obj/%{name}
-%endif
-
%if 0%{?sec_product_feature_profile_wearable}
%define tizen_sign 1
%define tizen_sign_base %{TZ_SYS_RO_APP}/%{_companion_app_name}
%files unittests
%license LICENSE
-%{_libdir}/%{name}/*
+%{_bindir}/*
%if 0%{?gcov:1}
%files gcov
)
TARGET_LINK_LIBRARIES(${UTC_STICKER} ${GTEST_LIBRARIES} ${pkgs_LDFLAGS} ${EXTRA_LDFLAGS})
-INSTALL(TARGETS ${UTC_STICKER} DESTINATION ${LIBDIR}/capi-ui-sticker/unittest)
+INSTALL(TARGETS ${UTC_STICKER} DESTINATION ${BINDIR})