I finally got a chance to try your tests.  A few comments:

 - Several of the tests are buggy.  See the patch below at least.

 - It would be much more useful if the COMPARE() macro printed the
   expected and actual value on failure.

 - Similarly, other macros should probably also print more context.
   For example, in something like:

                CHECK_PTR("ibv_create_qp", qp[i], goto cleanup);

   I would probably want to know the value of i on failure.

 - I don't believe some of the tests are really valid.  For example,
   the max number of QPs doesn't have to be precisely correct -- no
   valid app is going to depend on being able to create exactly that
   number of QPs and no more.

 - In any case, I'm not convinced that this sort of negative testing
   is the most valuable thing to focus on right now.  I think it would
   be better to have regression tests of basic functionality (sends,
   receives, RDMA, CQ polling, etc) and stress tests before testing
   whether a buggy app will get the right error value when passing
   invalid parameters.

 - R.

Index: test_cq.c
===================================================================
--- test_cq.c   (revision 3639)
+++ test_cq.c   (working copy)
@@ -106,6 +106,7 @@ int cq_2(
 {
        struct ibv_context      *ib_cont = NULL;
        struct ibv_pd           *pd = NULL;
+       struct ibv_comp_channel *channel = NULL;
        struct ibv_cq           *cq = NULL;
        struct ibv_cq           *event_cq = NULL;
        struct ibv_qp           *qp = NULL;
@@ -132,8 +133,11 @@ int cq_2(
        pd = ibv_alloc_pd(ib_cont);
        CHECK_PTR("ibv_alloc_pd", pd, goto cleanup);
 
+       channel = ibv_create_comp_channel(ib_cont);
+       CHECK_PTR("ibv_create_comp_channel", channel, goto cleanup);
+
        cq_size = VL_range(rand_gen, 1, device_attr.max_cqe);
-       cq = ibv_create_cq(ib_cont, cq_size, (void *)&count, NULL, 0);
+       cq = ibv_create_cq(ib_cont, cq_size, (void *)&count, channel, 0);
        CHECK_PTR("ibv_create_cq", cq, goto cleanup);
 
        mr_size = VL_range(rand_gen, 1, 1024);
@@ -211,6 +215,7 @@ int cq_2(
        CHECK_MALLOC(event_count, goto cleanup);
 
        *event_count = 0;
+       rc = ibv_get_cq_event(channel, (void *)&event_cq, (void *)&event_count);
        rc = ibv_get_cq_event(NULL, (void *)&event_cq, (void *)&event_count);
        CHECK_VALUE("ibv_get_cq_event", rc, 0, goto cleanup);
 
Index: test_hca.c
===================================================================
--- test_hca.c  (revision 3639)
+++ test_hca.c  (working copy)
@@ -230,7 +230,7 @@ int hca_5(
                j = port_attr.gid_tbl_len + VL_random(rand_gen, 0xFFFFFFFF - 
port_attr.gid_tbl_len);
        
                rc = ibv_query_gid(ib_cont, i, j, &gid);
-               CHECK_VALUE("ibv_query_gid", rc, 0, goto cleanup);
+               CHECK_VALUE("ibv_query_gid", rc, -1, goto cleanup);
        }
        PASSED;
 
@@ -239,7 +239,7 @@ int hca_5(
        i = VL_range(rand_gen, device_attr.phys_port_cnt + 1, 0xFF);
        
        rc = ibv_query_gid(ib_cont, i, j, &gid);
-       CHECK_VALUE("ibv_query_gid", rc, 0, goto cleanup);
+       CHECK_VALUE("ibv_query_gid", rc, -1, goto cleanup);
        PASSED;
 
        test_result = 0;
_______________________________________________
openib-general mailing list
[email protected]
http://openib.org/mailman/listinfo/openib-general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to