add excluding coverage comments for tdm_monitor_server.c and tdm_output.c 22/161622/2
authorKonstantin Drabeniuk <k.drabeniuk@samsung.com>
Fri, 24 Nov 2017 10:44:14 +0000 (12:44 +0200)
committerRoman Marchenko <r.marchenko@samsung.com>
Sun, 26 Nov 2017 11:25:55 +0000 (13:25 +0200)
add excluding coverage comments for tdm_monitor_server.c for all file.

add excluding coverage comments for tdm_output.c for folowing code:
- dump;
- calloc fail;
- fail if the backend's function don't exist;
- fail in the backend's function
- tdm_output_set_dpms_async()
- fail if there is not capability;

Change-Id: I7541c992ddc2f9ea5bb18ab77e97de2a3ed2cf28
Signed-off-by: Konstantin Drabeniuk <k.drabeniuk@samsung.com>
src/tdm_monitor_server.c
src/tdm_output.c

index 0d92cef..ea56a8b 100644 (file)
@@ -45,6 +45,7 @@
 
 #define TDM_DBG_SERVER_ARGS_MAX                32
 
+/* LCOV_EXCL_START */
 static void _tdm_monitor_server_usage(char *app_name, char *reply, int *len);
 
 static void
@@ -702,3 +703,4 @@ tdm_monitor_server_command(tdm_display *dpy, const char *options, char *reply, i
 
        _tdm_monitor_server_command(pid, cwd, dpy, argc, argv, reply, len);
 }
+/* LCOV_EXCL_STOP */
index 078946a..855c352 100644 (file)
@@ -127,6 +127,7 @@ tdm_output_get_conn_status(tdm_output *output, tdm_output_conn_status *status)
        return ret;
 }
 
+/* LCOV_EXCL_START */
 static void
 _tdm_output_update(tdm_output *output_backend, void *user_data)
 {
@@ -192,6 +193,7 @@ tdm_output_cb_status(tdm_output *output_backend, tdm_output_conn_status status,
                                                                                        TDM_OUTPUT_CHANGE_CONNECTION,
                                                                                        value, 0);
 }
