vppinfra: fix tests 37/32237/2
authorDamjan Marion <damarion@cisco.com>
Thu, 6 May 2021 15:28:12 +0000 (17:28 +0200)
committerFlorin Coras <florin.coras@gmail.com>
Thu, 6 May 2021 16:29:00 +0000 (16:29 +0000)
Type: fix
Change-Id: If59a66aae658dd35dbcb4987ab00c306b3c6e2e2
Signed-off-by: Damjan Marion <damarion@cisco.com>
17 files changed:
src/vppinfra/bihash_template.c
src/vppinfra/elf.c
src/vppinfra/elog.c
src/vppinfra/hash.c
src/vppinfra/heap.c
src/vppinfra/macros.c
src/vppinfra/maplog.c
src/vppinfra/mem_dlmalloc.c
src/vppinfra/pmalloc.c
src/vppinfra/random.c
src/vppinfra/random_isaac.c
src/vppinfra/serialize.c
src/vppinfra/test_hash.c
src/vppinfra/test_macros.c
src/vppinfra/test_vec.c
src/vppinfra/unix-misc.c
src/vppinfra/valloc.c

index 0c6aa2a..ddaccbd 100644 (file)
 #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;
index c492b3b..11fac45 100644 (file)
@@ -65,9 +65,9 @@ elf_get_section_by_start_address_no_check (elf_main_t * em,
   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 @@ elf_segment_va_compare (void *a1, void *a2)
          (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 @@ elf_parse_symbols (elf_main_t * em)
   }
 }
 
-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 @@ layout_sections (elf_main_t * em)
   }
 }
 
-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;
index 423d8d5..8ae752e 100644 (file)
@@ -395,8 +395,8 @@ format_elog_event (u8 * s, va_list * va)
   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 @@ elog_cmp (void *a1, void *a2)
 /*
  * 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 @@ serialize_elog_main (serialize_main_t * m, va_list * va)
   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;
index da37b6e..fc6c451 100644 (file)
@@ -653,8 +653,8 @@ _hash_get_pair (void *v, uword key)
   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 @@ hash_bytes (void *v)
   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 @@ unformat_hash_string (unformat_input_t * input, va_list * va)
   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);
index b81e1e1..bc22da1 100644 (file)
@@ -597,7 +597,7 @@ combine_free_blocks (void *v, heap_elt_t * e0, heap_elt_t * e1)
   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 @@ debug_elt (u8 * s, void *v, word i, word n)
   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 @@ format_heap (u8 * s, va_list * va)
   return s;
 }
 
-void
+__clib_export void
 heap_validate (void *v)
 {
   heap_header_t *h = heap_header (v);
index f34b7af..b8a8e17 100644 (file)
@@ -197,8 +197,8 @@ clib_macro_eval (clib_macro_main_t * mm, i8 * s, i32 complain, u16 level,
  * 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;
index 6891336..4e59631 100644 (file)
@@ -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 @@ fail:
 
 /* 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 @@ out:
  *
  * @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 @@ clib_maplog_close (clib_maplog_main_t * mm)
  * @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 @@ brief:
  * @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;
index f8d4ca1..e2a0f71 100644 (file)
@@ -297,8 +297,8 @@ clib_mem_destroy (void)
   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 (),
index e5fdc26..a0b1d1f 100644 (file)
@@ -483,8 +483,8 @@ clib_pmalloc_alloc_aligned (clib_pmalloc_main_t * pm, uword size, uword align)
                                    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);
index f16f396..56362a8 100644 (file)
@@ -61,8 +61,8 @@ u32 standalone_random_default_seed = 1;
  * @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;
index 6f00fc3..ad7a272 100644 (file)
@@ -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 @@ do {                                                                \
    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 @@ isaac_init (isaac_t * ctx, uword * seeds)
   *(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 @@ do {                                                                \
    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;
index 89a0e36..6450925 100644 (file)
@@ -930,9 +930,9 @@ serialize_close_vector (serialize_main_t * m)
   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 @@ serialize_multiple_1 (serialize_main_t * m,
     }
 }
 
-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 @@ serialize_multiple_2 (serialize_main_t * m,
     }
 }
 
-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 @@ serialize_multiple_4 (serialize_main_t * m,
     }
 }
 
-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 @@ unserialize_multiple_1 (serialize_main_t * m,
     }
 }
 
-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 @@ unserialize_multiple_2 (serialize_main_t * m,
     }
 }
 
-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;
index 7f047d9..95ced44 100644 (file)
@@ -184,8 +184,6 @@ test_word_key (hash_test_t * ht)
          /* *INDENT-ON* */
       }
 
-      clib_mem_validate ();
-
       if ((error = hash_validate (h)))
        goto done;
 
@@ -222,8 +220,6 @@ test_word_key (hash_test_t * ht)
          || (i + 1) % ht->n_iterations_per_validate)
        continue;
 
-      clib_mem_validate ();
-
       if ((error = hash_validate (h)))
        goto done;
 
@@ -317,8 +313,6 @@ test_string_key (hash_test_t * ht)
          || (i + 1) % ht->n_iterations_per_validate)
        continue;
 
-      clib_mem_validate ();
-
       if ((error = hash_validate (h)))
        goto done;
 
@@ -355,8 +349,6 @@ test_string_key (hash_test_t * ht)
          || (i + 1) % ht->n_iterations_per_validate)
        continue;
 
-      clib_mem_validate ();
-
       if ((error = hash_validate (h)))
        goto done;
 
index ad3ea37..9c88507 100644 (file)
@@ -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;
 
index bc878ee..c6f97fb 100644 (file)
@@ -1149,10 +1149,6 @@ test_vec_main (unformat_input_t * input)
     dump_call_stats (g_call_stats);
   prob_free ();
 
-  if (verbose)
-    {
-      memory_snap ();
-    }
   return 0;
 
 usage:
index 7c276b0..5559a23 100644 (file)
@@ -171,7 +171,7 @@ unix_proc_file_contents (char *file, u8 ** result)
 
 void os_panic (void) __attribute__ ((weak));
 
-void
+__clib_export void
 os_panic (void)
 {
   abort ();
index 5e17a59..2f9e8d2 100644 (file)
@@ -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 @@ clib_valloc_free (clib_valloc_main_t * vam, uword baseva)
     @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);