summaryrefslogtreecommitdiffstats
path: root/test/unit/pages.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit/pages.c')
-rw-r--r--test/unit/pages.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/test/unit/pages.c b/test/unit/pages.c
index d31a35e..67dbb4c 100644
--- a/test/unit/pages.c
+++ b/test/unit/pages.c
@@ -1,27 +1,27 @@
#include "test/jemalloc_test.h"
-TEST_BEGIN(test_pages_huge)
-{
+TEST_BEGIN(test_pages_huge) {
+ size_t alloc_size;
bool commit;
- void *pages;
+ void *pages, *hugepage;
+ alloc_size = HUGEPAGE * 2 - PAGE;
commit = true;
- pages = pages_map(NULL, PAGE, &commit);
+ pages = pages_map(NULL, alloc_size, PAGE, &commit);
assert_ptr_not_null(pages, "Unexpected pages_map() error");
- assert_false(pages_huge(pages, PAGE),
+ hugepage = (void *)(ALIGNMENT_CEILING((uintptr_t)pages, HUGEPAGE));
+ assert_b_ne(pages_huge(hugepage, HUGEPAGE), config_thp,
"Unexpected pages_huge() result");
- assert_false(pages_nohuge(pages, PAGE),
+ assert_false(pages_nohuge(hugepage, HUGEPAGE),
"Unexpected pages_nohuge() result");
- pages_unmap(pages, PAGE);
+ pages_unmap(pages, alloc_size);
}
TEST_END
int
-main(void)
-{
-
- return (test(
- test_pages_huge));
+main(void) {
+ return test(
+ test_pages_huge);
}