add excluding coverage comments for tdm_pp.c 33/160533/1
authorKonstantin Drabeniuk <k.drabeniuk@samsung.com>
Thu, 16 Nov 2017 15:21:57 +0000 (17:21 +0200)
committerKonstantin Drabeniuk <k.drabeniuk@samsung.com>
Thu, 16 Nov 2017 15:21:57 +0000 (17:21 +0200)
add excluding coverage comments for tdm_pp.c for folowing code:
- fail if the backend's function don't exist;
- dump;
- calloc fail;
- check_module_abi fail.

Change-Id: Ie4dd5dfbd086b858f9235afd72ab7b6518714dc9

src/tdm_pp.c

index ab95105..a58e4fc 100644 (file)
@@ -131,10 +131,12 @@ tdm_pp_cb_done(tdm_pp *pp_backend, tbm_surface_h src, tbm_surface_h dst,
                TDM_NEVER_GET_HERE();
 
        if (tdm_debug_dump & TDM_DUMP_FLAG_PP) {
+               /* LCOV_EXCL_START */
                char str[TDM_PATH_LEN];
                static int i;
                snprintf(str, TDM_PATH_LEN, "pp_dst_%03d", i++);
                tdm_helper_dump_buffer_str(dst, tdm_debug_dump_dir, str);
+               /* LCOV_EXCL_STOP */
        }
 
        if (tdm_debug_module & TDM_DEBUG_BUFFER)
@@ -193,35 +195,43 @@ tdm_pp_create_internal(tdm_private_display *private_display, tdm_error *error)
        func_pp = &private_display->func_pp;
 
        if (!(private_display->capabilities & TDM_DISPLAY_CAPABILITY_PP)) {
+               /* LCOV_EXCL_START */
                TDM_ERR("no pp capability");
                if (error)
                        *error = TDM_ERROR_NO_CAPABILITY;
                return NULL;
+               /* LCOV_EXCL_STOP */
        }
 
        pp_backend = func_display->display_create_pp(private_display->bdata, &ret);
        if (ret != TDM_ERROR_NONE) {
+               /* LCOV_EXCL_START */
                if (error)
                        *error = ret;
                return NULL;
+               /* LCOV_EXCL_STOP */
        }
 
        private_pp = calloc(1, sizeof(tdm_private_pp));
        if (!private_pp) {
+               /* LCOV_EXCL_START */
                TDM_ERR("failed: alloc memory");
                func_pp->pp_destroy(pp_backend);
                if (error)
                        *error = TDM_ERROR_OUT_OF_MEMORY;
                return NULL;
+               /* LCOV_EXCL_STOP */
        }
 
        ret = func_pp->pp_set_done_handler(pp_backend, tdm_pp_cb_done, private_pp);
        if (ret != TDM_ERROR_NONE) {
+               /* LCOV_EXCL_START */
                TDM_ERR("spp(%p) et pp_done_handler failed", private_pp);
                func_pp->pp_destroy(pp_backend);
                if (error)
                        *error = ret;
                return NULL;
+               /* LCOV_EXCL_STOP */
        }
 
        private_pp->stamp = tdm_helper_get_time();
@@ -332,9 +342,11 @@ tdm_pp_set_info(tdm_pp *pp, tdm_info_pp *info)
        _pthread_mutex_lock(&private_display->lock);
 
        if (!func_pp->pp_set_info) {
+               /* LCOV_EXCL_START */
                _pthread_mutex_unlock(&private_display->lock);
                TDM_DBG("failed: not implemented!!");
                return TDM_ERROR_NOT_IMPLEMENTED;
+               /* LCOV_EXCL_STOP */
        }
 
        TDM_INFO("pp(%p) info: src(%dx%d %d,%d %dx%d %c%c%c%c) dst(%dx%d %d,%d %dx%d %c%c%c%c) trans(%d) sync(%d) flags(%x)",
@@ -395,13 +407,16 @@ tdm_pp_attach(tdm_pp *pp, tbm_surface_h src, tbm_surface_h dst)
        _pthread_mutex_lock(&private_display->lock);
 
        if (!func_pp->pp_attach) {
+               /* LCOV_EXCL_START */
                _pthread_mutex_unlock(&private_display->lock);
                TDM_DBG("failed: not implemented!!");
                return TDM_ERROR_NOT_IMPLEMENTED;
+               /* LCOV_EXCL_STOP */
        }
 
        if (tdm_display_check_module_abi(private_display, 1, 2) &&
                private_display->caps_pp.max_attach_count > 0) {
+               /* LCOV_EXCL_START */
                int length = LIST_LENGTH(&private_pp->pending_buffer_list) +
                                         LIST_LENGTH(&private_pp->buffer_list);
                if (length >= private_display->caps_pp.max_attach_count) {
@@ -410,30 +425,37 @@ tdm_pp_attach(tdm_pp *pp, tbm_surface_h src, tbm_surface_h dst)
                                        private_display->caps_pp.max_attach_count);
                        return TDM_ERROR_BAD_REQUEST;
                }
+               /* LCOV_EXCL_STOP */
        }
 
        if (tdm_debug_dump & TDM_DUMP_FLAG_PP) {
+               /* LCOV_EXCL_START */
                char str[TDM_PATH_LEN];
                static int i;
                snprintf(str, TDM_PATH_LEN, "pp_src_%03d", i++);
                tdm_helper_dump_buffer_str(src, tdm_debug_dump_dir, str);
+               /* LCOV_EXCL_STOP */
        }
 
        pp_buffer = calloc(1, sizeof * pp_buffer);
        if (!pp_buffer) {
+               /* LCOV_EXCL_START */
                _pthread_mutex_unlock(&private_display->lock);
                TDM_ERR("alloc failed");
                return TDM_ERROR_OUT_OF_MEMORY;
+               /* LCOV_EXCL_STOP */
        }
 
        ret = func_pp->pp_attach(private_pp->pp_backend, src, dst);
        TDM_WARNING_IF_FAIL(ret == TDM_ERROR_NONE);
 
        if (ret != TDM_ERROR_NONE) {
+               /* LCOV_EXCL_START */
                free(pp_buffer);
                _pthread_mutex_unlock(&private_display->lock);
                TDM_ERR("attach failed");
                return ret;
+               /* LCOV_EXCL_STOP */
        }
 
        LIST_ADDTAIL(&pp_buffer->link, &private_pp->pending_buffer_list);
@@ -461,9 +483,11 @@ tdm_pp_commit(tdm_pp *pp)
        _pthread_mutex_lock(&private_display->lock);
 
        if (!func_pp->pp_commit) {
+               /* LCOV_EXCL_START */
                _pthread_mutex_unlock(&private_display->lock);
                TDM_DBG("failed: not implemented!!");
                return TDM_ERROR_NOT_IMPLEMENTED;
+               /* LCOV_EXCL_STOP */
        }
 
        LIST_INITHEAD(&commit_buffer_list);