vppinfra: fix tests

Type: fix
Change-Id: If59a66aae658dd35dbcb4987ab00c306b3c6e2e2
Signed-off-by: Damjan Marion <damarion@cisco.com>
diff --git a/src/vppinfra/bihash_template.c b/src/vppinfra/bihash_template.c
index 0c6aa2a..ddaccbd 100644
--- a/src/vppinfra/bihash_template.c
+++ b/src/vppinfra/bihash_template.c
@@ -23,6 +23,10 @@
 #define BIIHASH_MIN_ALLOC_LOG2_PAGES 10
 #endif
 
+#ifndef BIHASH_USE_HEAP
+#define BIHASH_USE_HEAP 1
+#endif
+
 static inline void *BV (alloc_aligned) (BVT (clib_bihash) * h, uword nbytes)
 {
   uword rv;
diff --git a/src/vppinfra/elf.c b/src/vppinfra/elf.c
index c492b3b..11fac45 100644
--- a/src/vppinfra/elf.c
+++ b/src/vppinfra/elf.c
@@ -65,9 +65,9 @@
   return p ? vec_elt_at_index (em->sections, p[0]) : 0;
 }
 
-clib_error_t *
-elf_get_section_by_start_address (elf_main_t * em, uword start_address,
-				  elf_section_t ** result)
+__clib_export clib_error_t *
+elf_get_section_by_start_address (elf_main_t *em, uword start_address,
+				  elf_section_t **result)
 {
   elf_section_t *s =
     elf_get_section_by_start_address_no_check (em, start_address);
@@ -541,8 +541,8 @@
 	  (i64) s2->header.virtual_address);
 }
 
-u8 *
-format_elf_main (u8 * s, va_list * args)
+__clib_export u8 *
+format_elf_main (u8 *s, va_list *args)
 {
   elf_main_t *em = va_arg (*args, elf_main_t *);
   u32 verbose = va_arg (*args, u32);
@@ -895,8 +895,8 @@
   }
 }
 
-void
-elf_set_dynamic_entries (elf_main_t * em)
+__clib_export void
+elf_set_dynamic_entries (elf_main_t *em)
 {
   uword i;
 
@@ -1750,8 +1750,8 @@
   }
 }
 
-clib_error_t *
-elf_write_file (elf_main_t * em, char *file_name)
+__clib_export clib_error_t *
+elf_write_file (elf_main_t *em, char *file_name)
 {
   int fd;
   FILE *f;
diff --git a/src/vppinfra/elog.c b/src/vppinfra/elog.c
index 423d8d5..8ae752e 100644
--- a/src/vppinfra/elog.c
+++ b/src/vppinfra/elog.c
@@ -395,8 +395,8 @@
   return s;
 }
 
