Valgrind reports some errors while running mdstest. This ticket
will fix the reported errors.
---
src/mds/apitest/mdstipc.h | 1 +
src/mds/apitest/mdstipc_api.c | 94 +++++++++++++++++++++++++++-------
src/mds/apitest/mdstipc_conf.c | 9 ++++
src/mds/mds_c_api.c | 7 ++-
src/mds/mds_svc_op.c | 7 +--
src/mds/mds_tipc_fctrl_intf.cc | 2 +-
6 files changed, 96 insertions(+), 24 deletions(-)
diff --git a/src/mds/apitest/mdstipc.h b/src/mds/apitest/mdstipc.h
index d877f9a3e..a8628d707 100644
--- a/src/mds/apitest/mdstipc.h
+++ b/src/mds/apitest/mdstipc.h
@@ -205,6 +205,7 @@ uint32_t destroy_pwe_on_vdest(MDS_HDL);
/************** USER DEFINED WRAPPERS FOR MDS SERVICE APIs **************/
uint32_t tet_create_task(NCS_OS_CB, NCSCONTEXT*);
+uint32_t tet_join_task(void *task_handle);
uint32_t tet_release_task(void *task_handle);
uint32_t wait_adest_sel_obj(MDS_SVC_ID, int64_t);
uint32_t wait_vdest_sel_obj(TET_VDEST*, MDS_SVC_ID, int64_t);
diff --git a/src/mds/apitest/mdstipc_api.c b/src/mds/apitest/mdstipc_api.c
index b2ef3465c..098f90a89 100644
--- a/src/mds/apitest/mdstipc_api.c
+++ b/src/mds/apitest/mdstipc_api.c
@@ -6160,7 +6160,7 @@ void tet_send_response_tp_13()
1, to_svcids)
== NCSCC_RC_SUCCESS) {
sleep(1);
- TET_MDS_MSG msg;
+ TET_MDS_MSG msg = {5, 0, "dump", ""};
mds_send_get_response(
gl_tet_adest.mds_pwe1_hdl,
NCSMDS_SVC_ID_INTERNAL_MIN,
@@ -6205,7 +6205,7 @@ void tet_send_response_tp_13()
osaf_clock_gettime(
CLOCK_MONOTONIC,
&time1);
- TET_MDS_MSG msg;
+ TET_MDS_MSG msg = {5, 0, "dump", ""};
if (mds_send_response(
gl_tet_adest.mds_pwe1_hdl,
NCSMDS_SVC_ID_EXTERNAL_MIN,
@@ -6239,7 +6239,7 @@ void tet_send_response_tp_13()
void tet_send_response_tp_14()
{
- int FAIL = 1;
+ int FAIL = 0;
mds_shutdown();
printf("\nTest Case 14: Now send_response to dead Adest don't stuck"
@@ -6254,7 +6254,7 @@ void tet_send_response_tp_14()
if (mds_service_install(
gl_tet_adest.mds_pwe1_hdl,
NCSMDS_SVC_ID_INTERNAL_MIN, 1,
- NCSMDS_SCOPE_NONE, false, false)
+ NCSMDS_SCOPE_NONE, true, false)
== NCSCC_RC_SUCCESS) {
if (mds_service_subscribe(
gl_tet_adest.mds_pwe1_hdl,
@@ -6262,8 +6262,21 @@ void tet_send_response_tp_14()
NCSMDS_SCOPE_INTRANODE,
1, to_svcids)
== NCSCC_RC_SUCCESS) {
- TET_MDS_MSG msg;
- sleep(1); // Wait for up event
+ // Retrieve the up event
+ if (wait_adest_sel_obj(
+ NCSMDS_SVC_ID_INTERNAL_MIN,
+ 10)) {
+ printf("\nFail\n");
+ FAIL = 1;
+ } else if (mds_service_retrieve(
+ gl_tet_adest.mds_pwe1_hdl,
+ NCSMDS_SVC_ID_INTERNAL_MIN,
+ SA_DISPATCH_ONE)
+ != NCSCC_RC_SUCCESS) {
+ printf("\nFail\n");
+ FAIL = 1;
+ }
+ TET_MDS_MSG msg = {5, 0, "dump", ""};
mds_send_get_response(
gl_tet_adest.mds_pwe1_hdl,
NCSMDS_SVC_ID_INTERNAL_MIN,
@@ -6296,23 +6309,55 @@ void tet_send_response_tp_14()
NCSMDS_SCOPE_INTRANODE,
1, to_svcids)
== NCSCC_RC_SUCCESS) {
- while (is_adest_sel_obj_found(0)) {
- if (mds_service_retrieve(
+ // Retrieve the up event
+ if (wait_adest_sel_obj(
+ NCSMDS_SVC_ID_EXTERNAL_MIN,
+ 10)) {
+ printf("\nFail\n");
+ FAIL = 1;
+ } else if (mds_service_retrieve(
gl_tet_adest.mds_pwe1_hdl,
NCSMDS_SVC_ID_EXTERNAL_MIN,
SA_DISPATCH_ONE)
- == NCSCC_RC_SUCCESS &&
- gl_rcvdmsginfo.msg) {
- // Received the message
- break;
- }
+ != NCSCC_RC_SUCCESS) {
+ printf("\nFail\n");
+ FAIL = 1;
+ }
+ // Retrieve the message
+ if (wait_adest_sel_obj(
+ NCSMDS_SVC_ID_EXTERNAL_MIN,
+ 10)) {
+ printf("\nFail\n");
+ FAIL = 1;
+ } else if (mds_service_retrieve(
+ gl_tet_adest.mds_pwe1_hdl,
+ NCSMDS_SVC_ID_EXTERNAL_MIN,
+ SA_DISPATCH_ONE)
+ != NCSCC_RC_SUCCESS
+ || !gl_rcvdmsginfo.msg) {
+ printf("\nFail\n");
+ FAIL = 1;
+ }
+ // Retrieve the down event
+ if (wait_adest_sel_obj(
+ NCSMDS_SVC_ID_EXTERNAL_MIN,
+ 10)) {
+ printf("\nFail\n");
+ FAIL = 1;
+ } else if (mds_service_retrieve(
+ gl_tet_adest.mds_pwe1_hdl,
+ NCSMDS_SVC_ID_EXTERNAL_MIN,
+ SA_DISPATCH_ONE)
+ != NCSCC_RC_SUCCESS) {
+ printf("\nFail\n");
+ FAIL = 1;
}
sleep(15); // Make sure the adest down
// timer expires
osaf_clock_gettime(CLOCK_MONOTONIC,
&time1);
// Send response
- TET_MDS_MSG msg;
+ TET_MDS_MSG msg = {5, 0, "dump", ""};
if (mds_send_response(
gl_tet_adest.mds_pwe1_hdl,
NCSMDS_SVC_ID_EXTERNAL_MIN,
@@ -6330,17 +6375,30 @@ void tet_send_response_tp_14()
printf("\nResponse to"
" dead Adest hang >"
" 50ms");
- } else {
- FAIL = 0;
+ FAIL = 1;
}
+ } else {
+ printf("\nResponse to"
+ " dead Adest successful\n");
+ FAIL = 1;
}
+ } else {
+ printf("\nFailed to subscribe\n");
+ FAIL = 1;
}
+ } else {
+ printf("\nFailed to install service\n");
+ FAIL = 1;
}
+ } else {
+ printf("\nFailed to get the adest handle\n");
+ FAIL = 1;
}
kill(pid, SIGKILL);
mds_shutdown();
} else {
printf("\nFAIL to fork()\n");
+ FAIL = 1;
}
test_validate(FAIL, 0);
}
@@ -7129,9 +7187,9 @@ void tet_send_all_tp_2()
printf("\nSuccess\n");
/*Now Stop and Release the Receiver Thread*/
- if (tet_release_task(gl_tet_adest.svc[1].task.t_handle) ==
+ if (tet_join_task(gl_tet_adest.svc[1].task.t_handle) ==
NCSCC_RC_SUCCESS)
- printf("\nTASK is released\n");
+ printf("\nTASK is joined\n");
fflush(stdout);
#if 0
/*SNDRACK*/
diff --git a/src/mds/apitest/mdstipc_conf.c b/src/mds/apitest/mdstipc_conf.c
index 7e2f69ca0..5a0f0c9c7 100644
--- a/src/mds/apitest/mdstipc_conf.c
+++ b/src/mds/apitest/mdstipc_conf.c
@@ -431,6 +431,7 @@ uint32_t mds_service_install(MDS_HDL mds_hdl, MDS_SVC_ID
svc_id,
svc_to_mds_info.info.svc_install.i_yr_svc_hdl = gl_tet_svc.yr_svc_hdl;
svc_to_mds_info.info.svc_install.i_install_scope = install_scope;
svc_to_mds_info.info.svc_install.i_mds_q_ownership = mds_q_ownership;
+ svc_to_mds_info.info.svc_install.i_msg_loss_indication = false;
if (ncsmds_api(&svc_to_mds_info) == NCSCC_RC_SUCCESS) {
printf("\n %d : SERVICE INSTALL is SUCCESSFULL", svc_id);
@@ -1724,6 +1725,14 @@ uint32_t tet_create_task(NCS_OS_CB task_startup,
NCSCONTEXT *t_handle)
return NCSCC_RC_FAILURE;
}
+uint32_t tet_join_task(void *task_handle)
+{
+ if (m_NCS_TASK_JOIN(task_handle) == NCSCC_RC_SUCCESS)
+ return NCSCC_RC_SUCCESS;
+ else
+ return NCSCC_RC_FAILURE;
+}
+
uint32_t tet_release_task(void *task_handle)
{
sleep(2);
diff --git a/src/mds/mds_c_api.c b/src/mds/mds_c_api.c
index 86d00716f..4faa69d09 100644
--- a/src/mds/mds_c_api.c
+++ b/src/mds/mds_c_api.c
@@ -757,6 +757,10 @@ uint32_t mds_mcm_pwe_destroy(NCSMDS_ADMOP_INFO *info)
svc_info = (MDS_SVC_INFO *)ncs_patricia_tree_getnext(
&gl_mds_mcm_cb->svc_list, NULL);
while (svc_info != NULL) {
+ MDS_SVC_INFO *next_svc_info =
+ (MDS_SVC_INFO *)ncs_patricia_tree_getnext(
+ &gl_mds_mcm_cb->svc_list,
+ (uint8_t *)&svc_info->svc_hdl);
temp_pwe_hdl =
m_MDS_GET_PWE_HDL_FROM_SVC_HDL(svc_info->svc_hdl);
if (temp_pwe_hdl ==
@@ -769,8 +773,7 @@ uint32_t mds_mcm_pwe_destroy(NCSMDS_ADMOP_INFO *info)
mds_mcm_svc_uninstall(&temp_ncsmds_info);
}
- svc_info = (MDS_SVC_INFO *)ncs_patricia_tree_getnext(
- &gl_mds_mcm_cb->svc_list, (uint8_t *)&svc_info->svc_hdl);
+ svc_info = next_svc_info;
}
/* STEP 2: Delete entry from PWE Table */
diff --git a/src/mds/mds_svc_op.c b/src/mds/mds_svc_op.c
index 2398ad63d..cf927e595 100644
--- a/src/mds/mds_svc_op.c
+++ b/src/mds/mds_svc_op.c
@@ -111,12 +111,11 @@ const static char * DOWN_TAG = "svc_down";
#define MDS_SVC_LOG_INFO(tag, info, format, args...) \
m_MDS_LOG_INFO("MCM:API: %s : svc_id = %s(%d)" \
- " on VDEST id = %d, svc_pvt_ver = %d : " format, \
+ " on VDEST id = %d : " format, \
tag, \
get_svc_names((info)->i_svc_id), \
(info)->i_svc_id, \
m_MDS_GET_VDEST_ID_FROM_PWE_HDL(info->i_mds_hdl), \
- (info)->info.svc_install.i_mds_svc_pvt_ver, \
##args);
uint32_t mds_svc_op_install(NCSMDS_INFO *info) {
@@ -241,7 +240,9 @@ uint32_t mds_svc_op_install(NCSMDS_INFO *info) {
}
}
- MDS_SVC_LOG_INFO(INSTALL_TAG, info, "Install successfull");
+ MDS_SVC_LOG_INFO(INSTALL_TAG, info, "Install successful with"
+ " svc_pvt_ver = %d",
+ info->info.svc_install.i_mds_svc_pvt_ver);
m_MDS_LEAVE();
return NCSCC_RC_SUCCESS;
}
diff --git a/src/mds/mds_tipc_fctrl_intf.cc b/src/mds/mds_tipc_fctrl_intf.cc
index 8ae39eb16..548102aa1 100644
--- a/src/mds/mds_tipc_fctrl_intf.cc
+++ b/src/mds/mds_tipc_fctrl_intf.cc
@@ -238,9 +238,9 @@ uint32_t process_all_events(void) {
running = false;
}
- delete evt;
portid_map_mutex.unlock();
if (!running) m_NCS_SEL_OBJ_IND(&evt->destroy_ack_obj_);
+ delete evt;
}
}
// timeout, scan all portid and send ack msgs
--
2.25.1
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel