Commit a541c6d4 authored by Rebecca Mckeever's avatar Rebecca Mckeever Committed by Mike Rapoport

memblock tests: add tests for memblock_*bottom_up functions

Add simple tests for memblock_set_bottom_up() and memblock_bottom_up().
Reviewed-by: default avatarDavid Hildenbrand <david@redhat.com>
Reviewed-by: default avatarShaoqin Huang <shaoqin.huang@intel.com>
Signed-off-by: default avatarRebecca Mckeever <remckee0@gmail.com>
Signed-off-by: default avatarMike Rapoport <rppt@linux.ibm.com>
Link: https://lore.kernel.org/r/b03701d2faeaf00f7184e4b72903de4e5e939437.1661578349.git.remckee0@gmail.com
parent ae544fd6
......@@ -1679,6 +1679,50 @@ static int memblock_free_checks(void)
return 0;
}
static int memblock_set_bottom_up_check(void)
{
prefix_push("memblock_set_bottom_up");
memblock_set_bottom_up(false);
ASSERT_EQ(memblock.bottom_up, false);
memblock_set_bottom_up(true);
ASSERT_EQ(memblock.bottom_up, true);
reset_memblock_attributes();
test_pass_pop();
return 0;
}
static int memblock_bottom_up_check(void)
{
prefix_push("memblock_bottom_up");
memblock_set_bottom_up(false);
ASSERT_EQ(memblock_bottom_up(), memblock.bottom_up);
ASSERT_EQ(memblock_bottom_up(), false);
memblock_set_bottom_up(true);
ASSERT_EQ(memblock_bottom_up(), memblock.bottom_up);
ASSERT_EQ(memblock_bottom_up(), true);
reset_memblock_attributes();
test_pass_pop();
return 0;
}
static int memblock_bottom_up_checks(void)
{
test_print("Running memblock_*bottom_up tests...\n");
prefix_reset();
memblock_set_bottom_up_check();
prefix_reset();
memblock_bottom_up_check();
return 0;
}
int memblock_basic_checks(void)
{
memblock_initialization_check();
......@@ -1686,6 +1730,7 @@ int memblock_basic_checks(void)
memblock_reserve_checks();
memblock_remove_checks();
memblock_free_checks();
memblock_bottom_up_checks();
return 0;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment