Add comments for line coverage test
authorJeongmo Yang <jm80.yang@samsung.com>
Mon, 15 May 2017 05:01:50 +0000 (14:01 +0900)
committerJeongmo Yang <jm80.yang@samsung.com>
Mon, 15 May 2017 05:01:50 +0000 (14:01 +0900)
[Version] 0.3.0
[Profile] Common
[Issue Type] Update
[Dependency module] N/A

Change-Id: I05c0abd9df7c36872a6c5fa1d903298403948588
Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
CMakeLists.txt
src/camera.c
src/camera_internal.c

index 39523d9..75c5ab4 100644 (file)
@@ -31,7 +31,7 @@ FOREACH(flag ${${fw_name}_CFLAGS})
     SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
 ENDFOREACH(flag)
 
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Wextra -Wno-array-bounds -Wno-empty-body -Wno-ignored-qualifiers -Wno-unused-parameter -Wshadow -Wwrite-strings -Wswitch-default -Wno-unused-but-set-parameter -Wno-unused-but-set-variable")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Wextra -Wno-array-bounds -Wno-empty-body -Wno-ignored-qualifiers -Wno-unused-parameter -Wshadow -Wwrite-strings -Wswitch-default -Wno-unused-but-set-parameter -Wno-unused-but-set-variable -fprofile-arcs -ftest-coverage")
 SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
 
 IF("${ARCH}" STREQUAL "arm")
index 4e83dec..8f063b1 100644 (file)
@@ -52,6 +52,7 @@ static GDBusConnection *g_cam_dev_state_changed_cb_conn;
 static guint g_cam_dev_state_changed_cb_subscribe_id;
 
 
+//LCOV_EXCL_START
 static void __global(void *data, struct wl_registry *registry,
        uint32_t name, const char *interface, uint32_t version)
 {
@@ -261,6 +262,7 @@ _DONE:
 
        return ret;
 }
+//LCOV_EXCL_STOP
 
 
 static void __camera_update_api_waiting(camera_cb_info_s *cb_info, int api, int value)
@@ -571,6 +573,7 @@ int _camera_get_tbm_surface_format(int in_format, uint32_t *out_format)
        case MM_PIXEL_FORMAT_NV12T:
                *out_format = TBM_FORMAT_NV12;
                break;
+//LCOV_EXCL_START
        case MM_PIXEL_FORMAT_NV16:
                *out_format = TBM_FORMAT_NV16;
                break;
@@ -608,6 +611,7 @@ int _camera_get_tbm_surface_format(int in_format, uint32_t *out_format)
        default:
                LOGE("invalid in_format %d", in_format);
                return CAMERA_ERROR_INVALID_PARAMETER;
+//LCOV_EXCL_STOP
        }
 
        return CAMERA_ERROR_NONE;
