aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOle Troan <ot@cisco.com>2017-12-06 17:00:05 +0100
committerOle Troan <ot@cisco.com>2017-12-06 17:49:48 +0100
commit3288ed7234ad9b6d59d249f48dd1a2d06168bfd5 (patch)
tree96d5200d8c7a0630ce127ff7387c2292342acc26 /src
parentbf4be5730557c4280f2f9f8b7ef1a194716c82bd (diff)
UT: Repaired broken C unit tests (--enable-tests)
Change-Id: I63d720378b92813993525f80fee90fc79df27fba Signed-off-by: Ole Troan <ot@cisco.com>
Diffstat (limited to 'src')
-rw-r--r--src/vnet/ip/ip_api.c15
-rw-r--r--src/vpp/api/test_client.c10
-rw-r--r--src/vpp/stats/stats.c4
-rw-r--r--src/vpp/stats/stats.h3
-rw-r--r--src/vppinfra/test_heap.c2
-rw-r--r--src/vppinfra/test_mheap.c2
6 files changed, 14 insertions, 22 deletions
diff --git a/src/vnet/ip/ip_api.c b/src/vnet/ip/ip_api.c
index 7aec411e2a2..fefaccf3fd4 100644
--- a/src/vnet/ip/ip_api.c
+++ b/src/vnet/ip/ip_api.c
@@ -2600,13 +2600,12 @@ vl_api_proxy_arp_add_del_t_handler (vl_api_proxy_arp_add_del_t * mp)
u32 fib_index;
int rv;
ip4_main_t *im = &ip4_main;
- stats_main_t *sm = &stats_main;
int vnet_proxy_arp_add_del (ip4_address_t * lo_addr,
ip4_address_t * hi_addr,
u32 fib_index, int is_del);
uword *p;
- dslock (sm, 1 /* release hint */ , 6 /* tag */ );
+ stats_dslock_with_hint (1 /* release hint */ , 6 /* tag */ );
p = hash_get (im->fib_index_by_table_id, ntohl (mp->vrf_id));
@@ -2623,7 +2622,7 @@ vl_api_proxy_arp_add_del_t_handler (vl_api_proxy_arp_add_del_t * mp)
fib_index, mp->is_add == 0);
out:
- dsunlock (sm);
+ stats_dsunlock ();
REPLY_MACRO (VL_API_PROXY_ARP_ADD_DEL_REPLY);
}
@@ -2659,7 +2658,6 @@ ip4_reset_fib_t_handler (vl_api_reset_fib_t * mp)
vnet_interface_main_t *im = &vnm->interface_main;
ip4_main_t *im4 = &ip4_main;
static u32 *sw_if_indices_to_shut;
- stats_main_t *sm = &stats_main;
fib_table_t *fib_table;
ip4_fib_t *fib;
u32 sw_if_index;
@@ -2667,7 +2665,7 @@ ip4_reset_fib_t_handler (vl_api_reset_fib_t * mp)
int rv = VNET_API_ERROR_NO_SUCH_FIB;
u32 target_fib_id = ntohl (mp->vrf_id);
- dslock (sm, 1 /* release hint */ , 8 /* tag */ );
+ stats_dslock_with_hint (1 /* release hint */ , 8 /* tag */ );
/* *INDENT-OFF* */
pool_foreach (fib_table, im4->fibs,
@@ -2716,7 +2714,7 @@ ip4_reset_fib_t_handler (vl_api_reset_fib_t * mp)
})); /* pool_foreach (fib) */
/* *INDENT-ON* */
- dsunlock (sm);
+ stats_dsunlock ();
return rv;
}
@@ -2726,7 +2724,6 @@ ip6_reset_fib_t_handler (vl_api_reset_fib_t * mp)
vnet_main_t *vnm = vnet_get_main ();
vnet_interface_main_t *im = &vnm->interface_main;
ip6_main_t *im6 = &ip6_main;
- stats_main_t *sm = &stats_main;
static u32 *sw_if_indices_to_shut;
fib_table_t *fib_table;
ip6_fib_t *fib;
@@ -2735,7 +2732,7 @@ ip6_reset_fib_t_handler (vl_api_reset_fib_t * mp)
int rv = VNET_API_ERROR_NO_SUCH_FIB;
u32 target_fib_id = ntohl (mp->vrf_id);
- dslock (sm, 1 /* release hint */ , 9 /* tag */ );
+ stats_dslock_with_hint (1 /* release hint */ , 9 /* tag */ );
/* *INDENT-OFF* */
pool_foreach (fib_table, im6->fibs,
@@ -2775,7 +2772,7 @@ ip6_reset_fib_t_handler (vl_api_reset_fib_t * mp)
})); /* pool_foreach (fib) */
/* *INDENT-ON* */
- dsunlock (sm);
+ stats_dsunlock ();
return rv;
}
diff --git a/src/vpp/api/test_client.c b/src/vpp/api/test_client.c
index 844b9702096..52833eb6f86 100644
--- a/src/vpp/api/test_client.c
+++ b/src/vpp/api/test_client.c
@@ -161,10 +161,8 @@ vl_api_sw_interface_details_t_handler (vl_api_sw_interface_details_t * mp)
static void
vl_api_sw_interface_set_flags_t_handler (vl_api_sw_interface_set_flags_t * mp)
{
- fformat (stdout, "set flags: sw_if_index %d, admin %s link %s\n",
- ntohl (mp->sw_if_index),
- mp->admin_up_down ? "up" : "down",
- mp->link_up_down ? "up" : "down");
+ fformat (stdout, "set flags: sw_if_index %d, admin %s\n",
+ ntohl (mp->sw_if_index), mp->admin_up_down ? "up" : "down");
}
static void
@@ -1007,7 +1005,7 @@ dhcpv6_set_vss (test_main_t * tm)
mp->client_index = tm->my_client_index;
mp->context = 0xdeadbeef;
mp->oui = ntohl (6);
- mp->fib_id = ntohl (60);
+ mp->tbl_id = ntohl (60);
mp->is_add = 1;
mp->is_ipv6 = 1;
vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
@@ -1024,7 +1022,7 @@ dhcpv4_set_vss (test_main_t * tm)
mp->client_index = tm->my_client_index;
mp->context = 0xdeadbeef;
mp->oui = ntohl (4);
- mp->fib_id = ntohl (40);
+ mp->tbl_id = ntohl (40);
mp->is_add = 1;
mp->is_ipv6 = 0;
vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
diff --git a/src/vpp/stats/stats.c b/src/vpp/stats/stats.c
index ac364e88efd..6c6809e3b60 100644
--- a/src/vpp/stats/stats.c
+++ b/src/vpp/stats/stats.c
@@ -189,7 +189,7 @@ format_vnet_interface_simple_counters (u8 * s, va_list * args)
return s;
}
-void
+static void
dslock (stats_main_t * sm, int release_hint, int tag)
{
u32 thread_index;
@@ -222,7 +222,7 @@ stats_dslock_with_hint (int hint, int tag)
dslock (sm, hint, tag);
}
-void
+static void
dsunlock (stats_main_t * sm)
{
u32 thread_index;
diff --git a/src/vpp/stats/stats.h b/src/vpp/stats/stats.h
index 452e3052a10..4343da3b040 100644
--- a/src/vpp/stats/stats.h
+++ b/src/vpp/stats/stats.h
@@ -186,9 +186,6 @@ typedef struct
extern stats_main_t stats_main;
-void dslock (stats_main_t * sm, int release_hint, int tag);
-void dsunlock (stats_main_t * sm);
-
#endif /* __included_stats_h__ */
/*
diff --git a/src/vppinfra/test_heap.c b/src/vppinfra/test_heap.c
index 3d5171bf053..95e64b728be 100644
--- a/src/vppinfra/test_heap.c
+++ b/src/vppinfra/test_heap.c
@@ -86,7 +86,7 @@ main (int argc, char *argv[])
fformat (stderr, "%U\n", format_clib_mem_usage, /* verbose */ 0);
vec_resize (objects, 1000);
- if (vec_bytes (objects)) /* stupid warning be gone */
+ if (vec_bytes (objects) > 0) /* stupid warning be gone */
memset (objects, ~0, vec_bytes (objects));
vec_resize (handles, vec_len (objects));
diff --git a/src/vppinfra/test_mheap.c b/src/vppinfra/test_mheap.c
index 6bc36b89ac3..b48e5273651 100644
--- a/src/vppinfra/test_mheap.c
+++ b/src/vppinfra/test_mheap.c
@@ -110,7 +110,7 @@ test_mheap_main (unformat_input_t * input)
max_object_size, seed);
vec_resize (objects, n_objects);
- if (vec_bytes (objects)) /* stupid warning be gone */
+ if (vec_bytes (objects) > 0) /* stupid warning be gone */
memset (objects, ~0, vec_bytes (objects));
objects_used = 0;