@@ -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 */
@@ -1732,7 +1733,7 @@ void test_efa_cq_sread_einval(struct efa_resource **state)
17321733 efa_unit_test_resource_construct (resource , FI_EP_RDM , EFA_DIRECT_FABRIC_NAME );
17331734 efa_cq = container_of (resource -> cq , struct efa_cq , util_cq .cq_fid .fid );
17341735
1735- assert_null (efa_cq -> wait_obj );
1736+ assert_int_equal (efa_cq -> wait_obj , FI_WAIT_NONE );
17361737 assert_null (efa_cq -> ibv_cq .channel );
17371738
17381739 ret = fi_cq_sread (resource -> cq , & cq_entry , 1 , NULL , 1 );
@@ -2316,4 +2317,48 @@ void test_efa_cq_read_mixed_success_error(struct efa_resource **state)
23162317 will_return_maybe (efa_mock_efa_ibv_cq_start_poll_return_mock , ENOENT );
23172318 assert_int_equal (fi_close (& resource -> ep -> fid ), 0 );
23182319 resource -> ep = NULL ;
2319- }
2320+ }
2321+
2322+
2323+
2324+ /**
2325+ * @brief Test fi_cq_sread() with count=0 returns -FI_EINVAL
2326+ */
2327+ void test_efa_rdm_cq_sread_invalid_count (struct efa_resource * * state )
2328+ {
2329+ struct efa_resource * resource = * state ;
2330+ struct fi_cq_data_entry cq_entry ;
2331+ int ret ;
2332+
2333+ efa_unit_test_resource_construct (resource , FI_EP_RDM , EFA_FABRIC_NAME );
2334+
2335+ ret = fi_cq_sread (resource -> cq , & cq_entry , 0 , NULL , 0 );
2336+ assert_int_equal (ret , - FI_EINVAL );
2337+
2338+ will_return_maybe (efa_mock_efa_ibv_cq_start_poll_return_mock , ENOENT );
2339+ assert_int_equal (fi_close (& resource -> ep -> fid ), 0 );
2340+ resource -> ep = NULL ;
2341+ }
2342+
2343+ /**
2344+ * @brief Test fi_cq_sread() with wait object disabled returns -FI_EINVAL
2345+ */
2346+ void test_efa_rdm_cq_sread_no_wait_obj (struct efa_resource * * state )
2347+ {
2348+ struct efa_resource * resource = * state ;
2349+ struct fi_cq_data_entry cq_entry ;
2350+ int ret ;
2351+
2352+ /* Open a temporary CQ with wait-none so no wait object exists */
2353+ struct fid_cq * waitless_cq = NULL ;
2354+ efa_unit_test_resource_construct (resource , FI_EP_RDM , EFA_FABRIC_NAME );
2355+ assert_int_equal (fi_cq_open (resource -> domain ,
2356+ & (struct fi_cq_attr ){ .wait_obj = FI_WAIT_NONE },
2357+ & waitless_cq , NULL ), 0 );
2358+
2359+ ret = fi_cq_sread (waitless_cq , & cq_entry , 1 , NULL , 0 );
2360+ assert_int_equal (ret , - FI_EINVAL );
2361+
2362+ assert_int_equal (fi_close (& waitless_cq -> fid ), 0 );
2363+ will_return_maybe (efa_mock_efa_ibv_cq_start_poll_return_mock , ENOENT );
2364+ }
0 commit comments