@@ -628,6 +632,7 @@ int _camera_get_media_packet_mimetype(int in_format, media_format_mimetype_e *mi
        case MM_PIXEL_FORMAT_NV12T:
                *mimetype = MEDIA_FORMAT_NV12;
                break;
+//LCOV_EXCL_START
        case MM_PIXEL_FORMAT_NV16:
                *mimetype = MEDIA_FORMAT_NV16;
                break;
@@ -665,6 +670,7 @@ int _camera_get_media_packet_mimetype(int in_format, media_format_mimetype_e *mi
        default:
                LOGE("invalid in_format %d", in_format);
                return CAMERA_ERROR_INVALID_PARAMETER;
+//LCOV_EXCL_STOP
        }
 
        return CAMERA_ERROR_NONE;
@@ -693,6 +699,7 @@ void _camera_preview_frame_create(camera_stream_data_s *stream, int num_buffer_k
        frame->num_of_planes = stream->num_planes;
 
        if (num_buffer_key == 0) {
+//LCOV_EXCL_START
                /* non-zero copy */
                if (!data_bo_handle || !data_bo_handle->ptr) {
                        LOGE("NULL pointer");
@@ -738,14 +745,17 @@ void _camera_preview_frame_create(camera_stream_data_s *stream, int num_buffer_k
                                break;
                        }
                }
+//LCOV_EXCL_STOP
        } else {
                /* zero copy */
                switch (stream->num_planes) {
+//LCOV_EXCL_START
                case 1:
                        frame->data.single_plane.yuv = buffer_bo_handle[0].ptr;
                        frame->data.single_plane.size = stream->data.yuv420.length_yuv;
                        total_size = stream->data.yuv420.length_yuv;
                        break;
+//LCOV_EXCL_STOP
                case 2:
                        frame->data.double_plane.y = buffer_bo_handle[0].ptr;
                        if (stream->num_planes == (unsigned int)num_buffer_key)
@@ -758,6 +768,7 @@ void _camera_preview_frame_create(camera_stream_data_s *stream, int num_buffer_k
                                stream->data.yuv420sp.length_uv;
                        break;
                case 3:
+//LCOV_EXCL_START
                        frame->data.triple_plane.y = buffer_bo_handle[0].ptr;
                        if (stream->num_planes == (unsigned int)num_buffer_key) {
                                frame->data.triple_plane.u = buffer_bo_handle[1].ptr;
@@ -773,6 +784,7 @@ void _camera_preview_frame_create(camera_stream_data_s *stream, int num_buffer_k
                                stream->data.yuv420p.length_u + \
                                stream->data.yuv420p.length_v;
                        break;
+//LCOV_EXCL_STOP
                default:
                        break;
                }
@@ -907,6 +919,7 @@ int _camera_media_packet_create(camera_cb_info_s *cb_info, camera_stream_data_s
                                        tsurf_info.planes[1].offset = tsurf_info.planes[0].size;
                                tsurf_info.size = tsurf_info.planes[0].size + tsurf_info.planes[1].size;
                                break;
+//LCOV_EXCL_START
                        case TBM_FORMAT_YUV420:
                        case TBM_FORMAT_YVU420:
                                tsurf_info.planes[0].size = stream->stride[0] * stream->elevation[0];
@@ -927,10 +940,12 @@ int _camera_media_packet_create(camera_cb_info_s *cb_info, camera_stream_data_s
                                break;
                        default:
                                break;
+//LCOV_EXCL_STOP
                        }
 
                        tsurf = tbm_surface_internal_create_with_bos(&tsurf_info, buffer_bo, num_buffer_key);
                } else if (mp_data->data_bo) {
+//LCOV_EXCL_START
                        switch (bo_format) {
                        case TBM_FORMAT_NV12:
                        case TBM_FORMAT_NV21:
@@ -961,6 +976,7 @@ int _camera_media_packet_create(camera_cb_info_s *cb_info, camera_stream_data_s
                        }
 
                        tsurf = tbm_surface_internal_create_with_bos(&tsurf_info, &mp_data->data_bo, 1);
+//LCOV_EXCL_STOP
                }
                /*LOGD("tbm surface %p", tsurf);*/
        }
@@ -1255,7 +1271,7 @@ static void _camera_client_user_callback(camera_cb_info_s *cb_info, char *recv_m
                                LOGW("evas renderer is not supported");
 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
                        }
-
+//LCOV_EXCL_START
                        /* call media packet callback */
                        if (cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW]) {
                                ret = _camera_media_packet_data_create(tbm_key, num_buffer_key, bo, buffer_bo, data_bo, &mp_data);
@@ -1287,7 +1303,7 @@ static void _camera_client_user_callback(camera_cb_info_s *cb_info, char *recv_m
                                g_mutex_unlock(&cb_info->evas_mutex);
                        }
 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
-
+//LCOV_EXCL_STOP
                        /* send message for preview callback return */
                        if (!CHECK_PREVIEW_CB(cb_info, PREVIEW_CB_TYPE_EVAS))
                                _camera_msg_send(MUSE_CAMERA_API_PREVIEW_CB_RETURN, cb_info, NULL, 0);
@@ -1308,6 +1324,7 @@ static void _camera_client_user_callback(camera_cb_info_s *cb_info, char *recv_m
                        }
                }
                break;
+//LCOV_EXCL_START
        case MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS:
                {
                        int percent = 0;
@@ -1399,6 +1416,7 @@ static void _camera_client_user_callback(camera_cb_info_s *cb_info, char *recv_m
                                (camera_state_e)current_state, cb_info->user_data[event]);
                }
                break;
+//LCOV_EXCL_STOP
        case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION:
                /* fall through */
        case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION:
@@ -1439,6 +1457,7 @@ static void _camera_client_user_callback(camera_cb_info_s *cb_info, char *recv_m
                /* fall through */
        case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION:
                /* fall through */
+//LCOV_EXCL_START
        case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE:
                /* fall through */
        case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PTZ_TYPE:
@@ -1452,6 +1471,7 @@ static void _camera_client_user_callback(camera_cb_info_s *cb_info, char *recv_m
                        LOGW("stop foreach callback for event %d", event);
                }
                break;
+//LCOV_EXCL_STOP
        case MUSE_CAMERA_EVENT_TYPE_CAPTURE:
                {
                        camera_image_data_s *rImage = NULL;
@@ -2257,7 +2277,7 @@ static camera_cb_info_s *_camera_client_callback_new(gint sockfd)
        cb_info->is_server_connected = TRUE;
 
        return cb_info;
-
+//LCOV_EXCL_START
 ErrorExit:
        if (cb_info) {
                __destroy_msg_handler_thread(&cb_info->msg_handler_info);
@@ -2282,6 +2302,7 @@ ErrorExit:
        }
 
        return NULL;
+//LCOV_EXCL_STOP
 }
 
 static void _camera_client_callback_destroy(camera_cb_info_s *cb_info)
@@ -2342,7 +2363,7 @@ static void _camera_client_callback_destroy(camera_cb_info_s *cb_info)
        return;
 }
 
-
+//LCOV_EXCL_START
 int _camera_start_evas_rendering(camera_h camera)
 {
        int ret = CAMERA_ERROR_NONE;
@@ -2414,7 +2435,7 @@ int _camera_stop_evas_rendering(camera_h camera, bool keep_screen)
 
        return ret;
 }
-
+//LCOV_EXCL_STOP
 
 int _camera_independent_request(int api, int device_type, const char *key, int *value)
 {
@@ -2589,7 +2610,7 @@ int camera_create(camera_device_e device, camera_h *camera)
        }
 
        return ret;
-
+//LCOV_EXCL_START
 ErrorExit:
        if (bufmgr) {
                tbm_bufmgr_deinit(bufmgr);
@@ -2613,6 +2634,7 @@ ErrorExit:
        LOGE("camera create error : 0x%x", ret);
 
        return ret;
+//LCOV_EXCL_STOP
 }
 
 
@@ -2718,6 +2740,7 @@ int camera_stop_preview(camera_h camera)
 
        LOGD("Enter");
 
+//LCOV_EXCL_START
        if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
                ret = camera_get_state(camera, &current_state);
                if (ret != CAMERA_ERROR_NONE) {
@@ -2731,7 +2754,7 @@ int camera_stop_preview(camera_h camera)
                                return ret;
                }
        }
-
+//LCOV_EXCL_STOP
        /* send stop preview message */
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
@@ -3110,6 +3133,7 @@ int camera_set_display(camera_h camera, camera_display_type_e type, camera_displ
        if (type == CAMERA_DISPLAY_TYPE_NONE) {
                set_display_handle = 0;
                LOGD("display type NONE");
+//LCOV_EXCL_START
        } else {
                obj = (Evas_Object *)display;
                object_type = evas_object_type_get(obj);
@@ -3190,7 +3214,7 @@ int camera_set_display(camera_h camera, camera_display_type_e type, camera_displ
                        return CAMERA_ERROR_INVALID_PARAMETER;
                }
        }
-
+//LCOV_EXCL_STOP
        pc->display_handle = (intptr_t)set_display_handle;
 
        if (type == CAMERA_DISPLAY_TYPE_OVERLAY) {
@@ -3404,7 +3428,7 @@ int camera_set_display_rotation(camera_h camera, camera_rotation_e rotation)
                LOGE("NULL handle");
                return CAMERA_ERROR_INVALID_PARAMETER;
        }
-
+//LCOV_EXCL_START
 #ifdef TIZEN_FEATURE_EVAS_RENDERER
        if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
                g_mutex_lock(&pc->cb_info->evas_mutex);
@@ -3419,7 +3443,7 @@ int camera_set_display_rotation(camera_h camera, camera_rotation_e rotation)
                }
        }
 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
-
+//LCOV_EXCL_STOP
        CAMERA_MSG_PARAM_SET(param, INT, set_rotation);
 
        _camera_msg_send_param1(MUSE_CAMERA_API_SET_DISPLAY_ROTATION, pc->cb_info, &ret, &param, CAMERA_CB_TIMEOUT);
@@ -3458,7 +3482,7 @@ int camera_set_display_flip(camera_h camera, camera_flip_e flip)
                LOGE("NULL handle");
                return CAMERA_ERROR_INVALID_PARAMETER;
        }
-
+//LCOV_EXCL_START
 #ifdef TIZEN_FEATURE_EVAS_RENDERER
        if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
                g_mutex_lock(&pc->cb_info->evas_mutex);
@@ -3473,7 +3497,7 @@ int camera_set_display_flip(camera_h camera, camera_flip_e flip)
                }
        }
 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
