Skip to content

Commit

Permalink
GTEST: added short/bcopy send message
Browse files Browse the repository at this point in the history
- added short/bcopy send message call to allow some tests
  run without AM_SHORT capability
  • Loading branch information
Sergey Oblomov committed Jan 31, 2019
1 parent 3883b79 commit f20b0d1
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 23 deletions.
19 changes: 1 addition & 18 deletions test/gtest/uct/ib/test_rc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ class test_rc_max_wr : public test_rc {
/* Check that max_wr stops from sending */
UCS_TEST_P(test_rc_max_wr, send_limit)
{
check_caps(UCT_IFACE_FLAG_AM_SHORT);

/* first 32 messages should be OK */
send_am_messages(m_e1, 32, UCS_OK);

Expand Down Expand Up @@ -115,8 +113,6 @@ void test_rc_flow_control::validate_grant(entity *e)
void test_rc_flow_control::test_general(int wnd, int soft_thresh,
int hard_thresh, bool is_fc_enabled)
{
check_caps(UCT_IFACE_FLAG_AM_SHORT);

set_fc_attributes(m_e1, is_fc_enabled, wnd, soft_thresh, hard_thresh);

send_am_messages(m_e1, wnd, UCS_OK);
Expand All @@ -134,8 +130,6 @@ void test_rc_flow_control::test_general(int wnd, int soft_thresh,

void test_rc_flow_control::test_pending_grant(int wnd)
{
check_caps(UCT_IFACE_FLAG_AM_SHORT);

/* Block send capabilities of m_e2 for fc grant to be
* added to the pending queue. */
disable_entity(m_e2);
Expand All @@ -161,8 +155,6 @@ void test_rc_flow_control::test_pending_grant(int wnd)

void test_rc_flow_control::test_flush_fc_disabled()
{
check_caps(UCT_IFACE_FLAG_AM_SHORT);

set_fc_disabled(m_e1);
ucs_status_t status;

Expand All @@ -173,8 +165,7 @@ void test_rc_flow_control::test_flush_fc_disabled()

/* send active message should be OK */
get_fc_ptr(m_e1)->fc_wnd = 1;
status = uct_ep_am_short(m_e1->ep(0), 0, 0, NULL, 0);
EXPECT_EQ(UCS_OK, status);
send_am_message(m_e1, 1, UCS_OK);
EXPECT_EQ(0, get_fc_ptr(m_e1)->fc_wnd);

/* flush must have resources */
Expand All @@ -186,8 +177,6 @@ void test_rc_flow_control::test_pending_purge(int wnd, int num_pend_sends)
{
pending_send_request_t reqs[num_pend_sends];

check_caps(UCT_IFACE_FLAG_AM_SHORT);

disable_entity(m_e2);
set_fc_attributes(m_e1, true, wnd, wnd, 1);

Expand Down Expand Up @@ -225,8 +214,6 @@ UCS_TEST_P(test_rc_flow_control, pending_only_fc)
{
int wnd = 2;

check_caps(UCT_IFACE_FLAG_AM_SHORT);

disable_entity(m_e2);
set_fc_attributes(m_e1, true, wnd, wnd, 1);

Expand Down Expand Up @@ -263,8 +250,6 @@ void test_rc_flow_control_stats::test_general(int wnd, int soft_thresh,
{
uint64_t v;

check_caps(UCT_IFACE_FLAG_AM_SHORT);

set_fc_attributes(m_e1, true, wnd, soft_thresh, hard_thresh);

send_am_messages(m_e1, wnd, UCS_OK);
Expand Down Expand Up @@ -297,8 +282,6 @@ UCS_TEST_P(test_rc_flow_control_stats, soft_request)
int s_thresh = 4;
int h_thresh = 1;

check_caps(UCT_IFACE_FLAG_AM_SHORT);

set_fc_attributes(m_e1, true, wnd, s_thresh, h_thresh);
send_am_and_flush(m_e1, wnd - (s_thresh - 1));

Expand Down
2 changes: 1 addition & 1 deletion test/gtest/uct/ib/test_rc.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class test_rc : public uct_test {
void send_am_messages(entity *e, int wnd, ucs_status_t expected,
uint8_t am_id = 0, int ep_idx = 0) {
for (int i = 0; i < wnd; i++) {
EXPECT_EQ(expected, uct_ep_am_short(e->ep(ep_idx), am_id, 0, NULL, 0));
EXPECT_EQ(expected, send_am_message(e, wnd, am_id, ep_idx));
}
}

Expand Down
6 changes: 2 additions & 4 deletions test/gtest/uct/ib/test_ud.cc
Original file line number Diff line number Diff line change
Expand Up @@ -441,8 +441,6 @@ UCS_TEST_P(test_ud, crep_drop2) {
UCS_TEST_P(test_ud, crep_ack_drop) {
ucs_status_t status;

check_caps(UCT_IFACE_FLAG_AM_SHORT);

connect_to_iface();

/* drop ACK from CERQ/CREP */
Expand All @@ -463,7 +461,7 @@ UCS_TEST_P(test_ud, crep_ack_drop) {
set_tx_win(m_e1, 10);

do {
status = uct_ep_am_short(m_e1->ep(0), 0, 0, NULL, 0);
status = send_am_message(m_e1, 1, 0);
progress();
} while (status == UCS_ERR_NO_RESOURCE);
ASSERT_UCS_OK(status);
Expand All @@ -479,7 +477,7 @@ UCS_TEST_P(test_ud, crep_ack_drop) {
twait(500);
short_progress_loop();

status = uct_ep_am_short(m_e1->ep(0), 0, 0, NULL, 0);
status = send_am_message(m_e1, 1, 0);
ASSERT_UCS_OK(status);

short_progress_loop();
Expand Down
17 changes: 17 additions & 0 deletions test/gtest/uct/uct_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -995,3 +995,20 @@ void uct_test::entity::async_wrapper::check_miss()
{
ucs_async_check_miss(&m_async);
}

ucs_status_t uct_test::send_am_message(entity *e, int wnd, uint8_t am_id, int ep_idx)
{
ssize_t res;

if (is_caps_supported(UCT_IFACE_FLAG_AM_SHORT)) {
return uct_ep_am_short(e->ep(ep_idx), am_id, 0, NULL, 0);
} else {
res = uct_ep_am_bcopy(e->ep(ep_idx), am_id, pack_cb, NULL, 0);
return (ucs_status_t)(res >= 0 ? UCS_OK : res);
}
}

size_t uct_test::pack_cb(void *dest, void *arg) {
return 0;
}

3 changes: 3 additions & 0 deletions test/gtest/uct/uct_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,9 @@ class uct_test : public testing::TestWithParam<const resource*>,
uct_test::entity* create_entity(uct_iface_params_t &params);
int max_connections();

ucs_status_t send_am_message(entity *e, int wnd, uint8_t am_id = 0, int ep_idx = 0);
static size_t pack_cb(void *dest, void *arg);

ucs::ptr_vector<entity> m_entities;
uct_iface_config_t *m_iface_config;
uct_md_config_t *m_md_config;
Expand Down

0 comments on commit f20b0d1

Please sign in to comment.