#include <unistd.h>
#include "vm_util.h"
-#include "kselftest.h"
#define INLOOP_ITER 100
*/
int max = 10;
+ ksft_print_header();
+ ksft_set_plan(1);
+
free_hugepages = get_free_hugepages();
- if (free_hugepages != 1) {
+ if (free_hugepages != 1)
ksft_exit_skip("This test needs one and only one page to execute. Got %lu\n",
free_hugepages);
- }
mmap_size = default_huge_page_size();
MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB,
-1, 0);
- if ((unsigned long)huge_ptr == -1) {
- ksft_test_result_fail("Failed to allocate huge page\n");
- return KSFT_FAIL;
- }
+ if ((unsigned long)huge_ptr == -1)
+ ksft_exit_fail_msg("Failed to allocate huge page\n");
pthread_create(&thread1, NULL, madv, NULL);
pthread_create(&thread2, NULL, touch, NULL);
if (ret) {
ksft_test_result_fail("Unexpected huge page allocation\n");
- return KSFT_FAIL;
+ ksft_finished();
}
/* Unmap and restart */
munmap(huge_ptr, mmap_size);
}
- return KSFT_PASS;
+ ksft_test_result_pass("No unexpected huge page allocations\n");
+ ksft_finished();
}