VPP-1335 vapi crash when memclnt_keepalive received
[vpp.git] / test / ext / vapi_c_test.c
index 622b617..2e5b9e6 100644 (file)
@@ -40,6 +40,16 @@ static char *api_prefix = NULL;
 static const int max_outstanding_requests = 64;
 static const int response_queue_size = 32;
 
+/* centos has ancient check so we hack our way around here
+ * to make it work somehow */
+#ifndef ck_assert_ptr_eq
+#define ck_assert_ptr_eq(X,Y) ck_assert_int_eq((long)X, (long)Y)
+#endif
+
+#ifndef ck_assert_ptr_ne
+#define ck_assert_ptr_ne(X,Y) ck_assert_int_ne((long)X, (long)Y)
+#endif
+
 START_TEST (test_invalid_values)
 {
   vapi_ctx_t ctx;
@@ -50,18 +60,18 @@ START_TEST (test_invalid_values)
   rv = vapi_send (ctx, sv);
   ck_assert_int_eq (VAPI_EINVAL, rv);
   rv = vapi_connect (ctx, app_name, api_prefix, max_outstanding_requests,
-                    response_queue_size, VAPI_MODE_BLOCKING);
+                    response_queue_size, VAPI_MODE_BLOCKING, true);
   ck_assert_int_eq (VAPI_OK, rv);
   rv = vapi_send (ctx, NULL);
   ck_assert_int_eq (VAPI_EINVAL, rv);
   rv = vapi_send (NULL, NULL);
   ck_assert_int_eq (VAPI_EINVAL, rv);
-  rv = vapi_recv (NULL, NULL, NULL);
+  rv = vapi_recv (NULL, NULL, NULL, 0, 0);
   ck_assert_int_eq (VAPI_EINVAL, rv);
-  rv = vapi_recv (ctx, NULL, NULL);
+  rv = vapi_recv (ctx, NULL, NULL, 0, 0);
   ck_assert_int_eq (VAPI_EINVAL, rv);
   vapi_msg_show_version_reply *reply;
-  rv = vapi_recv (ctx, (void **) &reply, NULL);
+  rv = vapi_recv (ctx, (void **) &reply, NULL, 0, 0);
   ck_assert_int_eq (VAPI_EINVAL, rv);
   rv = vapi_disconnect (ctx);
   ck_assert_int_eq (VAPI_OK, rv);
@@ -473,7 +483,7 @@ START_TEST (test_connect)
   vapi_error_e rv = vapi_ctx_alloc (&ctx);
   ck_assert_int_eq (VAPI_OK, rv);
   rv = vapi_connect (ctx, app_name, api_prefix, max_outstanding_requests,
-                    response_queue_size, VAPI_MODE_BLOCKING);
+                    response_queue_size, VAPI_MODE_BLOCKING, true);
   ck_assert_int_eq (VAPI_OK, rv);
   rv = vapi_disconnect (ctx);
   ck_assert_int_eq (VAPI_OK, rv);
@@ -490,7 +500,7 @@ setup_blocking (void)
   vapi_error_e rv = vapi_ctx_alloc (&ctx);
   ck_assert_int_eq (VAPI_OK, rv);
   rv = vapi_connect (ctx, app_name, api_prefix, max_outstanding_requests,
-                    response_queue_size, VAPI_MODE_BLOCKING);
+                    response_queue_size, VAPI_MODE_BLOCKING, true);
   ck_assert_int_eq (VAPI_OK, rv);
 }
 
@@ -500,7 +510,7 @@ setup_nonblocking (void)
   vapi_error_e rv = vapi_ctx_alloc (&ctx);
   ck_assert_int_eq (VAPI_OK, rv);
   rv = vapi_connect (ctx, app_name, api_prefix, max_outstanding_requests,
-                    response_queue_size, VAPI_MODE_NONBLOCKING);
+                    response_queue_size, VAPI_MODE_NONBLOCKING, true);
   ck_assert_int_eq (VAPI_OK, rv);
 }
 
@@ -521,7 +531,7 @@ START_TEST (test_show_version_1)
   ck_assert_int_eq (VAPI_OK, rv);
   vapi_msg_show_version_reply *resp;
   size_t size;
-  rv = vapi_recv (ctx, (void *) &resp, &size);
+  rv = vapi_recv (ctx, (void *) &resp, &size, 0, 0);
   ck_assert_int_eq (VAPI_OK, rv);
   int dummy;
   show_version_cb (NULL, &dummy, VAPI_OK, true, &resp->payload);
@@ -571,7 +581,7 @@ sw_interface_dump_cb (struct vapi_ctx_s *ctx, void *callback_ctx,
     }
   else
     {
-      ck_assert (reply);
+      ck_assert (NULL != reply);
       printf ("Interface dump entry: [%u]: %s\n", reply->sw_if_index,
              reply->interface_name);
       size_t i = 0;