From 52694d034191b9b56e0f33a088eb9d697a4bfdfc Mon Sep 17 00:00:00 2001 From: Jaehyun Kim Date: Fri, 17 May 2024 10:24:53 +0900 Subject: [PATCH] Add LCOV macro to exclude test code Change-Id: I6034390da03939196f2c37e7dd3cded776e9c5e3 Signed-off-by: Jaehyun Kim --- packaging/capi-network-softap.spec | 1 - tests/softap-gtest-async.cpp | 2 ++ tests/softap-gtest-client.cpp | 2 ++ tests/softap-gtest-common.cpp | 2 ++ tests/softap-gtest-event-handler.cpp | 4 +++- tests/softap-gtest-util.cpp | 2 ++ tests/softap-gtest-vconf.cpp | 2 ++ 7 files changed, 13 insertions(+), 2 deletions(-) diff --git a/packaging/capi-network-softap.spec b/packaging/capi-network-softap.spec index d48f45b..2172529 100644 --- a/packaging/capi-network-softap.spec +++ b/packaging/capi-network-softap.spec @@ -137,7 +137,6 @@ genhtml %{name}.info -o out --legend --show-details %if 0%{?gcov:1} %files gcov %{_datadir}/gcov/obj/* -%exclude %{_datadir}/gcov/obj/*/*/tests/* %endif %if 0%{?asan} != 1 diff --git a/tests/softap-gtest-async.cpp b/tests/softap-gtest-async.cpp index 492e58d..baa4871 100755 --- a/tests/softap-gtest-async.cpp +++ b/tests/softap-gtest-async.cpp @@ -32,6 +32,7 @@ static int resultFlags; static void enabledCallback(softap_error_e error, bool requested, void *data); static void disabledCallback(softap_error_e error, softap_disabled_cause_e cause, void *data); +//LCOV_EXCL_START class SoftApAsyncTest: public ::testing::Test { protected: softap_h handle; @@ -322,3 +323,4 @@ TEST_F(SoftApAsyncTest, ClientConnectionStateChangedEventP) EXPECT_EQ(SOFTAP_ERROR_NONE, softap_unset_client_connection_state_changed_cb(handle)); } +//LCOV_EXCL_STOP diff --git a/tests/softap-gtest-client.cpp b/tests/softap-gtest-client.cpp index 587e6c7..89c227b 100755 --- a/tests/softap-gtest-client.cpp +++ b/tests/softap-gtest-client.cpp @@ -26,6 +26,7 @@ extern "C" { #include "mocks/softap_vconf.h" } +//LCOV_EXCL_START class SoftApClientTest: public ::testing::Test { protected: softap_client_h client; @@ -148,3 +149,4 @@ TEST_F(SoftApClientTest, GetTimeP) EXPECT_EQ(SOFTAP_ERROR_NONE, softap_client_get_time(client, ×tamp)); } +//LCOV_EXCL_STOP diff --git a/tests/softap-gtest-common.cpp b/tests/softap-gtest-common.cpp index 89c38cf..b6988f1 100755 --- a/tests/softap-gtest-common.cpp +++ b/tests/softap-gtest-common.cpp @@ -26,6 +26,7 @@ extern "C" { #include "mocks/softap_vconf.h" } +//LCOV_EXCL_START class SoftApTest: public ::testing::Test { protected: softap_h handle; @@ -615,3 +616,4 @@ TEST_F(SoftApTest, ForeachConnectedClientsP) EXPECT_EQ(SOFTAP_ERROR_NONE, softap_foreach_connected_clients(handle, ConnectedClientsCallbackP, NULL)); } +//LCOV_EXCL_STOP diff --git a/tests/softap-gtest-event-handler.cpp b/tests/softap-gtest-event-handler.cpp index 65346db..5513586 100755 --- a/tests/softap-gtest-event-handler.cpp +++ b/tests/softap-gtest-event-handler.cpp @@ -26,6 +26,7 @@ extern "C" { #include "mocks/softap_gdbus.h" } +//LCOV_EXCL_START static void __handle_softap_on(bool is_requested, void *user_data); static void __handle_softap_off(int disabled_code, void *user_data); static void __handle_low_battery_mode(void *user_data); @@ -147,4 +148,5 @@ TEST_F(SoftApEventHandlerTest, startDisabledEventP) { RegisterEvents(); EXPECT_EQ(ERROR_NONE, eventHandler->startDisabledEvent()); -} \ No newline at end of file +} +//LCOV_EXCL_STOP diff --git a/tests/softap-gtest-util.cpp b/tests/softap-gtest-util.cpp index f61fe25..900f526 100755 --- a/tests/softap-gtest-util.cpp +++ b/tests/softap-gtest-util.cpp @@ -22,6 +22,7 @@ extern "C" { #include "mocks/softap_gdbus.h" }; +//LCOV_EXCL_START SoftApTestUtil::SoftApTestUtil(void) : testType(SOFTAP_TEST_UTIL_MAX), mainLoop(NULL), timeoutId(0) { } @@ -101,3 +102,4 @@ gboolean SoftApTestUtil::timeoutCallback(gpointer user_data) return FALSE; } +//LCOV_EXCL_STOP diff --git a/tests/softap-gtest-vconf.cpp b/tests/softap-gtest-vconf.cpp index f1d385c..83ded97 100644 --- a/tests/softap-gtest-vconf.cpp +++ b/tests/softap-gtest-vconf.cpp @@ -25,6 +25,7 @@ extern "C" { #include "mocks/softap_vconf.h" } +//LCOV_EXCL_START class SoftapVconfTest: public ::testing::Test { protected: void SetUp() override @@ -93,3 +94,4 @@ TEST_F(SoftapVconfTest, getVsieN) EXPECT_EQ(SOFTAP_ERROR_INVALID_PARAMETER, SoftapVconf::getVsie(NULL, 0)); } +//LCOV_EXCL_STOP -- 2.34.1