}
}
done:
- test_mem_free (buf);
return err;
}
for (int i = 0; i < n; i++)
res[i] = clib_ip_csum (data + i * 20, 20);
test_perf_event_disable (tp);
-
- test_mem_free (data);
- test_mem_free (res);
}
void __test_perf_fn
for (int i = 0; i < n; i++)
res[i] = clib_ip_csum (data + i * lenp[0], lenp[0]);
test_perf_event_disable (tp);
-
- test_mem_free (data);
- test_mem_free (res);
}
void __test_perf_fn
test_perf_event_enable (tp);
res[0] = clib_ip_csum (data, np[0]);
test_perf_event_disable (tp);
-
- test_mem_free (data);
- test_mem_free (res);
}
REGISTER_TEST (clib_ip_csum) = {
test_perf_event_enable (tp); \
clib_hmac_sha##bits (key, *kl, data, *np, digest); \
test_perf_event_disable (tp); \
- \
- test_mem_free (key); \
- test_mem_free (data); \
- test_mem_free (digest); \
} \
REGISTER_TEST (clib_hmac_sha##bits) = { \
.name = "clib_hmac_sha" #bits, \
goto next;
err = (r->fn) (0);
fformat (stdout, "%-50s %s\n", r->name, err ? "FAIL" : "PASS");
+ for (int i = 0; i < vec_len (tm->allocated_mem); i++)
+ clib_mem_free (tm->allocated_mem[i]);
+ vec_free (tm->allocated_mem);
if (err)
{
clib_error_report (err);
clib_perfmon_reset (ctx);
pt->fn (pt);
clib_perfmon_capture (ctx, pt->n_ops, "%0s", pt->name);
+ for (int i = 0; i < vec_len (tm->allocated_mem); i++)
+ clib_mem_free (tm->allocated_mem[i]);
+ vec_free (tm->allocated_mem);
}
}
while ((++pt)->fn);
size = round_pow2 (size, CLIB_CACHE_LINE_BYTES);
rv = clib_mem_alloc_aligned (size, CLIB_CACHE_LINE_BYTES);
clib_memset_u8 (rv, 0, size);
+ vec_add1 (test_main.allocated_mem, rv);
return rv;
}
rv = clib_mem_alloc_aligned (size, CLIB_CACHE_LINE_BYTES);
for (uword i = 0; i < size; i++)
rv[i] = ((u8) i + start) & mask;
+ vec_add1 (test_main.allocated_mem, rv);
return rv;
}
if (data_size < alloc_size)
clib_memset_u8 (e, 0, alloc_size - data_size);
+ vec_add1 (test_main.allocated_mem, rv);
return rv;
}
-void
-test_mem_free (void *p)
-{
- clib_mem_free (p);
-}
u8 *filter;
u8 *bundle;
f64 ref_clock;
+ void **allocated_mem;
} test_main_t;
extern test_main_t test_main;
void *test_mem_alloc (uword size);
void *test_mem_alloc_and_fill_inc_u8 (uword size, u8 start, u8 mask);
void *test_mem_alloc_and_splat (uword elt_size, uword n_elts, void *elt);
-void test_mem_free (void *p);
#endif
done:
clib_toeplitz_hash_key_free (k);
- test_mem_free (bigkey);
- test_mem_free (bigdata);
return err;
}
test_perf_event_disable (tp);
clib_toeplitz_hash_key_free (k);
- test_mem_free (data);
- test_mem_free (res);
}
void __test_perf_fn
test_perf_event_disable (tp);
clib_toeplitz_hash_key_free (k);
- test_mem_free (data);
- test_mem_free (res);
}
void __test_perf_fn
test_perf_event_disable (tp);
clib_toeplitz_hash_key_free (k);
- test_mem_free (data);
- test_mem_free (res);
- test_mem_free (key);
}
REGISTER_TEST (clib_toeplitz_hash) = {
done:
clib_toeplitz_hash_key_free (k);
- test_mem_free (bigkey);
- test_mem_free (bigdata0);
- test_mem_free (bigdata1);
- test_mem_free (bigdata2);
- test_mem_free (bigdata3);
return err;
}
test_perf_event_disable (tp);
clib_toeplitz_hash_key_free (k);
- test_mem_free (d0);
- test_mem_free (d1);
- test_mem_free (d2);
- test_mem_free (d3);
- test_mem_free (h0);
- test_mem_free (h1);
- test_mem_free (h2);
- test_mem_free (h3);
}
void __test_perf_fn
test_perf_event_disable (tp);
clib_toeplitz_hash_key_free (k);
- test_mem_free (d0);
- test_mem_free (d1);
- test_mem_free (d2);
- test_mem_free (d3);
- test_mem_free (h0);
- test_mem_free (h1);
- test_mem_free (h2);
- test_mem_free (h3);
}
void __test_perf_fn
test_perf_event_disable (tp);
clib_toeplitz_hash_key_free (k);
- test_mem_free (key);
- test_mem_free (d0);
- test_mem_free (d1);
- test_mem_free (d2);
- test_mem_free (d3);
- test_mem_free (h0);
- test_mem_free (h1);
- test_mem_free (h2);
- test_mem_free (h3);
}
REGISTER_TEST (clib_toeplitz_hash_x4) = {