Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HG test: add concurrent multi RPC test #686

Merged
merged 4 commits into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Testing/unit/hg/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ function(add_mercury_test_comm_all test_name)
if(NOT ((${comm} STREQUAL "bmi") OR (${comm} STREQUAL "mpi")))
add_mercury_test_comm(${test_name} ${comm}
"${NA_${upper_comm}_TESTING_PROTOCOL}"
"${NA_TESTING_NO_BLOCK}" ${MERCURY_TESTING_ENABLE_PARALLEL} true false)
"${NA_TESTING_NO_BLOCK}" false true false)
endif()
# Scalable test
if(NOT APPLE)
Expand Down
40 changes: 16 additions & 24 deletions Testing/unit/hg/mercury_unit.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,56 +127,48 @@ hg_test_handle_create_cb(hg_handle_t handle, void *arg)
static hg_return_t
hg_test_finalize_rpc(struct hg_unit_info *info, hg_uint8_t target_id)
{
hg_request_t *request_object = NULL;
hg_handle_t handle = HG_HANDLE_NULL;
hg_return_t ret = HG_SUCCESS, cleanup_ret;
hg_return_t ret;
unsigned int completed;

request_object = hg_request_create(info->request_class);
hg_request_reset(info->request);

ret = HG_Create(
info->context, info->target_addr, hg_test_finalize_id_g, &handle);
ret = HG_Reset(info->handles[0], info->target_addr, hg_test_finalize_id_g);
HG_TEST_CHECK_HG_ERROR(
done, ret, "HG_Create() failed (%s)", HG_Error_to_string(ret));
error, ret, "HG_Reset() failed (%s)", HG_Error_to_string(ret));

/* Set target ID */
ret = HG_Set_target_id(handle, target_id);
ret = HG_Set_target_id(info->handles[0], target_id);
HG_TEST_CHECK_HG_ERROR(
done, ret, "HG_Set_target_id() failed (%s)", HG_Error_to_string(ret));
error, ret, "HG_Set_target_id() failed (%s)", HG_Error_to_string(ret));

/* Forward call to target addr */
ret = HG_Forward(handle, hg_test_finalize_rpc_cb, request_object, NULL);
ret = HG_Forward(
info->handles[0], hg_test_finalize_rpc_cb, info->request, NULL);
HG_TEST_CHECK_HG_ERROR(
done, ret, "HG_Forward() failed (%s)", HG_Error_to_string(ret));
error, ret, "HG_Forward() failed (%s)", HG_Error_to_string(ret));

hg_request_wait(request_object, HG_TEST_TIMEOUT_MAX, &completed);
hg_request_wait(info->request, HG_TEST_TIMEOUT_MAX, &completed);
if (!completed) {
HG_TEST_LOG_WARNING("Canceling finalize, no response from server");

ret = HG_Cancel(handle);
ret = HG_Cancel(info->handles[0]);
HG_TEST_CHECK_HG_ERROR(
done, ret, "HG_Cancel() failed (%s)", HG_Error_to_string(ret));
error, ret, "HG_Cancel() failed (%s)", HG_Error_to_string(ret));

hg_request_wait(request_object, HG_TEST_TIMEOUT_MAX, &completed);
hg_request_wait(info->request, HG_TEST_TIMEOUT_MAX, &completed);
}

done:
cleanup_ret = HG_Destroy(handle);
HG_TEST_CHECK_ERROR_DONE(cleanup_ret != HG_SUCCESS,
"HG_Destroy() failed (%s)", HG_Error_to_string(cleanup_ret));

hg_request_destroy(request_object);
return HG_SUCCESS;

error:
return ret;
}

/*---------------------------------------------------------------------------*/
static hg_return_t
hg_test_finalize_rpc_cb(const struct hg_cb_info *callback_info)
{
hg_request_t *request_object = (hg_request_t *) callback_info->arg;

hg_request_complete(request_object);
hg_request_complete((hg_request_t *) callback_info->arg);

return HG_SUCCESS;
}
Expand Down
Loading
Loading