Apply new gcov policy 38/275138/2
authorJihoon Kim <jihoon48.kim@samsung.com>
Tue, 17 May 2022 06:22:08 +0000 (15:22 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Tue, 17 May 2022 06:24:30 +0000 (15:24 +0900)
- Apply of tree type gcov structure
- Create run-unittest.sh
- Change the unittest path and name

Change-Id: I3eefa3045cd81a7f16a35f4fcec0f150e6b42456
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
CMakeLists.txt
packaging/capi-ui-sticker.spec
tests/CMakeLists.txt

index 16ad375..22c7a24 100755 (executable)
@@ -54,7 +54,7 @@ ENDIF()
 
 ## 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)
index 735a7b8..4158f54 100644 (file)
@@ -119,14 +119,45 @@ export FFLAGS+=" -DTIZEN_DEBUG_ENABLE -fvisibility=hidden"
 
 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
 
@@ -139,11 +170,6 @@ install -m 0644 %SOURCE2 %{buildroot}%{_datadir}/dbus-1/system-services/org.tize
 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}
@@ -208,7 +234,7 @@ chsmack -a "User::App::Shared" /opt/usr/share/sticker-data
 
 %files unittests
 %license LICENSE
-%{_libdir}/%{name}/*
+%{_bindir}/*
 
 %if 0%{?gcov:1}
 %files gcov
index 031b15f..7e877ef 100644 (file)
@@ -28,4 +28,4 @@ ADD_EXECUTABLE(${UTC_STICKER}
        )
 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})