-
+//LCOV_EXCL_STOP
        CAMERA_MSG_PARAM_SET(param, INT, set_flip);
 
        _camera_msg_send_param1(MUSE_CAMERA_API_SET_DISPLAY_FLIP, pc->cb_info, &ret, &param, CAMERA_CB_TIMEOUT);
@@ -3512,7 +3536,7 @@ int camera_set_display_visible(camera_h camera, bool visible)
                LOGE("NULL handle");
                return CAMERA_ERROR_INVALID_PARAMETER;
        }
-
+//LCOV_EXCL_START
 #ifdef TIZEN_FEATURE_EVAS_RENDERER
        if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
                g_mutex_lock(&pc->cb_info->evas_mutex);
@@ -3527,7 +3551,7 @@ int camera_set_display_visible(camera_h camera, bool visible)
                }
        }
 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
-
+//LCOV_EXCL_STOP
        CAMERA_MSG_PARAM_SET(param, INT, set_visible);
 
        _camera_msg_send_param1(MUSE_CAMERA_API_SET_DISPLAY_VISIBLE, pc->cb_info, &ret, &param, CAMERA_CB_TIMEOUT);
@@ -3566,7 +3590,7 @@ int camera_set_display_mode(camera_h camera, camera_display_mode_e mode)
                LOGE("NULL handle");
                return CAMERA_ERROR_INVALID_PARAMETER;
        }
