add excluding coverage comments for tdm_layer.c 47/160347/1
authorKonstantin Drabeniuk <k.drabeniuk@samsung.com>
Wed, 15 Nov 2017 12:29:24 +0000 (14:29 +0200)
committerKonstantin Drabeniuk <k.drabeniuk@samsung.com>
Wed, 15 Nov 2017 12:37:35 +0000 (14:37 +0200)
add excluding coverage comments for tdm_layer.c for folowing code:
- fail if the backend's function don't exist;
- dump;
- print fps;
- calloc fail;
- fail in the TBM.

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

index 2465675..cca078e 100644 (file)
@@ -167,9 +167,11 @@ tdm_layer_set_property(tdm_layer *layer, unsigned int id, tdm_value value)
        private_layer->usable = 0;
 
        if (!func_layer->layer_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_layer->layer_set_property(private_layer->layer_backend, id, value);
@@ -192,9 +194,11 @@ tdm_layer_get_property(tdm_layer *layer, unsigned int id, tdm_value *value)
        func_layer = &private_display->func_layer;
 
        if (!func_layer->layer_get_property) {
+               /* LCOV_EXCL_START */
                _pthread_mutex_unlock(&private_display->lock);
                TDM_ERR("not implemented!!");
                return TDM_ERROR_NOT_IMPLEMENTED;
+               /* LCOV_EXCL_SOP */
        }
 
        ret = func_layer->layer_get_property(private_layer->layer_backend, id, value);
@@ -224,9 +228,11 @@ tdm_layer_set_info(tdm_layer *layer, tdm_info_layer *info)
        private_layer->usable = 0;
 
        if (!func_layer->layer_set_info) {
+               /* LCOV_EXCL_START */
                _pthread_mutex_unlock(&private_display->lock);
                TDM_ERR("not implemented!!");
                return TDM_ERROR_NOT_IMPLEMENTED;
+               /* LCOV_EXCL_STOP */
        }
 
        if (info->src_config.format)
@@ -264,9 +270,11 @@ tdm_layer_get_info(tdm_layer *layer, tdm_info_layer *info)
        func_layer = &private_display->func_layer;
 
        if (!func_layer->layer_get_info) {
+               /* LCOV_EXCL_START */
                _pthread_mutex_unlock(&private_display->lock);
                TDM_ERR("not implemented!!");
                return TDM_ERROR_NOT_IMPLEMENTED;
+               /* LCOV_EXCL_STOP */
        }
 
        ret = func_layer->layer_get_info(private_layer->layer_backend, info);
@@ -276,6 +284,7 @@ tdm_layer_get_info(tdm_layer *layer, tdm_info_layer *info)
        return ret;
 }
 
+/* LCOV_EXCL_START */
 static void
 _tdm_layer_dump_buffer(tdm_layer *layer, tbm_surface_h buffer)
 {
@@ -305,6 +314,7 @@ _tdm_layer_dump_buffer(tdm_layer *layer, tbm_surface_h buffer)
 
        return;
 }
+/* LCOV_EXCL_STOP */
 
 static void
 _tdm_layer_free_buffer(tdm_private_layer *private_layer, tdm_private_layer_buffer *layer_buffer)
@@ -410,6 +420,7 @@ tdm_layer_set_buffer(tdm_layer *layer, tbm_surface_h buffer)
 
        _pthread_mutex_lock(&private_display->lock);
 
+       /* LCOV_EXCL_START */
        /* dump buffer */
        if (tdm_dump_enable && !(private_layer->caps.capabilities & TDM_LAYER_CAPABILITY_VIDEO))
                _tdm_layer_dump_buffer(private_layer, buffer);
@@ -422,6 +433,7 @@ tdm_layer_set_buffer(tdm_layer *layer, tbm_surface_h buffer)
                                 private_output->index, private_layer->index, i++);
                tdm_helper_dump_buffer_str(buffer, tdm_debug_dump_dir, str);
        }
+       /* LCOV_EXCL_STOP */
 
        func_layer = &private_display->func_layer;
 
@@ -431,9 +443,11 @@ tdm_layer_set_buffer(tdm_layer *layer, tbm_surface_h buffer)
        private_layer->usable = 0;
 
        if (!func_layer->layer_set_buffer) {
+               /* LCOV_EXCL_START */
                _pthread_mutex_unlock(&private_display->lock);
                TDM_ERR("not implemented!!");
                return TDM_ERROR_NOT_IMPLEMENTED;
+               /* LCOV_EXCL_START */
        }
 
        private_layer->pending_buffer_changed = 1;