+/* LCOV_EXCL_STOP */
 
 EXTERN tdm_error
 tdm_output_add_change_handler(tdm_output *output,
@@ -207,9 +209,11 @@ tdm_output_add_change_handler(tdm_output *output,
 
        change_handler = calloc(1, sizeof(tdm_private_change_handler));
        if (!change_handler) {
+               /* LCOV_EXCL_START */
                TDM_ERR("failed: alloc memory");
                _pthread_mutex_unlock(&private_display->lock);
                return TDM_ERROR_OUT_OF_MEMORY;
+               /* LCOV_EXCL_STOP */
        }
 
        change_handler->private_output = private_output;
@@ -536,9 +540,11 @@ tdm_output_set_property(tdm_output *output, unsigned int id, tdm_value value)
        func_output = &private_display->func_output;
 
        if (!func_output->output_set_property) {
+               /* LCOV_EXCL_START */
                _pthread_mutex_unlock(&private_display->lock);
                TDM_ERR("not implemented!!");
                return TDM_ERROR_NOT_IMPLEMENTED;
+               /* LCOV_EXCL_STOP */
        }
 
        ret = func_output->output_set_property(private_output->output_backend, id,
@@ -562,9 +568,11 @@ tdm_output_get_property(tdm_output *output, unsigned int id, tdm_value *value)
        func_output = &private_display->func_output;
 
        if (!func_output->output_get_property) {
+               /* LCOV_EXCL_START */
                _pthread_mutex_unlock(&private_display->lock);
                TDM_ERR("not implemented!!");
                return TDM_ERROR_NOT_IMPLEMENTED;
+               /* LCOV_EXCL_STOP */
        }
 
        ret = func_output->output_get_property(private_output->output_backend, id,
@@ -734,8 +742,10 @@ _tdm_output_wait_vblank(tdm_output *output, int interval, int sync,
                interval = 1;
 
        if (!func_output->output_wait_vblank) {
+               /* LCOV_EXCL_START */
                TDM_ERR("not implemented!!");
                return TDM_ERROR_NOT_IMPLEMENTED;
+               /* LCOV_EXCL_STOP */
        }
 
        if (!private_output->regist_vblank_cb) {
@@ -746,8 +756,10 @@ _tdm_output_wait_vblank(tdm_output *output, int interval, int sync,
 
        vblank_handler = calloc(1, sizeof(tdm_private_vblank_handler));
        if (!vblank_handler) {
+               /* LCOV_EXCL_START */
                TDM_ERR("failed: alloc memory");
                return TDM_ERROR_OUT_OF_MEMORY;
+               /* LCOV_EXCL_STOP */
        }
 
        if (tdm_debug_module & TDM_DEBUG_COMMIT)
@@ -785,11 +797,13 @@ _tdm_output_wait_vblank(tdm_output *output, int interval, int sync,
        return ret;
 
 wait_failed:
+       /* LCOV_EXCL_START */
        if (vblank_handler) {
                LIST_DEL(&vblank_handler->link);
                free(vblank_handler);
        }
        return ret;
+       /* LCOV_EXCL_STOP */
 }
 
 EXTERN tdm_error
@@ -814,6 +828,7 @@ tdm_output_wait_vblank(tdm_output *output, int interval, int sync,
        return ret;
 }
 
+/* LCOV_EXCL_START */
 EXTERN tdm_error
 tdm_output_wait_vblank_add_front(tdm_output *output, int interval, int sync,
                                                                 tdm_output_vblank_handler func, void *user_data)
@@ -835,6 +850,7 @@ tdm_output_wait_vblank_add_front(tdm_output *output, int interval, int sync,
 
        return ret;
 }
+/* LCOV_EXCL_STOP */
 
 INTERN void
 tdm_output_remove_vblank_handler_internal(tdm_output *output, tdm_output_vblank_handler func, void *user_data)
@@ -915,8 +931,10 @@ tdm_output_commit_internal(tdm_output *output, int sync, tdm_output_commit_handl
        func_output = &private_display->func_output;
 
        if (!func_output->output_commit) {
+               /* LCOV_EXCL_START */
                TDM_ERR("not implemented!!");
                return TDM_ERROR_NOT_IMPLEMENTED;
+               /* LCOV_EXCL_STOP */
        }
 
        ret = tdm_output_get_dpms_internal(output, &dpms_value);
@@ -933,8 +951,10 @@ tdm_output_commit_internal(tdm_output *output, int sync, tdm_output_commit_handl
 
                        output_commit_handler = calloc(1, sizeof(tdm_private_output_commit_handler));
                        if (!output_commit_handler) {
+                               /* LCOV_EXCL_START */
                                TDM_ERR("failed: alloc memory");
                                return TDM_ERROR_OUT_OF_MEMORY;
+                               /* LCOV_EXCL_STOP */
                        }
 
                        LIST_ADDTAIL(&output_commit_handler->link, &private_output->output_commit_handler_list);
@@ -977,11 +997,13 @@ tdm_output_commit_internal(tdm_output *output, int sync, tdm_output_commit_handl
        return ret;
 
 commit_failed:
+       /* LCOV_EXCL_START */
        if (output_commit_handler) {
                LIST_DEL(&output_commit_handler->link);
                free(output_commit_handler);
        }
        return ret;
+       /* LCOV_EXCL_STOP */
 }
 
 EXTERN tdm_error
@@ -1043,9 +1065,11 @@ tdm_output_set_mode(tdm_output *output, const tdm_output_mode *mode)
        func_output = &private_display->func_output;
 
        if (!func_output->output_set_mode) {
+               /* LCOV_EXCL_START */
                _pthread_mutex_unlock(&private_display->lock);
                TDM_ERR("not implemented!!");
                return TDM_ERROR_NOT_IMPLEMENTED;
+               /* LCOV_EXCL_STOP */
        }
 
        ret = func_output->output_set_mode(private_output->output_backend, mode);
@@ -1087,6 +1111,7 @@ _tdm_output_dpms_changed_timeout(void *user_data)
        return TDM_ERROR_NONE;
 }
 
+/* LCOV_EXCL_START */
 INTERN void
 tdm_output_cb_dpms(tdm_output *output_backend, tdm_output_dpms dpms, void *user_data)
 {
@@ -1134,6 +1159,7 @@ tdm_output_cb_dpms(tdm_output *output_backend, tdm_output_dpms dpms, void *user_
                                                                                        TDM_OUTPUT_CHANGE_DPMS,
                                                                                        value, 0);
 }
+/* LCOV_EXCL_STOP */
 
 EXTERN tdm_error
 tdm_output_set_dpms(tdm_output *output, tdm_output_dpms dpms_value)
@@ -1168,9 +1194,11 @@ tdm_output_set_dpms(tdm_output *output, tdm_output_dpms dpms_value)
                        tdm_event_loop_add_timer_handler(private_output->private_display,
                                                                                         _tdm_output_dpms_changed_timeout, private_output, NULL);
                if (!private_output->dpms_changed_timer) {
+                       /* LCOV_EXCL_START */
                        TDM_ERR("can't create dpms timer!!");
                        _pthread_mutex_unlock(&private_display->lock);
                        return TDM_ERROR_OUT_OF_MEMORY;
+                       /* LCOV_EXCL_STOP */
                }
        }
 
@@ -1181,9 +1209,11 @@ tdm_output_set_dpms(tdm_output *output, tdm_output_dpms dpms_value)
        if (func_output->output_set_dpms)
                ret = func_output->output_set_dpms(private_output->output_backend, dpms_value);
        else {
+               /* LCOV_EXCL_START */
                ret = TDM_ERROR_NONE;
                TDM_WRN("not implemented!!");
                goto done;
+               /* LCOV_EXCL_STOP */
        }
 
 done:
@@ -1211,6 +1241,7 @@ done:
        return ret;
 }
 
+/* LCOV_EXCL_START */
 EXTERN tdm_error
 tdm_output_set_dpms_async(tdm_output *output, tdm_output_dpms dpms_value)
 {
@@ -1275,6 +1306,7 @@ tdm_output_set_dpms_async(tdm_output *output, tdm_output_dpms dpms_value)
 
        return ret;
 }
+/* LCOV_EXCL_STOP */
 
 INTERN tdm_error
 tdm_output_get_dpms_internal(tdm_output *output, tdm_output_dpms *dpms_value)
@@ -1297,15 +1329,19 @@ tdm_output_get_dpms_internal(tdm_output *output, tdm_output_dpms *dpms_value)
        func_output = &private_display->func_output;
 
        if (!func_output->output_get_dpms) {
+               /* LCOV_EXCL_START */
                *dpms_value = private_output->current_dpms_value;
                TDM_WRN("not implemented!!");
                return TDM_ERROR_NONE;
+               /* LCOV_EXCL_STOP */
        }
 
        ret = func_output->output_get_dpms(private_output->output_backend, dpms_value);
        if (ret != TDM_ERROR_NONE) {
+               /* LCOV_EXCL_START */
                TDM_ERR("output_get_dpms failed");
                *dpms_value = TDM_OUTPUT_DPMS_OFF;
+               /* LCOV_EXCL_STOP */
        }
 
        /* TODO: this is ugly. But we have to check if all backends's DPMS operation has no problem. */
@@ -1363,9 +1399,11 @@ tdm_output_hwc_create_window(tdm_output *output, tdm_error *error)
        if (private_output->caps.capabilities & TDM_OUTPUT_CAPABILITY_HWC)
                hwc_window = (tdm_hwc_window *)tdm_hwc_window_create_internal(private_output, error);
        else {
+               /* LCOV_EXCL_START */
                TDM_ERR("output(%p) not support HWC", private_output);
                if (error)
                        *error = TDM_ERROR_BAD_REQUEST;
+               /* LCOV_EXCL_STOP */
        }
 
        _pthread_mutex_unlock(&private_display->lock);
@@ -1409,9 +1447,11 @@ tdm_output_hwc_validate(tdm_output *output, uint32_t *num_types)
        func_output = &private_display->func_output;
 
        if (!func_output->output_hwc_validate) {
+               /* LCOV_EXCL_START */
                _pthread_mutex_unlock(&private_display->lock);
                TDM_ERR("not implemented!!");
                return TDM_ERROR_NOT_IMPLEMENTED;
+               /* LCOV_EXCL_STOP */
        }
 
        ret = func_output->output_hwc_validate(private_output->output_backend, num_types);
@@ -1476,16 +1516,20 @@ tdm_output_hwc_get_changed_composition_types(tdm_output *output,
        func_output = &private_display->func_output;
 
        if (!func_output->output_hwc_get_changed_composition_types) {
+               /* LCOV_EXCL_START */
                _pthread_mutex_unlock(&private_display->lock);
                TDM_ERR("not implemented!!");
                return TDM_ERROR_NOT_IMPLEMENTED;
+               /* LCOV_EXCL_STOP */
        }
 
        ret = func_output->output_hwc_get_changed_composition_types(private_output->output_backend,
                                                        num_elements, hwc_window, composition_types);
        if (ret != TDM_ERROR_NONE) {
+               /* LCOV_EXCL_START */
                _pthread_mutex_unlock(&private_display->lock);
                return ret;
+               /* LCOV_EXCL_STOP */
        }
 
        if (hwc_window == NULL || composition_types == NULL) {
@@ -1498,11 +1542,13 @@ tdm_output_hwc_get_changed_composition_types(tdm_output *output,
                private_hwc_window = _tdm_output_find_private_hwc_window(private_output, hwc_window[i]);
 
                if (private_hwc_window == NULL) {
+                       /* LCOV_EXCL_START */
                        TDM_ERR("failed! This should never happen!");
                        func_output->output_hwc_destroy_window(private_output->output_backend, hwc_window[i]);
                        *num_elements = 0;
                        _pthread_mutex_unlock(&private_display->lock);
                        return TDM_ERROR_OPERATION_FAILED;
+                       /* LCOV_EXCL_STOP */
                }
 
                hwc_window[i] = (tdm_hwc_window*)private_hwc_window;
@@ -1531,9 +1577,11 @@ tdm_output_hwc_accept_changes(tdm_output *output)
        func_output = &private_display->func_output;
 
        if (!func_output->output_hwc_validate) {
+               /* LCOV_EXCL_START */
                _pthread_mutex_unlock(&private_display->lock);
                TDM_ERR("not implemented!!");
                return TDM_ERROR_NOT_IMPLEMENTED;
+               /* LCOV_EXCL_STOP */
        }
 
        ret = func_output->output_hwc_accept_changes(private_output->output_backend);
@@ -1564,9 +1612,11 @@ tdm_output_hwc_get_target_buffer_queue(tdm_output *output, tdm_error *error)
        func_output = &private_display->func_output;
 
        if (!func_output->output_hwc_get_target_buffer_queue) {
+               /* LCOV_EXCL_START */
                _pthread_mutex_unlock(&private_display->lock);
                TDM_ERR("not implemented!!");
                return NULL;
+               /* LCOV_EXCL_STOP */
        }
 
        queue = func_output->output_hwc_get_target_buffer_queue(private_output->output_backend, error);
@@ -1576,6 +1626,7 @@ tdm_output_hwc_get_target_buffer_queue(tdm_output *output, tdm_error *error)
        return queue;
 }
 
+/* LCOV_EXCL_START */
 static void
 _tdm_target_window_dump_buffer(tdm_private_output *private_output, tbm_surface_h buffer)
 {
@@ -1591,6 +1642,7 @@ _tdm_target_window_dump_buffer(tdm_private_output *private_output, tbm_surface_h
 
        return;
 }
+/* LCOV_EXCL_STOP */
 
 EXTERN tdm_error
 tdm_output_hwc_set_client_target_buffer(tdm_output *output, tbm_surface_h target_buffer,
@@ -1609,24 +1661,30 @@ tdm_output_hwc_set_client_target_buffer(tdm_output *output, tbm_surface_h target
        }
 
        if (tdm_debug_dump & TDM_DUMP_FLAG_WINDOW) {
+               /* LCOV_EXCL_START */
                char str[TDM_PATH_LEN];
                static int i;
                snprintf(str, TDM_PATH_LEN, "target_window_%d_%03d",
                                 private_output->index, i++);
                tdm_helper_dump_buffer_str(target_buffer, tdm_debug_dump_dir, str);
+               /* LCOV_EXCL_STOP */
        }
 
        func_output = &private_display->func_output;
 
        if (!func_output->output_hwc_set_client_target_buffer) {
+               /* LCOV_EXCL_START */
                _pthread_mutex_unlock(&private_display->lock);
                TDM_ERR("not implemented!!");
                return TDM_ERROR_NOT_IMPLEMENTED;
+               /* LCOV_EXCL_STOP */
        }
 
        /* dump buffer */
        if (tdm_dump_enable)
+       /* LCOV_EXCL_START */
                _tdm_target_window_dump_buffer((tdm_private_output *)output, target_buffer);
+       /* LCOV_EXCL_STOP */
 
        ret = func_output->output_hwc_set_client_target_buffer(private_output->output_backend, target_buffer, damage);