Add line coverage exception to below cases.
1. Internal API and functions used only in internal functions.
2. Profile specific functions that are not common profile.(ex - mobile, wearable...)
3. Error handling code section.
4. Not supported feature functions in the line coverage test environment.(ex - battery, haptic, ir, led...)
- Above features are false by default in the line coverage test environment.
Change-Id: I4e3a1c939aa26305a1b4c376bae6e905e2325e58
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
#define BATTERY_FEATURE "http://tizen.org/feature/battery"
+//LCOV_EXCL_START
static int is_battery_supported(void)
{
int ret_val;
ret_val = system_info_get_platform_bool(BATTERY_FEATURE, &battery_avail);
if (ret_val < 0) {
-//LCOV_EXCL_START System Error
_E("Failed to get value of battery feature");
return false;
-//LCOV_EXCL_STOP
} else if (ret_val == 0 && !battery_avail) {
-//LCOV_EXCL_START System Error
_D("Battery is not supported");
return false;
-//LCOV_EXCL_STOP
} else
return true;
}
+//LCOV_EXCL_STOP
-
+//LCOV_EXCL_START
int device_battery_get_percent(int *percent)
{
struct device_battery_info info;
ret_val = is_battery_supported();
if (!ret_val)
- return DEVICE_ERROR_NOT_SUPPORTED;
+ return DEVICE_ERROR_NOT_SUPPORTED; //LCOV_EXCL_LINE
ret_val = device_battery_get_info_direct(&info);
if (ret_val < 0)
*percent = info.capacity;
return DEVICE_ERROR_NONE;
}
+//LCOV_EXCL_STOP
+//LCOV_EXCL_START
int device_battery_is_charging(bool *charging)
{
int ret_val, val;
*charging = val;
return DEVICE_ERROR_NONE;
}
+//LCOV_EXCL_STOP
+//LCOV_EXCL_START
int device_battery_get_level_status(device_battery_level_e *status)
{
int val, ret_val;
*status = DEVICE_BATTERY_LEVEL_HIGH;
else if (val == VCONFKEY_SYSMAN_BAT_LEVEL_FULL)
*status = DEVICE_BATTERY_LEVEL_FULL;
-//LCOV_EXCL_START System Error
/* regard not supported as disconnected */
else if (val == -ENOTSUP)
*status = DEVICE_BATTERY_LEVEL_EMPTY;
-//LCOV_EXCL_STOP
else
return DEVICE_ERROR_OPERATION_FAILED;
return DEVICE_ERROR_NONE;
}
+//LCOV_EXCL_STOP
+//LCOV_EXCL_START
static void battery_get_info(struct battery_info *info, void *data)
{
struct device_battery_info *bat = data;
bat->voltage_now = info->voltage_now;
bat->voltage_average = info->voltage_average;
}
+//LCOV_EXCL_STOP
+//LCOV_EXCL_START Internal function
int device_battery_get_info_direct(struct device_battery_info *info)
{
int ret_val;
ret_val = hal_device_battery_get_current_state(battery_get_info, info);
if (ret_val < 0) {
-//LCOV_EXCL_START System Error
_E("Failed to get battery info: %d", ret_val);
return DEVICE_ERROR_OPERATION_FAILED;
-//LCOV_EXCL_STOP
}
return DEVICE_ERROR_NONE;
}
+//LCOV_EXCL_STOP
+//LCOV_EXCL_START
int device_battery_get_health(device_battery_health_e *health)
{
struct device_battery_info info;
ret = device_battery_get_info_direct(&info);
if (ret != DEVICE_ERROR_NONE) {
-//LCOV_EXCL_START System Error
_E("Failed to get battery info (%d)", ret);
return ret;
-//LCOV_EXCL_STOP
}
len = strlen(info.health);
return DEVICE_ERROR_NONE;
}
+//LCOV_EXCL_STOP
+//LCOV_EXCL_START
int device_battery_get_power_source(device_battery_power_source_e *source)
{
struct device_battery_info info;
ret = device_battery_get_info_direct(&info);
if (ret != DEVICE_ERROR_NONE) {
-//LCOV_EXCL_START System Error
_E("Failed to get battery info (%d)", ret);
return ret;
-//LCOV_EXCL_STOP
}
len = strlen(info.power_source);
return DEVICE_ERROR_NONE;
}
+//LCOV_EXCL_STOP
+//LCOV_EXCL_START
int device_battery_get_property(device_battery_property_e property, int *val)
{
struct device_battery_info info = {0, };
ret = device_battery_get_info_direct(&info);
if (ret != DEVICE_ERROR_NONE) {
-//LCOV_EXCL_START System Error
_E("Failed to get battery info (%d)", ret);
return ret;
-//LCOV_EXCL_STOP
}
switch (property) {
return DEVICE_ERROR_NONE;
}
+//LCOV_EXCL_STOP
+//LCOV_EXCL_START
int device_battery_get_status(device_battery_status_e *status)
{
struct device_battery_info info;
ret = device_battery_get_info_direct(&info);
if (ret != DEVICE_ERROR_NONE) {
-//LCOV_EXCL_START System Error
_E("Failed to get battery info (%d)", ret);
return ret;
-//LCOV_EXCL_STOP
}
len = strlen(info.status);
return DEVICE_ERROR_NONE;
}
+//LCOV_EXCL_STOP
void __attribute__ ((destructor)) battery_finalize(void)
{
#include <hal/device/hal-board.h>
+//LCOV_EXCL_START Internal function
int device_board_get_serial_number(char *buffer, const int max_len)
{
int ret;
{
return hal_device_board_set_partition_status(partition_ab, status);
}
+//LCOV_EXCL_STOP
\ No newline at end of file
static int register_request(int type)
{
switch (type) {
+ //LCOV_EXCL_START
case DEVICE_CALLBACK_BATTERY_CAPACITY:
return vconf_notify_key_changed(VCONFKEY_SYSMAN_BATTERY_CAPACITY,
battery_capacity_cb, NULL);
case DEVICE_CALLBACK_BATTERY_CHARGING:
return vconf_notify_key_changed(VCONFKEY_SYSMAN_BATTERY_CHARGE_NOW,
battery_charging_cb, NULL);
+ //LCOV_EXCL_STOP
case DEVICE_CALLBACK_DISPLAY_STATE:
return vconf_notify_key_changed(VCONFKEY_PM_STATE,
display_changed_cb, NULL);
+ //LCOV_EXCL_START
case DEVICE_CALLBACK_FLASH_BRIGHTNESS:
/* sig_id begins with 1. */
if (flash_sigid)
DEVICED_PATH_LED,
DEVICED_INTERFACE_LED,
SIGNAL_FLASH_STATE, flash_state_cb, &flash_sigid);
+ //LCOV_EXCL_STOP
default:
if (event_sigid)
return -EEXIST;
static int release_request(int type)
{
switch (type) {
+ //LCOV_EXCL_START
case DEVICE_CALLBACK_BATTERY_CAPACITY:
return vconf_ignore_key_changed(VCONFKEY_SYSMAN_BATTERY_CAPACITY,
battery_capacity_cb);
case DEVICE_CALLBACK_BATTERY_CHARGING:
return vconf_ignore_key_changed(VCONFKEY_SYSMAN_BATTERY_CHARGE_NOW,
battery_charging_cb);
+ //LCOV_EXCL_STOP
case DEVICE_CALLBACK_DISPLAY_STATE:
return vconf_ignore_key_changed(VCONFKEY_PM_STATE,
display_changed_cb);
+ //LCOV_EXCL_START
case DEVICE_CALLBACK_FLASH_BRIGHTNESS:
if (!flash_sigid)
return -ENOENT;
return unregister_signal(&flash_sigid);
+ //LCOV_EXCL_STOP
default:
if (!event_sigid)
return -ENOENT;
bool supported;
switch (type) {
+ //LCOV_EXCL_START
case DEVICE_CALLBACK_BATTERY_CAPACITY:
case DEVICE_CALLBACK_BATTERY_LEVEL:
case DEVICE_CALLBACK_BATTERY_CHARGING:
f_battery = true;
return 0;
+ //LCOV_EXCL_STOP
case DEVICE_CALLBACK_DISPLAY_STATE:
if (f_display)
return 0;
f_display = true;
return 0;
+ //LCOV_EXCL_START
case DEVICE_CALLBACK_FLASH_BRIGHTNESS:
if (f_flash)
return 0;
f_flash = true;
return 0;
+ //LCOV_EXCL_STOP
default:
return 0;
}
char *profileName;
system_info_get_platform_string("http://tizen.org/feature/profile", &profileName);
switch (*profileName) {
+ //LCOV_EXCL_START
case 'm':
case 'M':
profile = TIZEN_PROFILE_MOBILE;
break;
case 'w':
case 'W':
- profile = TIZEN_PROFILE_WEARABLE; //LCOV_EXCL_LINE
- break; //LCOV_EXCL_LINE
+ profile = TIZEN_PROFILE_WEARABLE;
+ break;
case 't':
case 'T':
- profile = TIZEN_PROFILE_TV; //LCOV_EXCL_LINE
- break; //LCOV_EXCL_LINE
+ profile = TIZEN_PROFILE_TV;
+ break;
case 'i':
case 'I':
- profile = TIZEN_PROFILE_IVI; //LCOV_EXCL_LINE
- break; //LCOV_EXCL_LINE
+ profile = TIZEN_PROFILE_IVI;
+ break;
+ //LCOV_EXCL_STOP
default: // common or unknown ==> ALL ARE COMMON.
profile = TIZEN_PROFILE_COMMON; //LCOV_EXCL_LINE
}
return true;
}
+//LCOV_EXCL_START Internal function
int device_display_get_rotation_angle(int display_index,
device_display_rotation_angle_e *angle,
device_display_init_direction_e *init_direction)
return DEVICE_ERROR_NONE;
}
+//LCOV_EXCL_STOP
+//LCOV_EXCL_START Internal function
int device_display_set_rotation_angle(int display_index,
device_display_rotation_angle_e angle,
device_display_rotation_direction_e rotation_direction)
return DEVICE_ERROR_NONE;
}
+//LCOV_EXCL_STOP
int is_feature_display_state_supported(void)
{
return true;
}
+//LCOV_EXCL_START Internal function
int device_display_set_white_balance(int display_index, display_white_balance_e white_balance_type, int value)
{
int ret;
return DEVICE_ERROR_NONE;
}
+//LCOV_EXCL_STOP
+//LCOV_EXCL_START Internal function
int device_display_get_white_balance(int display_index, display_white_balance_e white_balance_type, int *value)
{
int ret, reply;
return DEVICE_ERROR_NONE;
}
+//LCOV_EXCL_STOP
\ No newline at end of file
static guint haptic_id = 0;
static GList *handle_list;
+//LCOV_EXCL_START
static int is_haptic_supported(void)
{
int ret_val;
ret_val = system_info_get_platform_bool(VIBRATION_FEATURE, &haptic_avail);
if (ret_val < 0) {
-//LCOV_EXCL_START System Error
_E("Failed to get value of haptic feature");
return false;
-//LCOV_EXCL_STOP
} else if (ret_val == 0 && !haptic_avail) {
-//LCOV_EXCL_START System Error
_D("Haptic is not supported");
return false;
-//LCOV_EXCL_STOP
} else
return true;
}
return DEVICE_ERROR_NONE;
}
-//LCOV_EXCL_START Not called Callback
static void restart_callback(void)
{
GList *elem, *elem_next;
}
}
-//LCOV_EXCL_STOP
-//LCOV_EXCL_START Not called Callback
static void haptic_signal_callback(GDBusConnection *conn,
const gchar *sender,
const gchar *path,
restart_callback();
}
-//LCOV_EXCL_STOP
int device_haptic_open(int device_index, haptic_device_h *device_handle)
{
if (!found) {
handle = (struct haptic_handle *)malloc(sizeof(struct haptic_handle));
if (!handle) {
-//LCOV_EXCL_START System Error
_E("Failed to malloc");
return DEVICE_ERROR_OPERATION_FAILED;
-//LCOV_EXCL_STOP
}
handle->handle = val;
return DEVICE_ERROR_NONE;
}
+//LCOV_EXCL_STOP
\ No newline at end of file
#define METHOD_INPUT_GET_EVENT_STATE "InputGetEventState"
#define METHOD_INPUT_GET_DEVICE_NAME "InputGetDeviceName"
+//LCOV_EXCL_START Internal function
static bool input_is_supported_input_type(device_input_type_e input_device_type)
{
switch (input_device_type) {
*input_device_name = temp_input_device_name;
return DEVICE_ERROR_NONE;
-}
\ No newline at end of file
+}
+//LCOV_EXCL_STOP
\ No newline at end of file
#define METHOD_TRANSMIT "TransmitIR"
#define IR_FEATURE "http://tizen.org/feature/consumer_ir"
-
+//LCOV_EXCL_START
int device_ir_is_available(bool *available)
{
int ret_val;
ret_val = system_info_get_platform_bool(IR_FEATURE, &ir_avail);
if (ret_val < 0) {
-//LCOV_EXCL_START System Error
*available = false;
return DEVICE_ERROR_OPERATION_FAILED;
-//LCOV_EXCL_STOP
} else if (ret_val == 0 && !ir_avail) {
*available = false;
return DEVICE_ERROR_NOT_SUPPORTED;
DEVICED_INTERFACE_IR, METHOD_IS_AVAILABLE,
NULL, NULL);
-//LCOV_EXCL_START System Error
if (ret_val == -EACCES || ret_val == -EPERM)
return DEVICE_ERROR_PERMISSION_DENIED;
if (!ret_val) {
*available = false;
return DEVICE_ERROR_OPERATION_FAILED;
}
-//LCOV_EXCL_STOP
*available = ir_avail;
return DEVICE_ERROR_NONE;
}
+//LCOV_EXCL_STOP
+//LCOV_EXCL_START
int device_ir_transmit(int carrier_frequency, int *pattern, int size)
{
int ret_val;
_E("IR is not supported or IR operation failed");
return ret_val;
}
-//LCOV_EXCL_START System Error
_E("IR is not supported");
return DEVICE_ERROR_OPERATION_FAILED;
-//LCOV_EXCL_STOP
}
-//LCOV_EXCL_START System Error
if (!pattern)
return DEVICE_ERROR_INVALID_PARAMETER;
if (size <= 0) {
_E("IR pattern size is invalid");
return DEVICE_ERROR_INVALID_PARAMETER;
}
-//LCOV_EXCL_STOP
builder = g_variant_builder_new(G_VARIANT_TYPE ("ai"));
g_variant_builder_add(builder, "i", carrier_frequency);
g_variant_new("(ai)", builder), NULL);
g_variant_builder_unref(builder);
-//LCOV_EXCL_START System Error
if (ret_val == -EACCES || ret_val == -EPERM)
return DEVICE_ERROR_PERMISSION_DENIED;
if (ret_val < 0)
return DEVICE_ERROR_OPERATION_FAILED;
-//LCOV_EXCL_STOP
return DEVICE_ERROR_NONE;
}
+//LCOV_EXCL_STOP
support_camera_led = true;
}
+//LCOV_EXCL_START
int device_flash_get_max_brightness(int *max_brightness)
{
int ret_dbus, val;
*max_brightness = val;
return DEVICE_ERROR_NONE;
}
+//LCOV_EXCL_STOP
+//LCOV_EXCL_START
int device_flash_get_brightness(int *brightness)
{
int ret_dbus, val;
*brightness = val;
return DEVICE_ERROR_NONE;
}
+//LCOV_EXCL_STOP
+//LCOV_EXCL_START
int device_flash_set_brightness(int brightness)
{
int max, ret_dbus;
return DEVICE_ERROR_NONE;
}
+//LCOV_EXCL_STOP
+//LCOV_EXCL_START
int device_led_play_custom(int on, int off, unsigned int color, unsigned int flags)
{
int ret_dbus;
return DEVICE_ERROR_NONE;
}
+//LCOV_EXCL_STOP
+//LCOV_EXCL_START
int device_led_stop_custom(void)
{
int ret_dbus;
return DEVICE_ERROR_NONE;
}
+//LCOV_EXCL_STOP
//LCOV_EXCL_START Not tested API
int device_multi_led_get_number(int *num_of_leds)
void *data;
};
+//LCOV_EXCL_START Internal function
static bool power_is_valid_power_lock_type(power_lock_e power_lock_type)
{
switch(power_lock_type) {
}
return DEVICE_ERROR_NONE;
-}
\ No newline at end of file
+}
+//LCOV_EXCL_STOP
\ No newline at end of file