From 7d8ee779a6aea5d3dd239af259c15b5c83970c45 Mon Sep 17 00:00:00 2001 From: "pr.jung" Date: Wed, 9 May 2018 15:03:55 +0900 Subject: Exclude system error for line coverage Change-Id: Ib1d1562119871c9a9b1c7d3321c0511a09f83c3c Signed-off-by: pr.jung --- src/dbus.c | 12 ++++++++++++ src/devices.c | 2 ++ src/feedback.c | 8 +++++--- src/vibrator.c | 14 ++++++++------ 4 files changed, 27 insertions(+), 9 deletions(-) diff --git a/src/dbus.c b/src/dbus.c index 213a2b5..ad6d0bb 100644 --- a/src/dbus.c +++ b/src/dbus.c @@ -151,6 +151,7 @@ static struct proxy_node *find_matched_proxy_node(const char *dest, return NULL; } +//LCOV_EXCL_START Not called Callback static void on_name_vanished(GDBusConnection *connection, const gchar *name, gpointer user_data) @@ -174,6 +175,7 @@ static void on_name_vanished(GDBusConnection *connection, } pthread_mutex_unlock(&dmutex); } +//LCOV_EXCL_STOP static GDBusConnection *get_dbus_connection(void) { @@ -182,11 +184,13 @@ static GDBusConnection *get_dbus_connection(void) conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err); if (!conn) { + //LCOV_EXCL_START System Error if (err) _D("Fail to get dbus connection: %s", err->message); else _D("Fail to get dbus connection"); return NULL; + //LCOV_EXCL_STOP } return conn; @@ -242,12 +246,14 @@ static GDBusProxy *get_proxy_from_proxy_pool(const char *dest, node = malloc(sizeof(struct proxy_node)); if (!node) { + //LCOV_EXCL_START System Error g_object_unref(proxy); if (err) g_set_error(err, G_IO_ERROR, G_IO_ERROR_FAILED, "Cannot allocate proxy_node memory"); return NULL; + //LCOV_EXCL_STOP } node->proxy = proxy; @@ -294,6 +300,7 @@ int dbus_method_sync(const char *dest, const char *path, pthread_mutex_unlock(&dmutex); if (!output) { + //LCOV_EXCL_START System Error if (err) { _E("g_dbus_proxy_call_sync error : %s-%s (%d-%s)", interface, method, err->code, err->message); @@ -305,6 +312,7 @@ int dbus_method_sync(const char *dest, const char *path, result = -ECOMM; } return result; + //LCOV_EXCL_STOP } /* get output value */ @@ -315,6 +323,7 @@ int dbus_method_sync(const char *dest, const char *path, return result; } +//LCOV_EXCL_START Not called Callback static void feedback_signal_callback(GDBusConnection *conn, const gchar *sender, const gchar *path, @@ -348,6 +357,7 @@ static void feedback_signal_callback(GDBusConnection *conn, _E("Failed to call restart callback"); } } +//LCOV_EXCL_STOP int register_signal_handler(feedback_restart_cb func) { @@ -393,9 +403,11 @@ int register_signal_handler(feedback_restart_cb func) NULL, NULL); if (feedback_id == 0) { +//LCOV_EXCL_START System Error free(callback); _E("Failed to subscrive bus signal"); return -EPERM; +//LCOV_EXCL_STOP } callback->func = func; diff --git a/src/devices.c b/src/devices.c index e176ea0..5cc3663 100644 --- a/src/devices.c +++ b/src/devices.c @@ -29,10 +29,12 @@ void add_device(const struct device_ops *dev) DD_LIST_APPEND(dev_head, (struct device_ops*)dev); } +//LCOV_EXCL_START System Error void remove_device(const struct device_ops *dev) { DD_LIST_REMOVE(dev_head, (struct device_ops*)dev); } +//LCOV_EXCL_STOP const struct device_ops *find_device(int type) { diff --git a/src/feedback.c b/src/feedback.c index c6017b3..f8617dd 100644 --- a/src/feedback.c +++ b/src/feedback.c @@ -35,6 +35,7 @@ static unsigned int init_cnt; static pthread_mutex_t fmutex = PTHREAD_MUTEX_INITIALIZER; +//LCOV_EXCL_START Not called Callback static int restart_callback() { const struct device_ops *dev; @@ -48,6 +49,7 @@ static int restart_callback() dev->init(); return 0; } +//LCOV_EXCL_STOP API int feedback_initialize(void) { @@ -57,7 +59,7 @@ API int feedback_initialize(void) if (!profile) { _E("there is no valid profile module."); //LCOV_EXCL_LINE pthread_mutex_unlock(&fmutex); - return FEEDBACK_ERROR_NOT_SUPPORTED; + return FEEDBACK_ERROR_NOT_SUPPORTED; //LCOV_EXCL_LINE System Error } if (init_cnt++ > 0) { @@ -67,7 +69,7 @@ API int feedback_initialize(void) ret = register_signal_handler(restart_callback); if (ret < 0) - _E("Fail to register signal handler: %d", ret); + _E("Fail to register signal handler: %d", ret); //LCOV_EXCL_LINE System Error /* initialize device */ devices_init(); @@ -97,7 +99,7 @@ API int feedback_deinitialize(void) ret = unregister_signal_handler(restart_callback); if (ret < 0) - _E("Fail to unregister signal handler: %d", ret); + _E("Fail to unregister signal handler: %d", ret); //LCOV_EXCL_LINE System Error /* deinitialize device */ devices_exit(); diff --git a/src/vibrator.c b/src/vibrator.c index 62eb07b..5292fa8 100644 --- a/src/vibrator.c +++ b/src/vibrator.c @@ -195,9 +195,9 @@ static int vibrator_play(feedback_pattern_e pattern) int level; if ((int)v_handle <= 0) { - if (v_handle == 0) { + if (v_handle == 0) { //LCOV_EXCL_LINE System Error _E("Not initialized"); //LCOV_EXCL_LINE - return -ENOENT; + return -ENOENT; //LCOV_EXCL_LINE System Error } _E("Not supported vibration"); //LCOV_EXCL_LINE return v_handle; //LCOV_EXCL_LINE System Error @@ -261,9 +261,9 @@ static int vibrator_stop(void) int ret; if ((int)v_handle <= 0) { - if (v_handle == 0) { + if (v_handle == 0) { //LCOV_EXCL_LINE System Error _E("Not initialized"); //LCOV_EXCL_LINE - return -ENOENT; + return -ENOENT; //LCOV_EXCL_LINE System Error } _E("Not supported vibration"); //LCOV_EXCL_LINE return v_handle; //LCOV_EXCL_LINE System Error @@ -293,9 +293,9 @@ static int vibrator_is_supported(int pattern, bool *supported) } if ((int)v_handle <= 0) { - if (v_handle == 0) { + if (v_handle == 0) { //LCOV_EXCL_LINE System Error _E("Not initialized"); //LCOV_EXCL_LINE - return -ENOENT; + return -ENOENT; //LCOV_EXCL_LINE System Error } _E("Not supported vibration"); //LCOV_EXCL_LINE *supported = false; //LCOV_EXCL_LINE System Error @@ -332,6 +332,7 @@ static int vibrator_is_supported(int pattern, bool *supported) return 0; } +//LCOV_EXCL_START Not Supported Feature static int vibrator_get_path(feedback_pattern_e pattern, char *buf, unsigned int buflen) { return 0; @@ -341,6 +342,7 @@ static int vibrator_set_path(feedback_pattern_e pattern, char *path) { return 0; } +//LCOV_EXCL_STOP static const struct device_ops vibrator_device_ops = { .type = FEEDBACK_TYPE_VIBRATION, -- cgit v1.2.3