Explicitly use arena 0 in alignment and OOM tests.

This helps us avoid issues with size based routing (i.e. the huge_threshold
feature).
This commit is contained in:
Qi Wang 2019-01-18 14:20:07 -08:00 committed by Qi Wang
parent a7b0a124c3
commit d3145014a0

View File

@ -126,7 +126,7 @@ TEST_BEGIN(test_oom) {
largemax = get_large_size(get_nlarge()-1); largemax = get_large_size(get_nlarge()-1);
oom = false; oom = false;
for (i = 0; i < sizeof(ptrs) / sizeof(void *); i++) { for (i = 0; i < sizeof(ptrs) / sizeof(void *); i++) {
ptrs[i] = mallocx(largemax, 0); ptrs[i] = mallocx(largemax, MALLOCX_ARENA(0));
if (ptrs[i] == NULL) { if (ptrs[i] == NULL) {
oom = true; oom = true;
} }
@ -223,12 +223,12 @@ TEST_BEGIN(test_alignment_and_size) {
sz += (alignment >> (LG_SIZEOF_PTR-1)) - 1) { sz += (alignment >> (LG_SIZEOF_PTR-1)) - 1) {
for (i = 0; i < NITER; i++) { for (i = 0; i < NITER; i++) {
nsz = nallocx(sz, MALLOCX_ALIGN(alignment) | nsz = nallocx(sz, MALLOCX_ALIGN(alignment) |
MALLOCX_ZERO); MALLOCX_ZERO | MALLOCX_ARENA(0));
assert_zu_ne(nsz, 0, assert_zu_ne(nsz, 0,
"nallocx() error for alignment=%zu, " "nallocx() error for alignment=%zu, "
"size=%zu (%#zx)", alignment, sz, sz); "size=%zu (%#zx)", alignment, sz, sz);
ps[i] = mallocx(sz, MALLOCX_ALIGN(alignment) | ps[i] = mallocx(sz, MALLOCX_ALIGN(alignment) |
MALLOCX_ZERO); MALLOCX_ZERO | MALLOCX_ARENA(0));
assert_ptr_not_null(ps[i], assert_ptr_not_null(ps[i],
"mallocx() error for alignment=%zu, " "mallocx() error for alignment=%zu, "
"size=%zu (%#zx)", alignment, sz, sz); "size=%zu (%#zx)", alignment, sz, sz);