1#include "test/jemalloc_test.h"
2
3TEST_BEGIN(test_pages_huge)
4{
5	size_t alloc_size;
6	bool commit;
7	void *pages, *hugepage;
8
9	alloc_size = HUGEPAGE * 2 - PAGE;
10	commit = true;
11	pages = pages_map(NULL, alloc_size, &commit);
12	assert_ptr_not_null(pages, "Unexpected pages_map() error");
13
14	hugepage = (void *)(ALIGNMENT_CEILING((uintptr_t)pages, HUGEPAGE));
15	assert_b_ne(pages_huge(hugepage, HUGEPAGE), have_thp,
16	    "Unexpected pages_huge() result");
17	assert_false(pages_nohuge(hugepage, HUGEPAGE),
18	    "Unexpected pages_nohuge() result");
19
20	pages_unmap(pages, alloc_size);
21}
22TEST_END
23
24int
25main(void)
26{
27	return (test(
28	    test_pages_huge));
29}
30