-u8 *
-format_elog_track_name (u8 * s, va_list * va)
+__clib_export u8 *
+format_elog_track_name (u8 *s, va_list *va)
 {
   elog_main_t *em = va_arg (*va, elog_main_t *);
   elog_event_t *e = va_arg (*va, elog_event_t *);
@@ -695,8 +695,8 @@
 /*
  * merge two event logs. Complicated and cranky.
  */
-void
-elog_merge (elog_main_t * dst, u8 * dst_tag, elog_main_t * src, u8 * src_tag,
+__clib_export void
+elog_merge (elog_main_t *dst, u8 *dst_tag, elog_main_t *src, u8 *src_tag,
 	    f64 align_tweak)
 {
   elog_event_t *e;
@@ -1143,8 +1143,8 @@
   vec_foreach (e, em->events) serialize (m, serialize_elog_event, em, e);
 }
 
-void
-unserialize_elog_main (serialize_main_t * m, va_list * va)
+__clib_export void
+unserialize_elog_main (serialize_main_t *m, va_list *va)
 {
   elog_main_t *em = va_arg (*va, elog_main_t *);
   uword i;
diff --git a/src/vppinfra/hash.c b/src/vppinfra/hash.c
index da37b6e..fc6c451 100644
--- a/src/vppinfra/hash.c
+++ b/src/vppinfra/hash.c
@@ -653,8 +653,8 @@
   return lookup (v, key, GET, 0, 0);
 }
 
-hash_pair_t *
-hash_next (void *v, hash_next_t * hn)
+__clib_export hash_pair_t *
+hash_next (void *v, hash_next_t *hn)
 {
   hash_t *h = hash_header (v);
   hash_pair_t *p;
@@ -1015,8 +1015,8 @@
   return bytes;
 }
 
-u8 *
-format_hash (u8 * s, va_list * va)
+__clib_export u8 *
+format_hash (u8 *s, va_list *va)
 {
   void *v = va_arg (*va, void *);
   int verbose = va_arg (*va, int);
@@ -1110,7 +1110,7 @@
   return unformat_hash_string_internal (input, va, /* is_vec */ 0);
 }
 
-clib_error_t *
+__clib_export clib_error_t *
 hash_validate (void *v)
 {
   hash_t *h = hash_header (v);
diff --git a/src/vppinfra/heap.c b/src/vppinfra/heap.c
index b81e1e1..bc22da1 100644
--- a/src/vppinfra/heap.c
+++ b/src/vppinfra/heap.c
@@ -597,7 +597,7 @@
   set_free_elt (v, elt_at (h, g.index), g.bin_index);
 }
 
-uword
+__clib_export uword
 heap_len (void *v, word handle)
 {
   heap_header_t *h = heap_header (v);
@@ -694,8 +694,8 @@
   return s;
 }
 
-u8 *
-format_heap (u8 * s, va_list * va)
+__clib_export u8 *
+format_heap (u8 *s, va_list *va)
 {
   void *v = va_arg (*va, void *);
   uword verbose = va_arg (*va, uword);
@@ -722,7 +722,7 @@
   return s;
 }
 
-void
+__clib_export void
 heap_validate (void *v)
 {
   heap_header_t *h = heap_header (v);
diff --git a/src/vppinfra/macros.c b/src/vppinfra/macros.c
index f34b7af..b8a8e17 100644
--- a/src/vppinfra/macros.c
+++ b/src/vppinfra/macros.c
@@ -197,8 +197,8 @@
  * eval: takes a string, returns a vector.
  * looks up $foobar in the variable table.
  */
-i8 *
-clib_macro_eval_dollar (clib_macro_main_t * mm, i8 * s, i32 complain)
+__clib_export i8 *
+clib_macro_eval_dollar (clib_macro_main_t *mm, i8 *s, i32 complain)
 {
   i8 *s2;
   i8 *rv;
diff --git a/src/vppinfra/maplog.c b/src/vppinfra/maplog.c
index 6891336..4e59631 100644
--- a/src/vppinfra/maplog.c
+++ b/src/vppinfra/maplog.c
@@ -24,8 +24,8 @@
  * @param[in/out] a   init args structure
  * @return    0 => success, <0 => failure
  */
-int
-clib_maplog_init (clib_maplog_init_args_t * a)
+__clib_export int
+clib_maplog_init (clib_maplog_init_args_t *a)
 {
   int i, fd, limit;
   int rv = 0;
@@ -171,8 +171,8 @@
 
 /* slow path: unmap a full log segment, and replace it */
 
-u8 *
-_clib_maplog_get_entry_slowpath (clib_maplog_main_t * mm, u64 my_record_index)
+__clib_export u8 *
+_clib_maplog_get_entry_slowpath (clib_maplog_main_t *mm, u64 my_record_index)
 {
   int fd;
   u8 *rv;
@@ -295,8 +295,8 @@
  *
  * @param[in/out] mm	mapped log object
  */
-void
-clib_maplog_close (clib_maplog_main_t * mm)
+__clib_export void
+clib_maplog_close (clib_maplog_main_t *mm)
 {
   int i, limit;
   u64 file_size_in_bytes;
@@ -331,8 +331,8 @@
  * @param [in] h clib_maplog_header_t pointer
  * @param [in] verbose self-explanatory
  */
-u8 *
-format_maplog_header (u8 * s, va_list * args)
+__clib_export u8 *
+format_maplog_header (u8 *s, va_list *args)
 {
   clib_maplog_header_t *h = va_arg (*args, clib_maplog_header_t *);
   int verbose = va_arg (*args, int);
@@ -380,7 +380,7 @@
  * @param [in] file_basename Same basename supplied to clib_maplog_init
  * @param [in] fp_arg Callback function pointer
  */
-int
+__clib_export int
 clib_maplog_process (char *file_basename, void *fp_arg)
 {
   clib_maplog_header_t _h, *h = &_h;
diff --git a/src/vppinfra/mem_dlmalloc.c b/src/vppinfra/mem_dlmalloc.c
index f8d4ca1..e2a0f71 100644
--- a/src/vppinfra/mem_dlmalloc.c
+++ b/src/vppinfra/mem_dlmalloc.c
@@ -297,8 +297,8 @@
   clib_mem_vm_unmap (base);
 }
 
-u8 *
-format_clib_mem_usage (u8 * s, va_list * va)
+__clib_export u8 *
+format_clib_mem_usage (u8 *s, va_list *va)
 {
   int verbose = va_arg (*va, int);
   return format (s, "$$$$ heap at %llx verbose %d", clib_mem_get_heap (),
diff --git a/src/vppinfra/pmalloc.c b/src/vppinfra/pmalloc.c
index e5fdc26..a0b1d1f 100644
--- a/src/vppinfra/pmalloc.c
+++ b/src/vppinfra/pmalloc.c
@@ -483,8 +483,8 @@
 				    CLIB_PMALLOC_NUMA_LOCAL);
 }
 
-void *
-clib_pmalloc_alloc_from_arena (clib_pmalloc_main_t * pm, void *arena_va,
+__clib_export void *
+clib_pmalloc_alloc_from_arena (clib_pmalloc_main_t *pm, void *arena_va,
 			       uword size, uword align)
 {
   clib_pmalloc_arena_t *a = clib_pmalloc_get_arena (pm, arena_va);
diff --git a/src/vppinfra/random.c b/src/vppinfra/random.c
index f16f396..56362a8 100644
--- a/src/vppinfra/random.c
+++ b/src/vppinfra/random.c
@@ -61,8 +61,8 @@
  * @return    d - Pearson's X2 test statistic
  */
 
-f64
-clib_chisquare (u64 * values)
+__clib_export f64
+clib_chisquare (u64 *values)
 {
   u32 i, len;
   f64 d, delta_d, actual_frequency, expected_frequency;
diff --git a/src/vppinfra/random_isaac.c b/src/vppinfra/random_isaac.c
index 6f00fc3..ad7a272 100644
--- a/src/vppinfra/random_isaac.c
+++ b/src/vppinfra/random_isaac.c
@@ -68,8 +68,8 @@
   *(r++) = b = ind32(mm,y>>ISAAC_LOG2_SIZE) + x;	\
 }
 
-void
-isaac (isaac_t * ctx, uword * results)
+__clib_export void
+isaac (isaac_t *ctx, uword *results)
 {
   u32 a, b, c, x, y, *m, *mm, *m2, *r, *mend;
 
@@ -179,8 +179,8 @@
    h^=a>>9;  c+=h; a+=b;			\
 }
 
-void
-isaac_init (isaac_t * ctx, uword * seeds)
+__clib_export void
+isaac_init (isaac_t *ctx, uword *seeds)
 {
   word i;
   u32 a, b, c, d, e, f, g, h, *m, *r;
@@ -251,8 +251,8 @@
   *(r++) = b = ind64(mm,y>>ISAAC_LOG2_SIZE) + x;	\
 }
 
-void
-isaac (isaac_t * ctx, uword * results)
+__clib_export void
+isaac (isaac_t *ctx, uword *results)
 {
   u64 a, b, c, x, y, *m, *mm, *m2, *r, *mend;
 
@@ -364,8 +364,8 @@
    h-=d; e^=g<<14; g+=h;			\
 }
 
-void
-isaac_init (isaac_t * ctx, uword * seeds)
+__clib_export void
+isaac_init (isaac_t *ctx, uword *seeds)
 {
   word i;
   u64 a, b, c, d, e, f, g, h, *m, *r;
diff --git a/src/vppinfra/serialize.c b/src/vppinfra/serialize.c
index 89a0e36..6450925 100644
--- a/src/vppinfra/serialize.c
+++ b/src/vppinfra/serialize.c
@@ -930,9 +930,9 @@
   return result;
 }
 
-void
-serialize_multiple_1 (serialize_main_t * m,
-		      void *data, uword data_stride, uword n_data)
+__clib_export void
+serialize_multiple_1 (serialize_main_t *m, void *data, uword data_stride,
+		      uword n_data)
 {
   u8 *d = data;
   u8 *p;
@@ -962,9 +962,9 @@
     }
 }
 
-void
-serialize_multiple_2 (serialize_main_t * m,
-		      void *data, uword data_stride, uword n_data)
+__clib_export void
+serialize_multiple_2 (serialize_main_t *m, void *data, uword data_stride,
+		      uword n_data)
 {
   void *d = data;
   u16 *p;
@@ -999,9 +999,9 @@
     }
 }
 
-void
-serialize_multiple_4 (serialize_main_t * m,
-		      void *data, uword data_stride, uword n_data)
+__clib_export void
+serialize_multiple_4 (serialize_main_t *m, void *data, uword data_stride,
+		      uword n_data)
 {
   void *d = data;
   u32 *p;
@@ -1036,9 +1036,9 @@
     }
 }
 
-void
-unserialize_multiple_1 (serialize_main_t * m,
-			void *data, uword data_stride, uword n_data)
+__clib_export void
+unserialize_multiple_1 (serialize_main_t *m, void *data, uword data_stride,
+			uword n_data)
 {
   u8 *d = data;
   u8 *p;
@@ -1068,9 +1068,9 @@
     }
 }
 
-void
-unserialize_multiple_2 (serialize_main_t * m,
-			void *data, uword data_stride, uword n_data)
+__clib_export void
+unserialize_multiple_2 (serialize_main_t *m, void *data, uword data_stride,
+			uword n_data)
 {
   void *d = data;
   u16 *p;
@@ -1105,9 +1105,9 @@
     }
 }
 
-void
-unserialize_multiple_4 (serialize_main_t * m,
-			void *data, uword data_stride, uword n_data)
+__clib_export void
+unserialize_multiple_4 (serialize_main_t *m, void *data, uword data_stride,
+			uword n_data)
 {
   void *d = data;
   u32 *p;
diff --git a/src/vppinfra/test_hash.c b/src/vppinfra/test_hash.c
index 7f047d9..95ced44 100644
--- a/src/vppinfra/test_hash.c
+++ b/src/vppinfra/test_hash.c
@@ -184,8 +184,6 @@
 	  /* *INDENT-ON* */
       }
 
-      clib_mem_validate ();
-
       if ((error = hash_validate (h)))
 	goto done;
 
@@ -222,8 +220,6 @@
 	  || (i + 1) % ht->n_iterations_per_validate)
 	continue;
 
-      clib_mem_validate ();
-
       if ((error = hash_validate (h)))
 	goto done;
 
@@ -317,8 +313,6 @@
 	  || (i + 1) % ht->n_iterations_per_validate)
 	continue;
 
-      clib_mem_validate ();
-
       if ((error = hash_validate (h)))
 	goto done;
 
@@ -355,8 +349,6 @@
 	  || (i + 1) % ht->n_iterations_per_validate)
 	continue;
 
-      clib_mem_validate ();
-
       if ((error = hash_validate (h)))
 	goto done;
 
diff --git a/src/vppinfra/test_macros.c b/src/vppinfra/test_macros.c
index ad3ea37..9c88507 100644
--- a/src/vppinfra/test_macros.c
+++ b/src/vppinfra/test_macros.c
@@ -18,8 +18,8 @@
 
 clib_macro_main_t clib_macro_main;
 
-int
-test_macros_main (unformat_input_t * input)
+__clib_export int
+test_macros_main (unformat_input_t *input)
 {
   clib_macro_main_t *mm = &clib_macro_main;
 
diff --git a/src/vppinfra/test_vec.c b/src/vppinfra/test_vec.c
index bc878ee..c6f97fb 100644
--- a/src/vppinfra/test_vec.c
+++ b/src/vppinfra/test_vec.c
@@ -1149,10 +1149,6 @@
     dump_call_stats (g_call_stats);
   prob_free ();
 
-  if (verbose)
-    {
-      memory_snap ();
-    }
   return 0;
 
 usage:
diff --git a/src/vppinfra/unix-misc.c b/src/vppinfra/unix-misc.c
index 7c276b0..5559a23 100644
--- a/src/vppinfra/unix-misc.c
+++ b/src/vppinfra/unix-misc.c
@@ -171,7 +171,7 @@
 
 void os_panic (void) __attribute__ ((weak));
 
-void
+__clib_export void
 os_panic (void)
 {
   abort ();
diff --git a/src/vppinfra/valloc.c b/src/vppinfra/valloc.c
index 5e17a59..2f9e8d2 100644
--- a/src/vppinfra/valloc.c
+++ b/src/vppinfra/valloc.c
@@ -29,9 +29,8 @@
     chunks, the chunk fusion algorithm won't merge them.
  */
 
-void
-clib_valloc_add_chunk (clib_valloc_main_t * vam,
-		       clib_valloc_chunk_t * template)
+__clib_export void
+clib_valloc_add_chunk (clib_valloc_main_t *vam, clib_valloc_chunk_t *template)
 {
   clib_valloc_chunk_t *ch, *new_ch;
   u32 index;
@@ -309,8 +308,8 @@
     @param verbose - int - verbosity level
     @return u8 vector
 */
-u8 *
-format_valloc (u8 * s, va_list * va)
+__clib_export u8 *
+format_valloc (u8 *s, va_list *va)
 {
   clib_valloc_main_t *vam = va_arg (*va, clib_valloc_main_t *);
   int verbose = va_arg (*va, int);