mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-23 21:23:06 +00:00
Change assert_* to expect_* in tests
```
grep -Irl assert_ test/ | xargs sed -i \
's/witness_assert/witness_do_not_replace/g';
grep -Irl assert_ test/ | xargs sed -i \
's/malloc_mutex_assert_owner/malloc_mutex_do_not_replace_owner/g';
grep -Ir assert_ test/ | grep -o "[_a-zA-Z]*assert_[_a-zA-Z]*" | \
grep -v "^assert_"; # confirm no output
grep -Irl assert_ test/ | xargs sed -i 's/assert_/expect_/g';
grep -Irl witness_do_not_replace test/ | xargs sed -i \
's/witness_do_not_replace/witness_assert/g';
grep -Irl malloc_mutex_do_not_replace_owner test/ | xargs sed -i \
's/malloc_mutex_do_not_replace_owner/malloc_mutex_assert_owner/g';
```
This commit is contained in:
@@ -14,7 +14,7 @@ static unsigned
|
||||
do_arena_create(extent_hooks_t *h) {
|
||||
unsigned arena_ind;
|
||||
size_t sz = sizeof(unsigned);
|
||||
assert_d_eq(mallctl("arenas.create", (void *)&arena_ind, &sz,
|
||||
expect_d_eq(mallctl("arenas.create", (void *)&arena_ind, &sz,
|
||||
(void *)(h != NULL ? &h : NULL), (h != NULL ? sizeof(h) : 0)), 0,
|
||||
"Unexpected mallctl() failure");
|
||||
return arena_ind;
|
||||
@@ -26,17 +26,17 @@ do_arena_destroy(unsigned arena_ind) {
|
||||
size_t miblen;
|
||||
|
||||
miblen = sizeof(mib)/sizeof(size_t);
|
||||
assert_d_eq(mallctlnametomib("arena.0.destroy", mib, &miblen), 0,
|
||||
expect_d_eq(mallctlnametomib("arena.0.destroy", mib, &miblen), 0,
|
||||
"Unexpected mallctlnametomib() failure");
|
||||
mib[1] = (size_t)arena_ind;
|
||||
assert_d_eq(mallctlbymib(mib, miblen, NULL, NULL, NULL, 0), 0,
|
||||
expect_d_eq(mallctlbymib(mib, miblen, NULL, NULL, NULL, 0), 0,
|
||||
"Unexpected mallctlbymib() failure");
|
||||
}
|
||||
|
||||
static void
|
||||
do_refresh(void) {
|
||||
uint64_t epoch = 1;
|
||||
assert_d_eq(mallctl("epoch", NULL, NULL, (void *)&epoch,
|
||||
expect_d_eq(mallctl("epoch", NULL, NULL, (void *)&epoch,
|
||||
sizeof(epoch)), 0, "Unexpected mallctl() failure");
|
||||
}
|
||||
|
||||
@@ -46,11 +46,11 @@ do_get_size_impl(const char *cmd, unsigned arena_ind) {
|
||||
size_t miblen = sizeof(mib) / sizeof(size_t);
|
||||
size_t z = sizeof(size_t);
|
||||
|
||||
assert_d_eq(mallctlnametomib(cmd, mib, &miblen),
|
||||
expect_d_eq(mallctlnametomib(cmd, mib, &miblen),
|
||||
0, "Unexpected mallctlnametomib(\"%s\", ...) failure", cmd);
|
||||
mib[2] = arena_ind;
|
||||
size_t size;
|
||||
assert_d_eq(mallctlbymib(mib, miblen, (void *)&size, &z, NULL, 0),
|
||||
expect_d_eq(mallctlbymib(mib, miblen, (void *)&size, &z, NULL, 0),
|
||||
0, "Unexpected mallctlbymib([\"%s\"], ...) failure", cmd);
|
||||
|
||||
return size;
|
||||
@@ -76,7 +76,7 @@ thd_start(void *arg) {
|
||||
next_epoch) {
|
||||
spin_adaptive(&spinner);
|
||||
}
|
||||
assert_u_eq(cur_epoch, next_epoch, "Unexpected epoch");
|
||||
expect_u_eq(cur_epoch, next_epoch, "Unexpected epoch");
|
||||
|
||||
/*
|
||||
* Allocate. The main thread will reset the arena, so there's
|
||||
@@ -86,7 +86,7 @@ thd_start(void *arg) {
|
||||
void *p = mallocx(sz, MALLOCX_ARENA(arena_ind) |
|
||||
MALLOCX_TCACHE_NONE
|
||||
);
|
||||
assert_ptr_not_null(p,
|
||||
expect_ptr_not_null(p,
|
||||
"Unexpected mallocx() failure\n");
|
||||
}
|
||||
|
||||
@@ -134,9 +134,9 @@ TEST_BEGIN(test_retained) {
|
||||
|
||||
size_t allocated = esz * nthreads * PER_THD_NALLOCS;
|
||||
size_t active = do_get_active(arena_ind);
|
||||
assert_zu_le(allocated, active, "Unexpected active memory");
|
||||
expect_zu_le(allocated, active, "Unexpected active memory");
|
||||
size_t mapped = do_get_mapped(arena_ind);
|
||||
assert_zu_le(active, mapped, "Unexpected mapped memory");
|
||||
expect_zu_le(active, mapped, "Unexpected mapped memory");
|
||||
|
||||
arena_t *arena = arena_get(tsdn_fetch(), arena_ind, false);
|
||||
size_t usable = 0;
|
||||
@@ -150,7 +150,7 @@ TEST_BEGIN(test_retained) {
|
||||
* Only consider size classes that wouldn't be skipped.
|
||||
*/
|
||||
if (psz_usable > 0) {
|
||||
assert_zu_lt(usable, allocated,
|
||||
expect_zu_lt(usable, allocated,
|
||||
"Excessive retained memory "
|
||||
"(%#zx[+%#zx] > %#zx)", usable, psz_usable,
|
||||
allocated);
|
||||
@@ -165,7 +165,7 @@ TEST_BEGIN(test_retained) {
|
||||
* (rather than retaining) during reset.
|
||||
*/
|
||||
do_arena_destroy(arena_ind);
|
||||
assert_u_eq(do_arena_create(NULL), arena_ind,
|
||||
expect_u_eq(do_arena_create(NULL), arena_ind,
|
||||
"Unexpected arena index");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user