aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/get_huge_pages.c12
-rw-r--r--tests/get_hugepage_region.c4
2 files changed, 10 insertions, 6 deletions
diff --git a/tests/get_huge_pages.c b/tests/get_huge_pages.c
index 5687699..2dc4e3d 100644
--- a/tests/get_huge_pages.c
+++ b/tests/get_huge_pages.c
@@ -45,20 +45,22 @@ void free_and_confirm_region_free(void *p, int line) {
void test_get_huge_pages(int num_hugepages)
{
- int err;
+ unsigned long long mapping_size;
void *p = get_huge_pages(num_hugepages * hpage_size, GHP_DEFAULT);
if (p == NULL)
FAIL("get_huge_pages() for %d hugepages", num_hugepages);
memset(p, 1, hpage_size);
- err = test_addr_huge(p + (num_hugepages -1) * hpage_size);
- if (err != 1)
+ mapping_size = get_mapping_page_size(
+ (void *)p + (num_hugepages -1) * hpage_size);
+ if (mapping_size != hpage_size)
FAIL("Returned page is not hugepage");
free_and_confirm_region_free(p, __LINE__);
- err = test_addr_huge(p);
- if (err == 1)
+ mapping_size = get_mapping_page_size(
+ (void *)p + (num_hugepages -1) * hpage_size);
+ if (mapping_size)
FAIL("hugepage was not correctly freed");
}
diff --git a/tests/get_hugepage_region.c b/tests/get_hugepage_region.c
index 2fb5b23..292d201 100644
--- a/tests/get_hugepage_region.c
+++ b/tests/get_hugepage_region.c
@@ -45,8 +45,10 @@ void free_and_confirm_region_free(void *p, int line) {
int test_unaligned_addr_huge(void *p)
{
+ unsigned long long mapping_size;
p = (void *)((unsigned long)p & ~((gethugepagesize()) - 1));
- return test_addr_huge(p);
+ mapping_size = get_mapping_page_size(p);
+ return (mapping_size == hpage_size);
}
#define TESTLEN ((num_hugepages - 1) * hpage_size + hpage_size / 2)