Skip to content

Commit

Permalink
prov/efa: Fix the read_bad_recv_status unit test
Browse files Browse the repository at this point in the history
When device supports unsolicited write, efadv_wc_is_unsolicited is called in the error
path of IBV_WC_RECV as well, but we failed to setup its mock
in the unit test, it will cause a segfault inside the rdma-core
function when we don't really have a cqe, which is what the current unit test does.

This patch fixes this bug.

Signed-off-by: Shi Jin <sjina@amazon.com>
  • Loading branch information
shijin-aws committed Nov 19, 2024
1 parent a50accb commit 67c1805
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions prov/efa/test/efa_unit_test_cq.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,14 @@ void test_ibv_cq_ex_read_bad_recv_status(struct efa_resource **state)
*/
efa_rdm_cq->ibv_cq.ibv_cq_ex->wr_id = (uintptr_t)pkt_entry;
efa_rdm_cq->ibv_cq.ibv_cq_ex->status = IBV_WC_GENERAL_ERR;

#if HAVE_CAPS_UNSOLICITED_WRITE_RECV
if (efa_rdm_use_unsolicited_write_recv()) {
efadv_cq_from_ibv_cq_ex(efa_rdm_cq->ibv_cq.ibv_cq_ex)->wc_is_unsolicited = &efa_mock_efadv_wc_is_unsolicited;
will_return(efa_mock_efadv_wc_is_unsolicited, false);
}
#endif

ret = fi_cq_read(resource->cq, &cq_entry, 1);
assert_int_equal(ret, -FI_EAGAIN);

Expand Down

0 comments on commit 67c1805

Please sign in to comment.