@@ -1467,6 +1467,7 @@ static void test_efa_cq_data_path_direct_status(
14671467 efa_cq = container_of (cq , struct efa_cq , util_cq .cq_fid );
14681468
14691469 assert_true (efa_cq -> ibv_cq .data_path_direct_enabled == data_path_direct_enabled );
1470+
14701471 assert_int_equal (fi_close (& cq -> fid ), 0 );
14711472
14721473 /* Recover the mocked vendor_id */
@@ -1719,7 +1720,7 @@ void test_efa_cq_sread_einval(struct efa_resource **state)
17191720 efa_unit_test_resource_construct (resource , FI_EP_RDM , EFA_DIRECT_FABRIC_NAME );
17201721 efa_cq = container_of (resource -> cq , struct efa_cq , util_cq .cq_fid .fid );
17211722
1722- assert_null (efa_cq -> wait_obj );
1723+ assert_int_equal (efa_cq -> wait_obj , FI_WAIT_NONE );
17231724 assert_null (efa_cq -> ibv_cq .channel );
17241725
17251726 ret = fi_cq_sread (resource -> cq , & cq_entry , 1 , NULL , 1 );
@@ -2303,4 +2304,44 @@ void test_efa_cq_read_mixed_success_error(struct efa_resource **state)
23032304 will_return_maybe (efa_mock_efa_ibv_cq_start_poll_return_mock , ENOENT );
23042305 assert_int_equal (fi_close (& resource -> ep -> fid ), 0 );
23052306 resource -> ep = NULL ;
2306- }
2307+ }
2308+
2309+
2310+
2311+ /**
2312+ * @brief Test fi_cq_sread() with count=0 returns -FI_EINVAL
2313+ */
2314+ void test_efa_rdm_cq_sread_invalid_count (struct efa_resource * * state )
2315+ {
2316+ struct efa_resource * resource = * state ;
2317+ struct fi_cq_data_entry cq_entry ;
2318+ int ret ;
2319+
2320+ efa_unit_test_resource_construct (resource , FI_EP_RDM , EFA_FABRIC_NAME );
2321+
2322+ ret = fi_cq_sread (resource -> cq , & cq_entry , 0 , NULL , 0 );
2323+ assert_int_equal (ret , - FI_EINVAL );
2324+
2325+ will_return_maybe (efa_mock_efa_ibv_cq_start_poll_return_mock , ENOENT );
2326+ assert_int_equal (fi_close (& resource -> ep -> fid ), 0 );
2327+ resource -> ep = NULL ;
2328+ }
2329+
2330+ /**
2331+ * @brief Test fi_cq_sread() with no wait object returns -FI_ENOSYS
2332+ */
2333+ void test_efa_rdm_cq_sread_no_wait_obj (struct efa_resource * * state )
2334+ {
2335+ struct efa_resource * resource = * state ;
2336+ struct fi_cq_data_entry cq_entry ;
2337+ int ret ;
2338+
2339+ efa_unit_test_resource_construct (resource , FI_EP_RDM , EFA_FABRIC_NAME );
2340+
2341+ ret = fi_cq_sread (resource -> cq , & cq_entry , 1 , NULL , 0 );
2342+ assert_int_equal (ret , - FI_ENOSYS );
2343+
2344+ will_return_maybe (efa_mock_efa_ibv_cq_start_poll_return_mock , ENOENT );
2345+ assert_int_equal (fi_close (& resource -> ep -> fid ), 0 );
2346+ resource -> ep = NULL ;
2347+ }
0 commit comments