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

GTEST: Refactored protocol selection mock #10369

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

iyastreb
Copy link
Contributor

What?

This PR contains enhancements of the original protocol selection mock (#9989):

  • Ability to mock any number of devices with different capabilities
  • Match the exact config of protocol selection (e.g. rc_mlx5/mock_0:1 50% on path0 and 50% on path1)
  • Small improvements

Finally all those changes are needed to reproduce real protocol selection issues (like https://redmine.mellanox.com/issues/4177809, https://redmine.mellanox.com/issues/4134043)

UCS_MOCK_ORIG_FUNC(m_self->m_mock, &m_self->m_tl->query_devices, md,
tl_devices_p, num_tl_devices_p);
if (*num_tl_devices_p == 0) {
return UCS_OK;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return UCS_OK;
return UCS_ERR_NO_DEVICE;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a normal situation when query returns 0 devices, and original function returns UCS_OK in this case.

Comment on lines 94 to 95
tmp = (uct_tl_device_resource_t *)ucs_malloc(
sizeof(*tmp) * size,"mock_tl_devices");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
tmp = (uct_tl_device_resource_t *)ucs_malloc(
sizeof(*tmp) * size,"mock_tl_devices");
auto tmp = (uct_tl_device_resource_t *)ucs_malloc(
sizeof(*tmp) * size, "mock_tl_devices");

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, applied with some other changes to make compiler happy

sizeof(*tmp) * size,"mock_tl_devices");
ucs_sys_device_t sys_dev = 1;
unsigned i = 0;
for (auto & it : m_self->m_iface_attrs_funcs) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for (auto & it : m_self->m_iface_attrs_funcs) {
for (const auto &it : m_self->m_iface_attrs_funcs) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants