From 8ab76cdebb84ff80d2835f298d8e6444c0f241ac Mon Sep 17 00:00:00 2001 From: Abhay Agarwal Date: Tue, 1 Sep 2020 09:31:55 +0530 Subject: [PATCH] Mesh: unit test: set transition time for node control Default values for the Generic Default Transition Step Resolution and the Default Transition Number of Steps are implementation speficic and are defined by a device manufacturer. This patch sets transition time while controlling node. Change-Id: I5cfbfd186efc9957790ec16b156fc18fa037cc41 Signed-off-by: Abhay Agarwal --- src/bluetooth-mesh.c | 4 ++-- tests/test/bt_mesh_unit_test.c | 17 +++++++++++------ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/bluetooth-mesh.c b/src/bluetooth-mesh.c index b814d6a..f93498c 100644 --- a/src/bluetooth-mesh.c +++ b/src/bluetooth-mesh.c @@ -3148,7 +3148,7 @@ int bt_mesh_model_send_msg(bt_mesh_model_h model, strlen(msg_params->data), msg_params->data); req.msg_len = strlen(msg_params->data); - g_strlcpy(req.msg, msg_params->data, sizeof(msg_params->data) + 1); + g_strlcpy(req.msg, msg_params->data, req.msg_len + 1); } else { req.msg_len = 0; } @@ -3204,7 +3204,7 @@ int bt_mesh_group_send_msg(bt_mesh_group_h group, strlen(msg_params->data), msg_params->data); req.msg_len = strlen(msg_params->data); - g_strlcpy(req.msg, msg_params->data, sizeof(msg_params->data) + 1); + g_strlcpy(req.msg, msg_params->data, req.msg_len + 1); } else { req.msg_len = 0; } diff --git a/tests/test/bt_mesh_unit_test.c b/tests/test/bt_mesh_unit_test.c index f8980fd..85980bd 100644 --- a/tests/test/bt_mesh_unit_test.c +++ b/tests/test/bt_mesh_unit_test.c @@ -1789,8 +1789,13 @@ int test_input_callback(void *data) TC_PRT("Model Creation Failed!"); break; } - /* Sleep for 100 msec to allow network Proxy attach */ - usleep(100000); + + /* + * System-d has start-limit on number of process to be started in given time + * Sleep for 2000 msec + */ + usleep(2000); + /* Create Network */ network_name = g_strdup_printf("TestMeshNet%d", i); bt_mesh_network_h net_h; @@ -2731,7 +2736,7 @@ int test_input_callback(void *data) model_h = GUINT_TO_POINTER(strtoul(g_test_param.params[0], NULL, 16)); } - const char *msg_s = "0101"; + const char *msg_s = "01010000"; msg_params.opcode = 0x8202; msg_params.data = g_strdup(msg_s); ret = __bt_mesh_model_send_msg(model_h, appkey_h, &msg_params, @@ -2749,7 +2754,7 @@ int test_input_callback(void *data) model_h = GUINT_TO_POINTER(strtoul(g_test_param.params[0], NULL, 16)); } - const char *msg_s = "0001"; + const char *msg_s = "00010000"; msg_params.opcode = 0x8202; msg_params.data = g_strdup(msg_s); ret = __bt_mesh_model_send_msg(model_h, appkey_h, &msg_params, @@ -2767,7 +2772,7 @@ int test_input_callback(void *data) group_h = GUINT_TO_POINTER(strtoul(g_test_param.params[0], NULL, 16)); } - const char *msg_s = "0101"; + const char *msg_s = "01010000"; msg_params.opcode = 0x8202; msg_params.data = g_strdup(msg_s); ret = __bt_mesh_group_send_msg(group_h, appkey_h, &msg_params, @@ -2785,7 +2790,7 @@ int test_input_callback(void *data) group_h = GUINT_TO_POINTER(strtoul(g_test_param.params[0], NULL, 16)); } - const char *msg_s = "0001"; + const char *msg_s = "00010000"; msg_params.opcode = 0x8202; msg_params.data = g_strdup(msg_s); ret = __bt_mesh_group_send_msg(group_h, appkey_h, &msg_params, -- 2.34.1