Hi Hieu,
Ack from me with a minor comment, you might need to check the returned
value of osaf_poll() for the errors (-1).
Thanks
Minh
On 22/1/21 3:37 pm, hieu.h.hoang wrote:
- Reason: unordered processing, the subscription request is processed
after the change role request
- Actions:
- Wait for subscription request to process successfully
- Apply fixing to the follow test cases: 9 5, 11 5, 11 6, 14 5, 14
6
---
src/mds/apitest/mdstipc.h | 1 +
src/mds/apitest/mdstipc_api.c | 28 ++++++++++++++++++++++--
src/mds/apitest/mdstipc_conf.c | 39 ++++++++++++++++++++++++++++++++++
3 files changed, 66 insertions(+), 2 deletions(-)
diff --git a/src/mds/apitest/mdstipc.h b/src/mds/apitest/mdstipc.h
index 2b9fcf2fd..b84c303e6 100644
--- a/src/mds/apitest/mdstipc.h
+++ b/src/mds/apitest/mdstipc.h
@@ -206,6 +206,7 @@ uint32_t destroy_pwe_on_vdest(MDS_HDL);
uint32_t tet_create_task(NCS_OS_CB, NCSCONTEXT*);
uint32_t tet_release_task(void *task_handle);
+uint32_t wait_adest_sel_obj(MDS_SVC_ID, int64_t);
int is_adest_sel_obj_found(int);
int is_sel_obj_found(int);
int is_vdest_sel_obj_found(int, int);
diff --git a/src/mds/apitest/mdstipc_api.c b/src/mds/apitest/mdstipc_api.c
index 6ce3b7103..581ea53f3 100644
--- a/src/mds/apitest/mdstipc_api.c
+++ b/src/mds/apitest/mdstipc_api.c
@@ -5136,6 +5136,10 @@ void tet_send_response_tp_5()
printf("\nFail\n");
FAIL = 1;
}
+ if (wait_adest_sel_obj(NCSMDS_SVC_ID_EXTERNAL_MIN, 10)) {
+ printf("\nFail\n");
+ FAIL = 1;
+ }
if (mds_service_retrieve(gl_tet_adest.mds_pwe1_hdl,
NCSMDS_SVC_ID_EXTERNAL_MIN,
SA_DISPATCH_ALL) != NCSCC_RC_SUCCESS) {
@@ -5223,6 +5227,10 @@ void tet_send_response_tp_6()
printf("\nFail\n");
FAIL = 1;
}
+ if (wait_adest_sel_obj(NCSMDS_SVC_ID_EXTERNAL_MIN, 10)) {
+ printf("\nFail\n");
+ FAIL = 1;
+ }
if (mds_service_retrieve(gl_tet_adest.mds_pwe1_hdl,
NCSMDS_SVC_ID_EXTERNAL_MIN,
SA_DISPATCH_ALL) != NCSCC_RC_SUCCESS) {
@@ -6891,9 +6899,13 @@ void tet_send_response_ack_tp_5()
printf("\nFail\n");
FAIL = 1;
}
+ if (wait_adest_sel_obj(NCSMDS_SVC_ID_EXTERNAL_MIN, 10)) {
+ printf("\nFail\n");
+ FAIL = 1;
+ }
if (mds_service_retrieve(gl_tet_adest.mds_pwe1_hdl,
- NCSMDS_SVC_ID_EXTERNAL_MIN,
- SA_DISPATCH_ALL) != NCSCC_RC_SUCCESS) {
+ NCSMDS_SVC_ID_EXTERNAL_MIN,
+ SA_DISPATCH_ALL) != NCSCC_RC_SUCCESS) {
printf("\nFail\n");
FAIL = 1;
}
@@ -6975,6 +6987,10 @@ void tet_send_response_ack_tp_6()
printf("\nFail\n");
FAIL = 1;
}
+ if (wait_adest_sel_obj(NCSMDS_SVC_ID_EXTERNAL_MIN, 10)) {
+ printf("\nFail\n");
+ FAIL = 1;
+ }
if (mds_service_retrieve(gl_tet_adest.mds_pwe1_hdl,
NCSMDS_SVC_ID_EXTERNAL_MIN,
SA_DISPATCH_ALL) != NCSCC_RC_SUCCESS) {
@@ -9224,6 +9240,10 @@ void tet_direct_send_all_tp_5()
printf("\nFail");
FAIL = 1;
}
+ if (wait_adest_sel_obj(NCSMDS_SVC_ID_EXTERNAL_MIN, 10)) {
+ printf("\nFail\n");
+ FAIL = 1;
+ }
if (mds_service_retrieve(gl_tet_adest.mds_pwe1_hdl,
NCSMDS_SVC_ID_EXTERNAL_MIN,
SA_DISPATCH_ALL) != NCSCC_RC_SUCCESS) {
@@ -9473,6 +9493,10 @@ void tet_direct_send_all_tp_6()
printf("\nFail");
FAIL = 1;
}
+ if (wait_adest_sel_obj(NCSMDS_SVC_ID_EXTERNAL_MIN, 10)) {
+ printf("\nFail\n");
+ FAIL = 1;
+ }
if (mds_service_retrieve(gl_tet_adest.mds_pwe1_hdl,
NCSMDS_SVC_ID_EXTERNAL_MIN,
SA_DISPATCH_ALL) != NCSCC_RC_SUCCESS) {
diff --git a/src/mds/apitest/mdstipc_conf.c b/src/mds/apitest/mdstipc_conf.c
index cd2f80791..04cf191bc 100644
--- a/src/mds/apitest/mdstipc_conf.c
+++ b/src/mds/apitest/mdstipc_conf.c
@@ -1624,6 +1624,45 @@ int is_adest_sel_obj_found(int si)
}
return 0;
}
+
+uint32_t wait_adest_sel_obj(MDS_SVC_ID svc_id, int64_t timeout /* in seconds
*/)
+{
+ int FAIL = 0;
+ int svc_idx = -1;
+ struct pollfd sel;
+ unsigned int count;
+
+ for (int i = 0; i < gl_tet_adest.svc_count; i++) {
+ if (gl_tet_adest.svc[i].svc_id == svc_id) {
+ svc_idx = i;
+ break;
+ }
+ }
+ if (svc_idx < 0) {
+ printf("\nNot found the service id %u\n", svc_id);
+ FAIL = 1;
+ } else {
+ /* Polling the sel_obj */
+ sel.fd =
+ m_GET_FD_FROM_SEL_OBJ(gl_tet_adest.svc[svc_idx].sel_obj);
+ sel.events = POLLIN;
+ count = osaf_poll(&sel, 1, timeout * 1000);
+ switch (count) {
+ case 0:
+ printf("\nTIMED OUT\n");
+ FAIL = 1;
+ break;
+ case 1:
+ if ((sel.revents & POLLIN) == 0) {
+ printf("\nEvent type mismatch\n");
+ FAIL = 1;
+ }
+ break;
+ }
+ }
+ return FAIL;
+}
+
uint32_t tet_create_task(NCS_OS_CB task_startup, NCSCONTEXT *t_handle)
{
char taskname[] = "MDS_Tipc test";
_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel