aboutsummaryrefslogtreecommitdiff
path: root/tests/testutils.c
diff options
context:
space:
mode:
authorJon Tollefson <kniht@linux.vnet.ibm.com>2008-03-06 11:00:09 -0600
committerNishanth Aravamudan <nacc@us.ibm.com>2008-03-06 09:55:37 -0800
commit1ce5231a18d1f2c92f47bc6aa2ce085a81de5381 (patch)
tree25de3f4ed64c9168a564f7eec49500ddb960e690 /tests/testutils.c
parent05c511de4bddd81c88855f4dfba303b668aa1f73 (diff)
downloadlibhugetlbfs-1ce5231a18d1f2c92f47bc6aa2ce085a81de5381.tar.gz
tests: verify there are enough huge pages
tests: Verify there are enough huge pages to run the test. Creates a common function in testutils.c to check the number of free pages against the number of needed pages. Signed-off-by: Jon Tollefson <kniht@linux.vnet.ibm.com> Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
Diffstat (limited to 'tests/testutils.c')
-rw-r--r--tests/testutils.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/testutils.c b/tests/testutils.c
index 0cd7809..e9fe991 100644
--- a/tests/testutils.c
+++ b/tests/testutils.c
@@ -43,6 +43,13 @@
int verbose_test = 1;
char *test_name;
+void check_free_huge_pages(int nr_pages_needed)
+{
+ int freepages = read_meminfo("HugePages_Free:");
+ if (freepages < nr_pages_needed)
+ CONFIG("Must have at least %i free hugepages", nr_pages_needed);
+}
+
void __attribute__((weak)) cleanup(void)
{
}