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:
@@ -17,33 +17,33 @@ TEST_BEGIN(test_overflow) {
|
||||
void *p;
|
||||
|
||||
sz = sizeof(unsigned);
|
||||
assert_d_eq(mallctl("arenas.nlextents", (void *)&nlextents, &sz, NULL,
|
||||
expect_d_eq(mallctl("arenas.nlextents", (void *)&nlextents, &sz, NULL,
|
||||
0), 0, "Unexpected mallctl() error");
|
||||
|
||||
miblen = sizeof(mib) / sizeof(size_t);
|
||||
assert_d_eq(mallctlnametomib("arenas.lextent.0.size", mib, &miblen), 0,
|
||||
expect_d_eq(mallctlnametomib("arenas.lextent.0.size", mib, &miblen), 0,
|
||||
"Unexpected mallctlnametomib() error");
|
||||
mib[2] = nlextents - 1;
|
||||
|
||||
sz = sizeof(size_t);
|
||||
assert_d_eq(mallctlbymib(mib, miblen, (void *)&max_size_class, &sz,
|
||||
expect_d_eq(mallctlbymib(mib, miblen, (void *)&max_size_class, &sz,
|
||||
NULL, 0), 0, "Unexpected mallctlbymib() error");
|
||||
|
||||
assert_ptr_null(malloc(max_size_class + 1),
|
||||
expect_ptr_null(malloc(max_size_class + 1),
|
||||
"Expected OOM due to over-sized allocation request");
|
||||
assert_ptr_null(malloc(SIZE_T_MAX),
|
||||
expect_ptr_null(malloc(SIZE_T_MAX),
|
||||
"Expected OOM due to over-sized allocation request");
|
||||
|
||||
assert_ptr_null(calloc(1, max_size_class + 1),
|
||||
expect_ptr_null(calloc(1, max_size_class + 1),
|
||||
"Expected OOM due to over-sized allocation request");
|
||||
assert_ptr_null(calloc(1, SIZE_T_MAX),
|
||||
expect_ptr_null(calloc(1, SIZE_T_MAX),
|
||||
"Expected OOM due to over-sized allocation request");
|
||||
|
||||
p = malloc(1);
|
||||
assert_ptr_not_null(p, "Unexpected malloc() OOM");
|
||||
assert_ptr_null(realloc(p, max_size_class + 1),
|
||||
expect_ptr_not_null(p, "Unexpected malloc() OOM");
|
||||
expect_ptr_null(realloc(p, max_size_class + 1),
|
||||
"Expected OOM due to over-sized allocation request");
|
||||
assert_ptr_null(realloc(p, SIZE_T_MAX),
|
||||
expect_ptr_null(realloc(p, SIZE_T_MAX),
|
||||
"Expected OOM due to over-sized allocation request");
|
||||
free(p);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user