-
+//LCOV_EXCL_START
 #ifdef TIZEN_FEATURE_EVAS_RENDERER
        if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
                g_mutex_lock(&pc->cb_info->evas_mutex);
@@ -3581,7 +3605,7 @@ int camera_set_display_mode(camera_h camera, camera_display_mode_e mode)
                }
        }
 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
-
+//LCOV_EXCL_STOP
        CAMERA_MSG_PARAM_SET(param, INT, set_mode);
 
        _camera_msg_send_param1(MUSE_CAMERA_API_SET_DISPLAY_MODE, pc->cb_info, &ret, &param, CAMERA_CB_TIMEOUT);
@@ -6464,7 +6488,7 @@ int camera_attr_set_display_roi_area(camera_h camera, int x, int y, int width, i
        }
 
        LOGD("Enter");
-
+//LCOV_EXCL_START
 #ifdef TIZEN_FEATURE_EVAS_RENDERER
        if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
                g_mutex_lock(&pc->cb_info->evas_mutex);
@@ -6479,7 +6503,7 @@ int camera_attr_set_display_roi_area(camera_h camera, int x, int y, int width, i
                }
        }
 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
-
+//LCOV_EXCL_STOP
        length = sizeof(set_display_roi_area) / sizeof(int) + \
                (sizeof(set_display_roi_area) % sizeof(int) ? 1 : 0);
 
index ac76cfd..ebc96d2 100644 (file)
@@ -29,7 +29,7 @@
 #endif
 #define LOG_TAG "TIZEN_N_CAMERA"
 
-
+//LCOV_EXCL_START
 int camera_start_evas_rendering(camera_h camera)
 {
        return _camera_start_evas_rendering(camera);
@@ -39,3 +39,4 @@ int camera_stop_evas_rendering(camera_h camera, bool keep_screen)
 {
        return _camera_stop_evas_rendering(camera, keep_screen);
 }
+//LCOV_EXCL_STOP