From aaa5d3ad1aafe72d2ee3d8d64ff8dc0a3fdc441e Mon Sep 17 00:00:00 2001 From: "mk5004.lee" Date: Fri, 10 Jul 2020 14:36:09 +0900 Subject: [PATCH] Apply gcov ON build Change-Id: Iec33ef377ddf51302db5fc53f18ea64aabf20741 Signed-off-by: mk5004.lee --- packaging/notification.spec | 16 ++++++++++++---- unittest/CMakeLists.txt | 12 ++++++------ unittest/src/test_main.cc | 4 ++-- ...act_item.cc => test_noti_ex_abstract_item.cc} | 0 ...ion.cc => test_noti_ex_app_control_action.cc} | 0 ...utton_item.cc => test_noti_ex_button_item.cc} | 0 ...item.cc => test_noti_ex_chat_message_item.cc} | 0 ...box_item.cc => test_noti_ex_checkbox_item.cc} | 0 ..._entry_item.cc => test_noti_ex_entry_item.cc} | 0 ..._event_info.cc => test_noti_ex_event_info.cc} | 0 ..._group_item.cc => test_noti_ex_group_item.cc} | 0 ...st_icon_item.cc => test_noti_ex_icon_item.cc} | 0 ..._image_item.cc => test_noti_ex_image_item.cc} | 0 ...em.cc => test_noti_ex_input_selector_item.cc} | 0 ...ess_item.cc => test_noti_ex_progress_item.cc} | 0 ...hared_file.cc => test_noti_ex_shared_file.cc} | 0 ...st_text_item.cc => test_noti_ex_text_item.cc} | 0 ...st_time_item.cc => test_noti_ex_time_item.cc} | 0 ...tion.cc => test_noti_ex_visibility_action.cc} | 0 19 files changed, 20 insertions(+), 12 deletions(-) rename unittest/src/{test_abstract_item.cc => test_noti_ex_abstract_item.cc} (100%) rename unittest/src/{test_app_control_action.cc => test_noti_ex_app_control_action.cc} (100%) rename unittest/src/{test_button_item.cc => test_noti_ex_button_item.cc} (100%) rename unittest/src/{test_chat_message_item.cc => test_noti_ex_chat_message_item.cc} (100%) rename unittest/src/{test_checkbox_item.cc => test_noti_ex_checkbox_item.cc} (100%) rename unittest/src/{test_entry_item.cc => test_noti_ex_entry_item.cc} (100%) rename unittest/src/{test_event_info.cc => test_noti_ex_event_info.cc} (100%) rename unittest/src/{test_group_item.cc => test_noti_ex_group_item.cc} (100%) mode change 100755 => 100644 rename unittest/src/{test_icon_item.cc => test_noti_ex_icon_item.cc} (100%) rename unittest/src/{test_image_item.cc => test_noti_ex_image_item.cc} (100%) rename unittest/src/{test_input_selector_item.cc => test_noti_ex_input_selector_item.cc} (100%) rename unittest/src/{test_progress_item.cc => test_noti_ex_progress_item.cc} (100%) rename unittest/src/{test_shared_file.cc => test_noti_ex_shared_file.cc} (100%) mode change 100755 => 100644 rename unittest/src/{test_text_item.cc => test_noti_ex_text_item.cc} (100%) rename unittest/src/{test_time_item.cc => test_noti_ex_time_item.cc} (100%) rename unittest/src/{test_visibility_action.cc => test_noti_ex_visibility_action.cc} (100%) diff --git a/packaging/notification.spec b/packaging/notification.spec index e2f4b09a..c385c481 100644 --- a/packaging/notification.spec +++ b/packaging/notification.spec @@ -24,6 +24,11 @@ BuildRequires: pkgconfig(libsmack) BuildRequires: pkgconfig(gmock) BuildRequires: pkgconfig(uuid) +%if 0%{?gcov:1} +BuildRequires: lcov +BuildRequires: zip +%endif + BuildRequires: cmake Requires(post): /sbin/ldconfig Requires(post): %{TZ_SYS_BIN}/sqlite3 @@ -75,6 +80,12 @@ find . -name '*.gcno' -exec cp '{}' gcov-obj ';' %check ctest --output-on-failure %{?_smp_mflags} +%if 0%{?gcov:1} +lcov -c --ignore-errors graph --no-external -q -d . -o notification-ex.info +genhtml notification-ex.info -o notification-ex.out +zip -r notification-ex.zip notification-ex.out +install -m 0644 notification-ex.zip %{buildroot}%{_datadir}/gcov/notification-ex.zip +%endif %install rm -rf %{buildroot} @@ -135,8 +146,6 @@ fi %{_libdir}/pkgconfig/notification.pc %{_libdir}/libnotification.so - - ################################################# # notification-ex ################################################# @@ -171,7 +180,6 @@ Header & package configuration files to support development of the notification. %{_libdir}/pkgconfig/notification-ex.pc %attr(0644,root,root) %{_libdir}/libnotification-ex.so - ################################################# # notification-ex_unittests ################################################# @@ -187,5 +195,5 @@ GTest for notification-ex %if 0%{?gcov:1} %files gcov -%{_datadir}/gcov/obj/* +%{_datadir}/gcov/* %endif diff --git a/unittest/CMakeLists.txt b/unittest/CMakeLists.txt index 93823e72..afbc3baf 100644 --- a/unittest/CMakeLists.txt +++ b/unittest/CMakeLists.txt @@ -22,15 +22,15 @@ SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g") SET(CMAKE_CXX_FLAGS_RELEASE "-O2") INCLUDE_DIRECTORIES( - ${CMAKE_CURRENT_SOURCE_DIR}/../notification-ex - ${CMAKE_CURRENT_SOURCE_DIR}/../notification-ex/api - ${CMAKE_CURRENT_SOURCE_DIR}/../mock - ${CMAKE_CURRENT_SOURCE_DIR}/../ + ${CMAKE_SOURCE_DIR}/notification-ex + ${CMAKE_SOURCE_DIR}/notification-ex/api + ${CMAKE_SOURCE_DIR}/mock + ${CMAKE_SOURCE_DIR}/ ) AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/src SOURCES) -AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../mock MOCK_SOURCES) -AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../notification-ex NOTIFICATION_EX_SOURCES) +AUX_SOURCE_DIRECTORY(${CMAKE_SOURCE_DIR}/mock MOCK_SOURCES) +AUX_SOURCE_DIRECTORY(${CMAKE_SOURCE_DIR}/notification-ex NOTIFICATION_EX_SOURCES) ADD_EXECUTABLE(${PROJECT_NAME} ${SOURCES} ${NOTIFICATION_EX_SOURCES} diff --git a/unittest/src/test_main.cc b/unittest/src/test_main.cc index 4be05dc2..ad7ec6c6 100644 --- a/unittest/src/test_main.cc +++ b/unittest/src/test_main.cc @@ -17,9 +17,9 @@ #include #include -int main(int argc, char** argv){ +int main(int argc, char** argv) { int ret = -1; - setenv("GCOV_PREFIX", "/tmp/", 1); + try { testing::InitGoogleTest(&argc, argv); } catch(...) { diff --git a/unittest/src/test_abstract_item.cc b/unittest/src/test_noti_ex_abstract_item.cc similarity index 100% rename from unittest/src/test_abstract_item.cc rename to unittest/src/test_noti_ex_abstract_item.cc diff --git a/unittest/src/test_app_control_action.cc b/unittest/src/test_noti_ex_app_control_action.cc similarity index 100% rename from unittest/src/test_app_control_action.cc rename to unittest/src/test_noti_ex_app_control_action.cc diff --git a/unittest/src/test_button_item.cc b/unittest/src/test_noti_ex_button_item.cc similarity index 100% rename from unittest/src/test_button_item.cc rename to unittest/src/test_noti_ex_button_item.cc diff --git a/unittest/src/test_chat_message_item.cc b/unittest/src/test_noti_ex_chat_message_item.cc similarity index 100% rename from unittest/src/test_chat_message_item.cc rename to unittest/src/test_noti_ex_chat_message_item.cc diff --git a/unittest/src/test_checkbox_item.cc b/unittest/src/test_noti_ex_checkbox_item.cc similarity index 100% rename from unittest/src/test_checkbox_item.cc rename to unittest/src/test_noti_ex_checkbox_item.cc diff --git a/unittest/src/test_entry_item.cc b/unittest/src/test_noti_ex_entry_item.cc similarity index 100% rename from unittest/src/test_entry_item.cc rename to unittest/src/test_noti_ex_entry_item.cc diff --git a/unittest/src/test_event_info.cc b/unittest/src/test_noti_ex_event_info.cc similarity index 100% rename from unittest/src/test_event_info.cc rename to unittest/src/test_noti_ex_event_info.cc diff --git a/unittest/src/test_group_item.cc b/unittest/src/test_noti_ex_group_item.cc old mode 100755 new mode 100644 similarity index 100% rename from unittest/src/test_group_item.cc rename to unittest/src/test_noti_ex_group_item.cc diff --git a/unittest/src/test_icon_item.cc b/unittest/src/test_noti_ex_icon_item.cc similarity index 100% rename from unittest/src/test_icon_item.cc rename to unittest/src/test_noti_ex_icon_item.cc diff --git a/unittest/src/test_image_item.cc b/unittest/src/test_noti_ex_image_item.cc similarity index 100% rename from unittest/src/test_image_item.cc rename to unittest/src/test_noti_ex_image_item.cc diff --git a/unittest/src/test_input_selector_item.cc b/unittest/src/test_noti_ex_input_selector_item.cc similarity index 100% rename from unittest/src/test_input_selector_item.cc rename to unittest/src/test_noti_ex_input_selector_item.cc diff --git a/unittest/src/test_progress_item.cc b/unittest/src/test_noti_ex_progress_item.cc similarity index 100% rename from unittest/src/test_progress_item.cc rename to unittest/src/test_noti_ex_progress_item.cc diff --git a/unittest/src/test_shared_file.cc b/unittest/src/test_noti_ex_shared_file.cc old mode 100755 new mode 100644 similarity index 100% rename from unittest/src/test_shared_file.cc rename to unittest/src/test_noti_ex_shared_file.cc diff --git a/unittest/src/test_text_item.cc b/unittest/src/test_noti_ex_text_item.cc similarity index 100% rename from unittest/src/test_text_item.cc rename to unittest/src/test_noti_ex_text_item.cc diff --git a/unittest/src/test_time_item.cc b/unittest/src/test_noti_ex_time_item.cc similarity index 100% rename from unittest/src/test_time_item.cc rename to unittest/src/test_noti_ex_time_item.cc diff --git a/unittest/src/test_visibility_action.cc b/unittest/src/test_noti_ex_visibility_action.cc similarity index 100% rename from unittest/src/test_visibility_action.cc rename to unittest/src/test_noti_ex_visibility_action.cc -- 2.34.1