mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-24 13:53:11 +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:
@@ -20,7 +20,7 @@ arena_dalloc_junk_small_intercept(void *ptr, const bin_info_t *bin_info) {
|
||||
|
||||
arena_dalloc_junk_small_orig(ptr, bin_info);
|
||||
for (i = 0; i < bin_info->reg_size; i++) {
|
||||
assert_u_eq(((uint8_t *)ptr)[i], JEMALLOC_FREE_JUNK,
|
||||
expect_u_eq(((uint8_t *)ptr)[i], JEMALLOC_FREE_JUNK,
|
||||
"Missing junk fill for byte %zu/%zu of deallocated region",
|
||||
i, bin_info->reg_size);
|
||||
}
|
||||
@@ -35,7 +35,7 @@ large_dalloc_junk_intercept(void *ptr, size_t usize) {
|
||||
|
||||
large_dalloc_junk_orig(ptr, usize);
|
||||
for (i = 0; i < usize; i++) {
|
||||
assert_u_eq(((uint8_t *)ptr)[i], JEMALLOC_FREE_JUNK,
|
||||
expect_u_eq(((uint8_t *)ptr)[i], JEMALLOC_FREE_JUNK,
|
||||
"Missing junk fill for byte %zu/%zu of deallocated region",
|
||||
i, usize);
|
||||
}
|
||||
@@ -68,22 +68,22 @@ test_junk(size_t sz_min, size_t sz_max) {
|
||||
|
||||
sz_prev = 0;
|
||||
s = (uint8_t *)mallocx(sz_min, 0);
|
||||
assert_ptr_not_null((void *)s, "Unexpected mallocx() failure");
|
||||
expect_ptr_not_null((void *)s, "Unexpected mallocx() failure");
|
||||
|
||||
for (sz = sallocx(s, 0); sz <= sz_max;
|
||||
sz_prev = sz, sz = sallocx(s, 0)) {
|
||||
if (sz_prev > 0) {
|
||||
assert_u_eq(s[0], 'a',
|
||||
expect_u_eq(s[0], 'a',
|
||||
"Previously allocated byte %zu/%zu is corrupted",
|
||||
ZU(0), sz_prev);
|
||||
assert_u_eq(s[sz_prev-1], 'a',
|
||||
expect_u_eq(s[sz_prev-1], 'a',
|
||||
"Previously allocated byte %zu/%zu is corrupted",
|
||||
sz_prev-1, sz_prev);
|
||||
}
|
||||
|
||||
for (i = sz_prev; i < sz; i++) {
|
||||
if (opt_junk_alloc) {
|
||||
assert_u_eq(s[i], JEMALLOC_ALLOC_JUNK,
|
||||
expect_u_eq(s[i], JEMALLOC_ALLOC_JUNK,
|
||||
"Newly allocated byte %zu/%zu isn't "
|
||||
"junk-filled", i, sz);
|
||||
}
|
||||
@@ -94,14 +94,14 @@ test_junk(size_t sz_min, size_t sz_max) {
|
||||
uint8_t *t;
|
||||
watch_junking(s);
|
||||
t = (uint8_t *)rallocx(s, sz+1, 0);
|
||||
assert_ptr_not_null((void *)t,
|
||||
expect_ptr_not_null((void *)t,
|
||||
"Unexpected rallocx() failure");
|
||||
assert_zu_ge(sallocx(t, 0), sz+1,
|
||||
expect_zu_ge(sallocx(t, 0), sz+1,
|
||||
"Unexpectedly small rallocx() result");
|
||||
if (!background_thread_enabled()) {
|
||||
assert_ptr_ne(s, t,
|
||||
expect_ptr_ne(s, t,
|
||||
"Unexpected in-place rallocx()");
|
||||
assert_true(!opt_junk_free || saw_junking,
|
||||
expect_true(!opt_junk_free || saw_junking,
|
||||
"Expected region of size %zu to be "
|
||||
"junk-filled", sz);
|
||||
}
|
||||
@@ -111,7 +111,7 @@ test_junk(size_t sz_min, size_t sz_max) {
|
||||
|
||||
watch_junking(s);
|
||||
dallocx(s, 0);
|
||||
assert_true(!opt_junk_free || saw_junking,
|
||||
expect_true(!opt_junk_free || saw_junking,
|
||||
"Expected region of size %zu to be junk-filled", sz);
|
||||
|
||||
if (opt_junk_free) {
|
||||
|
||||
Reference in New Issue
Block a user