add excluding coverage comments for tdm_capture.c 78/161078/1
authorKonstantin Drabeniuk <k.drabeniuk@samsung.com>
Tue, 21 Nov 2017 09:35:59 +0000 (11:35 +0200)
committerKonstantin Drabeniuk <k.drabeniuk@samsung.com>
Tue, 21 Nov 2017 09:36:31 +0000 (11:36 +0200)
add excluding coverage comments for tdm_capture.c for folowing code:
- fail if the backend's function don't exist;
- fail if there is not capability;
- dump;
- calloc fail;
- check_module_abi fail;
- tdm_capture_create_layer_internal.

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

index 6be39eb..751056b 100644 (file)
@@ -130,10 +130,12 @@ tdm_capture_cb_done(tdm_capture *capture_backend, tbm_surface_h buffer,
                TDM_NEVER_GET_HERE();
 
        if (tdm_debug_dump & TDM_DUMP_FLAG_CAPTURE) {
+               /* LCOV_EXCL_START */
                char str[TDM_PATH_LEN];
                static int i;
                snprintf(str, TDM_PATH_LEN, "capture_%03d", i++);
                tdm_helper_dump_buffer_str(buffer, tdm_debug_dump_dir, str);
+               /* LCOV_EXCL_STOP */
        }
 
        if (tdm_debug_module & TDM_DEBUG_BUFFER)
@@ -190,44 +192,54 @@ tdm_capture_create_output_internal(tdm_private_output *private_output,
        TDM_RETURN_VAL_IF_FAIL(TDM_MUTEX_IS_LOCKED(), NULL);
 
        if (!(private_display->capabilities & TDM_DISPLAY_CAPABILITY_CAPTURE)) {
+               /* LCOV_EXCL_START */
                TDM_ERR("no capture capability");
                if (error)
                        *error = TDM_ERROR_NO_CAPABILITY;
                return NULL;
+               /* LCOV_EXCL_STOP */
        }
 
        if (!(private_display->caps_capture.capabilities & TDM_CAPTURE_CAPABILITY_OUTPUT)) {
+               /* LCOV_EXCL_START */
                TDM_ERR("no output capture capability");
                if (error)
                        *error = TDM_ERROR_NO_CAPABILITY;
                return NULL;
+               /* LCOV_EXCL_STOP */
        }
 
        capture_backend = func_output->output_create_capture(
                                                  private_output->output_backend, &ret);
        if (ret != TDM_ERROR_NONE) {
+               /* LCOV_EXCL_START */
                if (error)
                        *error = ret;
                return NULL;
+               /* LCOV_EXCL_STOP */
        }
 
        private_capture = calloc(1, sizeof(tdm_private_capture));
        if (!private_capture) {
+               /* LCOV_EXCL_START */
                TDM_ERR("failed: alloc memory");
                func_capture->capture_destroy(capture_backend);
                if (error)
                        *error = TDM_ERROR_OUT_OF_MEMORY;
                return NULL;
+               /* LCOV_EXCL_STOP */
        }
 
        ret = func_capture->capture_set_done_handler(capture_backend,
                        tdm_capture_cb_done, private_capture);
        if (ret != TDM_ERROR_NONE) {
+               /* LCOV_EXCL_START */
                TDM_ERR("capture(%p) set capture_done_handler failed", private_capture);
                func_capture->capture_destroy(capture_backend);
                if (error)
                        *error = ret;
                return NULL;
+               /* LCOV_EXCL_STOP */
        }
 
        private_capture->stamp = tdm_helper_get_time();
@@ -255,6 +267,7 @@ tdm_capture_create_output_internal(tdm_private_output *private_output,
        return private_capture;
 }
 
+/* LCOV_EXCL_START */
 INTERN tdm_private_capture *
 tdm_capture_create_layer_internal(tdm_private_layer *private_layer,
                                                                  tdm_error *error)
@@ -321,6 +334,7 @@ tdm_capture_create_layer_internal(tdm_private_layer *private_layer,
 
        return private_capture;
 }
+/* LCOV_EXCL_STOP */
 
 INTERN void
 tdm_capture_destroy_internal(tdm_private_capture *private_capture)
@@ -414,9 +428,11 @@ tdm_capture_set_info(tdm_capture *capture, tdm_info_capture *info)
        _pthread_mutex_lock(&private_display->lock);
 
        if (!func_capture->capture_set_info) {
+               /* LCOV_EXCL_START */
                _pthread_mutex_unlock(&private_display->lock);
                TDM_DBG("failed: not implemented!!");
                return TDM_ERROR_NOT_IMPLEMENTED;
+               /* LCOV_EXCL_STOP */
        }
 
        if (info->type == TDM_CAPTURE_TYPE_STREAM && info->frequency == 0) {
@@ -478,13 +494,16 @@ tdm_capture_attach(tdm_capture *capture, tbm_surface_h buffer)
        _pthread_mutex_lock(&private_display->lock);
 
        if (!func_capture->capture_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_capture.max_attach_count > 0) {
+               /* LCOV_EXCL_START */
                int length = LIST_LENGTH(&private_capture->pending_buffer_list) +
                                         LIST_LENGTH(&private_capture->buffer_list);
                if (length >= private_display->caps_capture.max_attach_count) {
@@ -493,23 +512,28 @@ tdm_capture_attach(tdm_capture *capture, tbm_surface_h buffer)
                                        private_display->caps_capture.max_attach_count);
                        return TDM_ERROR_BAD_REQUEST;
                }
+               /* LCOV_EXCL_STOP */
        }
 
        capture_buffer = calloc(1, sizeof * capture_buffer);
        if (!capture_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_capture->capture_attach(private_capture->capture_backend, buffer);
        TDM_WARNING_IF_FAIL(ret == TDM_ERROR_NONE);
 
        if (ret != TDM_ERROR_NONE) {
+               /* LCOV_EXCL_START */
                free(capture_buffer);
                _pthread_mutex_unlock(&private_display->lock);
                TDM_ERR("attach failed");
                return ret;
+               /* LCOV_EXCL_STOP */
        }
 
        LIST_ADDTAIL(&capture_buffer->link, &private_capture->pending_buffer_list);
@@ -545,9 +569,11 @@ tdm_capture_commit(tdm_capture *capture)
        }
 
        if (!func_capture->capture_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);
@@ -568,6 +594,7 @@ tdm_capture_commit(tdm_capture *capture)
                        continue;
 
                if (ret != TDM_ERROR_NONE) {
+                       /* LCOV_EXCL_START */
                        /* Not to call the user release handler when failed.
                         * Do we have to call this function here really?
                         * User better use set_done_handler to know when pp is done. Using
@@ -581,6 +608,7 @@ tdm_capture_commit(tdm_capture *capture)
                        LIST_DEL(&b->link);
 
                        free(b);
+                       /* LCOV_EXCL_STOP */
                }
        }