Hi Hieu, Looks good. Ack. B.R/Thang
-----Original Message----- From: Hieu Hong Hoang <hieu.h.ho...@dektech.com.au> Sent: Tuesday, December 6, 2022 9:25 AM To: Thang Duc Nguyen <thang.d.ngu...@dektech.com.au>; Minh Hon Chau <minh.c...@dektech.com.au>; Thien Minh Huynh <thien.m.hu...@dektech.com.au> Cc: opensaf-devel@lists.sourceforge.net; Hieu Hong Hoang <hieu.h.ho...@dektech.com.au> Subject: [PATCH 1/1] mds: Fix failed test cases in mdstest [#2798] A number of test cases are failed because it retrieved the event without polling the select object. Solution is to poll the select object. --- src/mds/apitest/mdstipc_api.c | 233 +++++++++++++++++++++++++++++++--- 1 file changed, 216 insertions(+), 17 deletions(-) diff --git a/src/mds/apitest/mdstipc_api.c b/src/mds/apitest/mdstipc_api.c index b2ef3465c..68c5b49d9 100644 --- a/src/mds/apitest/mdstipc_api.c +++ b/src/mds/apitest/mdstipc_api.c @@ -1733,9 +1733,23 @@ void tet_svc_subscr_VDEST_10() printf("\nFail to change role\n"); FAIL = 1; } - // Retrieving the events + // Retrieving the first UP event + if (wait_adest_sel_obj(500, 10)) { + printf("\nFail\n"); + FAIL = 1; + } if (mds_service_retrieve(gl_tet_adest.mds_pwe1_hdl, 500, - SA_DISPATCH_ALL) != NCSCC_RC_SUCCESS) { + SA_DISPATCH_ONE) != NCSCC_RC_SUCCESS) { + printf("\nRetrieve servive 500 Fail\n"); + FAIL = 1; + } + // Retrieving the second UP event + if (wait_adest_sel_obj(500, 10)) { + printf("\nFail\n"); + FAIL = 1; + } + if (mds_service_retrieve(gl_tet_adest.mds_pwe1_hdl, 500, + SA_DISPATCH_ONE) != NCSCC_RC_SUCCESS) { printf("\nRetrieve servive 500 Fail\n"); FAIL = 1; } @@ -1753,10 +1767,24 @@ void tet_svc_subscr_VDEST_10() printf("\nFail to change the role of vdest role to quiesced\n"); FAIL = 1; } - // Retrieving the events + // Retrieving the first NO_ACTIVE event + if (wait_adest_sel_obj(500, 10)) { + printf("\nFail\n"); + FAIL = 1; + } if (mds_service_retrieve(gl_tet_adest.mds_pwe1_hdl, 500, - SA_DISPATCH_ALL) != NCSCC_RC_SUCCESS) { - printf("\nFail to retreive events\n"); + SA_DISPATCH_ONE) != NCSCC_RC_SUCCESS) { + printf("\nFail to retreive event\n"); + FAIL = 1; + } + // Retrieving the second NO_ACTIVE event + if (wait_adest_sel_obj(500, 10)) { + printf("\nFail\n"); + FAIL = 1; + } + if (mds_service_retrieve(gl_tet_adest.mds_pwe1_hdl, 500, + SA_DISPATCH_ONE) != NCSCC_RC_SUCCESS) { + printf("\nFail to retreive event\n"); FAIL = 1; } if ((tet_verify_version(gl_tet_adest.mds_pwe1_hdl, 500, 600, 1, @@ -1774,9 +1802,23 @@ void tet_svc_subscr_VDEST_10() } printf(" \n Sleeping for 3 minutes \n"); sleep(200); - // Retrieving the events + // Retrieving the first DOWN event + if (wait_adest_sel_obj(500, 10)) { + printf("\nFail\n"); + FAIL = 1; + } if (mds_service_retrieve(gl_tet_adest.mds_pwe1_hdl, 500, - SA_DISPATCH_ALL) != NCSCC_RC_SUCCESS) { + SA_DISPATCH_ONE) != NCSCC_RC_SUCCESS) { + printf("\nRetrieve Fail\n"); + FAIL = 1; + } + // Retrieving the second DOWN event + if (wait_adest_sel_obj(500, 10)) { + printf("\nFail\n"); + FAIL = 1; + } + if (mds_service_retrieve(gl_tet_adest.mds_pwe1_hdl, 500, + SA_DISPATCH_ONE) != NCSCC_RC_SUCCESS) { printf("\nRetrieve Fail\n"); FAIL = 1; } @@ -2021,6 +2063,10 @@ void tet_svc_subscr_VDEST_12() } printf("\nAction: Retrieving the events\n"); + if (wait_adest_sel_obj(500, 10)) { + printf("\nFail\n"); + FAIL = 1; + } if (mds_service_retrieve(gl_tet_adest.mds_pwe1_hdl, 500, SA_DISPATCH_ALL) != NCSCC_RC_SUCCESS) { printf("Retrieve Fail\n"); @@ -2666,6 +2712,10 @@ void tet_svc_subscr_ADEST_1() FAIL = 1; } else { printf("\nAction: Retrieve only ONE event\n"); + if (wait_adest_sel_obj(500, 10)) { + printf("\nFail\n"); + FAIL = 1; + } if (mds_service_retrieve(gl_tet_adest.mds_pwe1_hdl, 500, SA_DISPATCH_ONE) != NCSCC_RC_SUCCESS) { printf("Fail, retrieve ONE\n"); @@ -2993,6 +3043,10 @@ void tet_svc_subscr_ADEST_9() FAIL = 1; } else { printf("\nAction: Retreive three times, third shall fail\n"); + if (wait_adest_sel_obj(500, 10)) { + printf("\nFail\n"); + FAIL = 1; + } if (mds_service_retrieve(gl_tet_adest.mds_pwe1_hdl, 500, SA_DISPATCH_ONE) != NCSCC_RC_SUCCESS) { printf("\nFail mds_service_retrieve\n"); @@ -6254,7 +6308,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 +6316,21 @@ void tet_send_response_tp_14() NCSMDS_SCOPE_INTRANODE, 1, to_svcids) == NCSCC_RC_SUCCESS) { + // 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; - sleep(1); // Wait for up event mds_send_get_response( gl_tet_adest.mds_pwe1_hdl, NCSMDS_SVC_ID_INTERNAL_MIN, @@ -6827,11 +6894,27 @@ void tet_send_all_tp_1() FAIL = 1; } - if (vdest_change_role(200, V_DEST_RL_STANDBY) != NCSCC_RC_SUCCESS) { + // Retrieve the service events + 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) { printf("\nFail\n"); FAIL = 1; } + if (vdest_change_role(200, V_DEST_RL_STANDBY) != NCSCC_RC_SUCCESS) { + printf("\nFail\n"); + FAIL = 1; + } + // Retrieve the service event after changing role + 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) { @@ -6874,6 +6957,11 @@ void tet_send_all_tp_1() printf("\nFail\n"); FAIL = 1; } + // Retrieve the service event after changing role + 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) { @@ -6890,7 +6978,7 @@ void tet_send_all_tp_1() if ((mds_send_get_response( gl_tet_vdest[1].mds_pwe1_hdl, NCSMDS_SVC_ID_EXTERNAL_MIN, - NCSMDS_SVC_ID_EXTERNAL_MIN, gl_tet_adest.adest, 0, + NCSMDS_SVC_ID_EXTERNAL_MIN, gl_tet_adest.adest, 30, MDS_SEND_PRIORITY_LOW, mesg) != NCSCC_RC_SUCCESS)) { printf("\nFail\n"); FAIL = 1; @@ -6995,11 +7083,28 @@ void tet_send_all_tp_2() FAIL = 1; } + // Retrieving the UP event + 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) { + printf("\nFail\n"); + FAIL = 1; + } + if (vdest_change_role(200, V_DEST_RL_STANDBY) != NCSCC_RC_SUCCESS) { printf("\nFail\n"); FAIL = 1; } + // Retrieving the service event after changing role + 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) { @@ -7021,6 +7126,11 @@ void tet_send_all_tp_2() printf("\nFail\n"); FAIL = 1; } + // Retrieving the service event after changing role + 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) { @@ -7033,6 +7143,11 @@ void tet_send_all_tp_2() printf("\nFail\n"); FAIL = 1; } + // Retrieving the service event after changing role + 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) { @@ -7070,12 +7185,28 @@ void tet_send_all_tp_2() printf("\nTASK is released\n"); fflush(stdout); /*SNDRSP*/ + // Retrieving the NEW_ACTIVE event + 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) { + printf("\nFail\n"); + FAIL = 1; + } printf("\nChange role to standby\n"); if (vdest_change_role(200, V_DEST_RL_STANDBY) != NCSCC_RC_SUCCESS) { printf("\nFail\n"); FAIL = 1; } + // Retrieving the service event after changing role + 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) { @@ -9840,14 +9971,26 @@ void tet_direct_send_all_tp_5() printf("\nFail"); FAIL = 1; } + // Retrieving the first UP event from either adest or vdest 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) { - printf("\nFail"); + SA_DISPATCH_ONE) != NCSCC_RC_SUCCESS) { + printf("\nFail\n"); + FAIL = 1; + } + // Retrieving the second UP event from either adest or vdest + 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_ONE) != NCSCC_RC_SUCCESS) { + printf("\nFail\n"); FAIL = 1; } @@ -9860,9 +10003,14 @@ void tet_direct_send_all_tp_5() FAIL = 1; } + // Retrieving the NO_ACTIVE event + 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) { + SA_DISPATCH_ONE) != NCSCC_RC_SUCCESS) { printf("\nFail\n"); FAIL = 1; } @@ -9882,9 +10030,14 @@ void tet_direct_send_all_tp_5() printf("\nFail\n"); FAIL = 1; } + // Retrieving the NEW_ACTIVE event + 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) { + SA_DISPATCH_ONE) != NCSCC_RC_SUCCESS) { printf("\nFail\n"); FAIL = 1; } @@ -9895,9 +10048,14 @@ void tet_direct_send_all_tp_5() printf("\nFail\n"); FAIL = 1; } + // Retrieving the NO_ACTIVE event + 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) { + SA_DISPATCH_ONE) != NCSCC_RC_SUCCESS) { printf("\nFail\n"); FAIL = 1; } @@ -9929,6 +10087,18 @@ void tet_direct_send_all_tp_5() else printf("\nSuccess\n"); + // Retrieving the NEW_ACTIVE event + 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_ONE) != NCSCC_RC_SUCCESS) { + printf("\nFail\n"); + FAIL = 1; + } + if (tet_release_task(gl_tet_adest.svc[1].task.t_handle) == NCSCC_RC_SUCCESS) printf("\nTASK is released\n"); @@ -9940,9 +10110,15 @@ void tet_direct_send_all_tp_5() printf("\nFail\n"); FAIL = 1; } + + // Retrieving the NO_ACTIVE event + 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) { + SA_DISPATCH_ONE) != NCSCC_RC_SUCCESS) { printf("\nFail\n"); FAIL = 1; } @@ -9972,6 +10148,17 @@ void tet_direct_send_all_tp_5() else printf("\nSuccess\n"); + // Retrieving the NEW_ACTIVE event + 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_ONE) != NCSCC_RC_SUCCESS) { + printf("\nFail\n"); + FAIL = 1; + } if (tet_release_task(gl_tet_vdest[1].svc[1].task.t_handle) == NCSCC_RC_SUCCESS) printf("\nTASK is released\n"); @@ -10129,6 +10316,10 @@ void tet_direct_send_all_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) { @@ -10142,6 +10333,10 @@ void tet_direct_send_all_tp_6() 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) { @@ -10200,6 +10395,10 @@ void tet_direct_send_all_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) { -- 2.25.1 _______________________________________________ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel