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

memblock tests: add labels to verbose output for generic alloc tests

Generic tests for memblock_alloc*() functions do not use separate
functions for testing top-down and bottom-up allocation directions.
Therefore, the function name that is displayed in the verbose testing
output does not include the allocation direction.

Add an additional prefix when running generic tests for
memblock_alloc*() functions that indicates which allocation direction is
set. The prefix will be displayed when the tests are run in verbose mode.
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/fb76a42253d2a196a7daea29dd8121a69904f58e.1661578349.git.remckee0@gmail.com
parent 25b9defb
...@@ -751,10 +751,8 @@ static int alloc_after_check(void) ...@@ -751,10 +751,8 @@ static int alloc_after_check(void)
static int alloc_in_between_check(void) static int alloc_in_between_check(void)
{ {
test_print("\tRunning %s...\n", __func__); test_print("\tRunning %s...\n", __func__);
memblock_set_bottom_up(false); run_top_down(alloc_in_between_generic_check);
alloc_in_between_generic_check(); run_bottom_up(alloc_in_between_generic_check);
memblock_set_bottom_up(true);
alloc_in_between_generic_check();
return 0; return 0;
} }
...@@ -773,10 +771,8 @@ static int alloc_second_fit_check(void) ...@@ -773,10 +771,8 @@ static int alloc_second_fit_check(void)
static int alloc_small_gaps_check(void) static int alloc_small_gaps_check(void)
{ {
test_print("\tRunning %s...\n", __func__); test_print("\tRunning %s...\n", __func__);
memblock_set_bottom_up(false); run_top_down(alloc_small_gaps_generic_check);
alloc_small_gaps_generic_check(); run_bottom_up(alloc_small_gaps_generic_check);
memblock_set_bottom_up(true);
alloc_small_gaps_generic_check();
return 0; return 0;
} }
...@@ -784,10 +780,8 @@ static int alloc_small_gaps_check(void) ...@@ -784,10 +780,8 @@ static int alloc_small_gaps_check(void)
static int alloc_all_reserved_check(void) static int alloc_all_reserved_check(void)
{ {
test_print("\tRunning %s...\n", __func__); test_print("\tRunning %s...\n", __func__);
memblock_set_bottom_up(false); run_top_down(alloc_all_reserved_generic_check);
alloc_all_reserved_generic_check(); run_bottom_up(alloc_all_reserved_generic_check);
memblock_set_bottom_up(true);
alloc_all_reserved_generic_check();
return 0; return 0;
} }
...@@ -795,10 +789,8 @@ static int alloc_all_reserved_check(void) ...@@ -795,10 +789,8 @@ static int alloc_all_reserved_check(void)
static int alloc_no_space_check(void) static int alloc_no_space_check(void)
{ {
test_print("\tRunning %s...\n", __func__); test_print("\tRunning %s...\n", __func__);
memblock_set_bottom_up(false); run_top_down(alloc_no_space_generic_check);
alloc_no_space_generic_check(); run_bottom_up(alloc_no_space_generic_check);
memblock_set_bottom_up(true);
alloc_no_space_generic_check();
return 0; return 0;
} }
...@@ -806,10 +798,8 @@ static int alloc_no_space_check(void) ...@@ -806,10 +798,8 @@ static int alloc_no_space_check(void)
static int alloc_limited_space_check(void) static int alloc_limited_space_check(void)
{ {
test_print("\tRunning %s...\n", __func__); test_print("\tRunning %s...\n", __func__);
memblock_set_bottom_up(false); run_top_down(alloc_limited_space_generic_check);
alloc_limited_space_generic_check(); run_bottom_up(alloc_limited_space_generic_check);
memblock_set_bottom_up(true);
alloc_limited_space_generic_check();
return 0; return 0;
} }
...@@ -817,10 +807,8 @@ static int alloc_limited_space_check(void) ...@@ -817,10 +807,8 @@ static int alloc_limited_space_check(void)
static int alloc_no_memory_check(void) static int alloc_no_memory_check(void)
{ {
test_print("\tRunning %s...\n", __func__); test_print("\tRunning %s...\n", __func__);
memblock_set_bottom_up(false); run_top_down(alloc_no_memory_generic_check);
alloc_no_memory_generic_check(); run_bottom_up(alloc_no_memory_generic_check);
memblock_set_bottom_up(true);
alloc_no_memory_generic_check();
return 0; return 0;
} }
......
...@@ -357,10 +357,8 @@ static int alloc_from_bottom_up_min_addr_cap_check(void) ...@@ -357,10 +357,8 @@ static int alloc_from_bottom_up_min_addr_cap_check(void)
static int alloc_from_simple_check(void) static int alloc_from_simple_check(void)
{ {
test_print("\tRunning %s...\n", __func__); test_print("\tRunning %s...\n", __func__);
memblock_set_bottom_up(false); run_top_down(alloc_from_simple_generic_check);
alloc_from_simple_generic_check(); run_bottom_up(alloc_from_simple_generic_check);
memblock_set_bottom_up(true);
alloc_from_simple_generic_check();
return 0; return 0;
} }
...@@ -368,10 +366,8 @@ static int alloc_from_simple_check(void) ...@@ -368,10 +366,8 @@ static int alloc_from_simple_check(void)
static int alloc_from_misaligned_check(void) static int alloc_from_misaligned_check(void)
{ {
test_print("\tRunning %s...\n", __func__); test_print("\tRunning %s...\n", __func__);
memblock_set_bottom_up(false); run_top_down(alloc_from_misaligned_generic_check);
alloc_from_misaligned_generic_check(); run_bottom_up(alloc_from_misaligned_generic_check);
memblock_set_bottom_up(true);
alloc_from_misaligned_generic_check();
return 0; return 0;
} }
......
...@@ -1142,10 +1142,8 @@ static int alloc_try_nid_cap_min_check(void) ...@@ -1142,10 +1142,8 @@ static int alloc_try_nid_cap_min_check(void)
static int alloc_try_nid_min_reserved_check(void) static int alloc_try_nid_min_reserved_check(void)
{ {
test_print("\tRunning %s...\n", __func__); test_print("\tRunning %s...\n", __func__);
memblock_set_bottom_up(false); run_top_down(alloc_try_nid_min_reserved_generic_check);
alloc_try_nid_min_reserved_generic_check(); run_bottom_up(alloc_try_nid_min_reserved_generic_check);
memblock_set_bottom_up(true);
alloc_try_nid_min_reserved_generic_check();
return 0; return 0;
} }
...@@ -1153,10 +1151,8 @@ static int alloc_try_nid_min_reserved_check(void) ...@@ -1153,10 +1151,8 @@ static int alloc_try_nid_min_reserved_check(void)
static int alloc_try_nid_max_reserved_check(void) static int alloc_try_nid_max_reserved_check(void)
{ {
test_print("\tRunning %s...\n", __func__); test_print("\tRunning %s...\n", __func__);
memblock_set_bottom_up(false); run_top_down(alloc_try_nid_max_reserved_generic_check);
alloc_try_nid_max_reserved_generic_check(); run_bottom_up(alloc_try_nid_max_reserved_generic_check);
memblock_set_bottom_up(true);
alloc_try_nid_max_reserved_generic_check();
return 0; return 0;
} }
...@@ -1164,10 +1160,8 @@ static int alloc_try_nid_max_reserved_check(void) ...@@ -1164,10 +1160,8 @@ static int alloc_try_nid_max_reserved_check(void)
static int alloc_try_nid_exact_address_check(void) static int alloc_try_nid_exact_address_check(void)
{ {
test_print("\tRunning %s...\n", __func__); test_print("\tRunning %s...\n", __func__);
memblock_set_bottom_up(false); run_top_down(alloc_try_nid_exact_address_generic_check);
alloc_try_nid_exact_address_generic_check(); run_bottom_up(alloc_try_nid_exact_address_generic_check);
memblock_set_bottom_up(true);
alloc_try_nid_exact_address_generic_check();
return 0; return 0;
} }
...@@ -1175,10 +1169,8 @@ static int alloc_try_nid_exact_address_check(void) ...@@ -1175,10 +1169,8 @@ static int alloc_try_nid_exact_address_check(void)
static int alloc_try_nid_reserved_full_merge_check(void) static int alloc_try_nid_reserved_full_merge_check(void)
{ {
test_print("\tRunning %s...\n", __func__); test_print("\tRunning %s...\n", __func__);
memblock_set_bottom_up(false); run_top_down(alloc_try_nid_reserved_full_merge_generic_check);
alloc_try_nid_reserved_full_merge_generic_check(); run_bottom_up(alloc_try_nid_reserved_full_merge_generic_check);
memblock_set_bottom_up(true);
alloc_try_nid_reserved_full_merge_generic_check();
return 0; return 0;
} }
...@@ -1186,10 +1178,8 @@ static int alloc_try_nid_reserved_full_merge_check(void) ...@@ -1186,10 +1178,8 @@ static int alloc_try_nid_reserved_full_merge_check(void)
static int alloc_try_nid_reserved_all_check(void) static int alloc_try_nid_reserved_all_check(void)
{ {
test_print("\tRunning %s...\n", __func__); test_print("\tRunning %s...\n", __func__);
memblock_set_bottom_up(false); run_top_down(alloc_try_nid_reserved_all_generic_check);
alloc_try_nid_reserved_all_generic_check(); run_bottom_up(alloc_try_nid_reserved_all_generic_check);
memblock_set_bottom_up(true);
alloc_try_nid_reserved_all_generic_check();
return 0; return 0;
} }
...@@ -1197,10 +1187,8 @@ static int alloc_try_nid_reserved_all_check(void) ...@@ -1197,10 +1187,8 @@ static int alloc_try_nid_reserved_all_check(void)
static int alloc_try_nid_low_max_check(void) static int alloc_try_nid_low_max_check(void)
{ {
test_print("\tRunning %s...\n", __func__); test_print("\tRunning %s...\n", __func__);
memblock_set_bottom_up(false); run_top_down(alloc_try_nid_low_max_generic_check);
alloc_try_nid_low_max_generic_check(); run_bottom_up(alloc_try_nid_low_max_generic_check);
memblock_set_bottom_up(true);
alloc_try_nid_low_max_generic_check();
return 0; return 0;
} }
......
...@@ -100,4 +100,20 @@ static inline void test_pass_pop(void) ...@@ -100,4 +100,20 @@ static inline void test_pass_pop(void)
prefix_pop(); prefix_pop();
} }
static inline void run_top_down(int (*func)())
{
memblock_set_bottom_up(false);
prefix_push("top-down");
func();
prefix_pop();
}
static inline void run_bottom_up(int (*func)())
{
memblock_set_bottom_up(true);
prefix_push("bottom-up");
func();
prefix_pop();
}
#endif #endif
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