Skip to content

Commit 647c01a

Browse files
committed
TEST/FC: Fix grant mpool leak when FC is disabled
1 parent cf17d05 commit 647c01a

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

test/gtest/uct/ib/test_rc.cc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,24 @@ void test_rc_flow_control::init()
7777
}
7878
test_rc::init();
7979

80+
ucs_assert(rc_iface(m_e1)->config.fc_enabled);
81+
ucs_assert(rc_iface(m_e2)->config.fc_enabled);
82+
8083
uct_iface_set_am_handler(m_e1->iface(), FLUSH_AM_ID, am_handler,
8184
NULL, UCT_CB_FLAG_SYNC);
8285
uct_iface_set_am_handler(m_e2->iface(), FLUSH_AM_ID, am_handler,
8386
NULL, UCT_CB_FLAG_SYNC);
8487

8588
}
8689

90+
void test_rc_flow_control::cleanup()
91+
{
92+
/* Restore FC state to enabled, so iface cleanup will destroy the grant mpool */
93+
rc_iface(m_e1)->config.fc_enabled = 1;
94+
rc_iface(m_e2)->config.fc_enabled = 1;
95+
test_rc::cleanup();
96+
}
97+
8798
void test_rc_flow_control::send_am_and_flush(entity *e, int num_msg)
8899
{
89100
m_am_rx_count = 0;

test/gtest/uct/ib/test_rc.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ class test_rc_flow_control : public test_rc {
6060
} pending_send_request_t;
6161

6262
void init();
63+
void cleanup();
6364

6465
virtual uct_rc_fc_t* get_fc_ptr(entity *e, int ep_idx = 0) {
6566
return &rc_ep(e, ep_idx)->fc;
@@ -87,7 +88,7 @@ class test_rc_flow_control : public test_rc {
8788

8889
void set_fc_disabled(entity *e) {
8990
/* same as default settings in rc_iface_init */
90-
set_fc_attributes(m_e1, false, std::numeric_limits<int16_t>::max(), 0, 0);
91+
set_fc_attributes(e, false, std::numeric_limits<int16_t>::max(), 0, 0);
9192
}
9293

9394
void send_am_and_flush(entity *e, int num_msg);

0 commit comments

Comments
 (0)