@@ -476,9 +490,11 @@ tdm_layer_unset_buffer(tdm_layer *layer)
                TDM_INFO("layer(%p) now usable", private_layer);
 
        if (!func_layer->layer_unset_buffer) {
+               /* LCOV_EXCL_START */
                _pthread_mutex_unlock(&private_display->lock);
                TDM_ERR("not implemented!!");
                return TDM_ERROR_NOT_IMPLEMENTED;
+               /* LCOV_EXCL_START */
        }
 
        ret = func_layer->layer_unset_buffer(private_layer->layer_backend);
@@ -495,6 +511,7 @@ tdm_layer_committed(tdm_private_layer *private_layer, tdm_private_layer_buffer *
        tdm_private_output *private_output = private_layer->private_output;
        tdm_private_display *private_display = private_output->private_display;
 
+       /* LCOV_EXCL_START */
        if (private_display->print_fps) {
                double curr = tdm_helper_get_time();
                if (private_layer->fps_stamp == 0) {
@@ -509,6 +526,7 @@ tdm_layer_committed(tdm_private_layer *private_layer, tdm_private_layer_buffer *
                private_layer->fps_stamp = 0;
                private_layer->fps_count = 0;
        }
+       /* LCOV_EXCL_STOP */
 
        if (private_layer->showing_buffer)
                _tdm_layer_free_buffer(private_layer, private_layer->showing_buffer);
@@ -815,8 +833,10 @@ _tdm_layer_commit(tdm_layer *layer, tdm_layer_commit_handler func, void *user_da
 
        layer_commit_handler = calloc(1, sizeof(tdm_private_layer_commit_handler));
        if (!layer_commit_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)
@@ -1036,25 +1056,31 @@ _tbm_layer_queue_acquirable_cb(tbm_surface_queue_h surface_queue, void *data)
 
        func_layer = &private_display->func_layer;
        if (!func_layer->layer_set_buffer) {
+               /* LCOV_EXCL_START */
                _pthread_mutex_unlock(&private_display->lock);
                return;
+               /* LCOV_EXCL_STOP */
        }
 
        layer_buffer = calloc(1, sizeof(tdm_private_layer_buffer));
        if (!layer_buffer) {
+               /* LCOV_EXCL_START */
                _pthread_mutex_unlock(&private_display->lock);
                TDM_ERR("alloc failed");
                return;
+               /* LCOV_EXCL_STOP */
        }
        LIST_INITHEAD(&layer_buffer->link);
 
        if (TBM_SURFACE_QUEUE_ERROR_NONE != tbm_surface_queue_acquire(private_layer->buffer_queue, &surface) ||
                surface == NULL) {
+               /* LCOV_EXCL_START */
                TDM_ERR("layer(%p) tbm_surface_queue_acquire() failed surface:%p",
                                private_layer, surface);
                _pthread_mutex_unlock(&private_display->lock);
                free(layer_buffer);
                return;
+               /* LCOV_EXCL_STOP */
        }
 
        /* we don't need to handle pending data here because the changes in this function
@@ -1128,9 +1154,11 @@ tdm_layer_set_buffer_queue(tdm_layer *layer, tbm_surface_queue_h buffer_queue)
        private_layer->usable = 0;
 
        if (!func_layer->layer_set_buffer) {
+               /* LCOV_EXCL_START */
                _pthread_mutex_unlock(&private_display->lock);
                TDM_ERR("not implemented!!");
                return TDM_ERROR_NOT_IMPLEMENTED;
+               /* LCOV_EXCL_STOP */
        }
 
        if (buffer_queue == private_layer->buffer_queue) {
@@ -1198,9 +1226,11 @@ tdm_layer_set_video_pos(tdm_layer *layer, int zpos)
        }
 
        if (!func_layer->layer_set_video_pos) {
+               /* LCOV_EXCL_START */
                _pthread_mutex_unlock(&private_display->lock);
                TDM_ERR("not implemented!!");
                return TDM_ERROR_NOT_IMPLEMENTED;
+               /* LCOV_EXCL_STOP */
        }
 
        ret = func_layer->layer_set_video_pos(private_layer->layer_backend, zpos);
@@ -1237,9 +1267,11 @@ tdm_layer_get_buffer_flags(tdm_layer *layer, unsigned int *flags)
        func_layer = &private_display->func_layer;
 
        if (!func_layer->layer_get_buffer_flags) {
+               /* LCOV_EXCL_START */
                _pthread_mutex_unlock(&private_display->lock);
                TDM_ERR("not implemented!!");
                return TDM_ERROR_NOT_IMPLEMENTED;
+               /* LCOV_EXCL_STOP */
        }
 
        ret = func_layer->layer_get_buffer_flags(private_layer->layer_backend, flags);