Re: [PATCH v3 1/5] memblock tests: introduce range tests for memblock_alloc_exact_nid_raw

From: David Hildenbrand
Date: Mon Oct 31 2022 - 06:29:44 EST


On 19.10.22 20:34, Rebecca Mckeever wrote:
Add TEST_F_EXACT flag, which specifies that tests should run
memblock_alloc_exact_nid_raw(). Introduce range tests for
memblock_alloc_exact_nid_raw() by using the TEST_F_EXACT flag to run the
range tests in alloc_nid_api.c, since memblock_alloc_exact_nid_raw() and
memblock_alloc_try_nid_raw() behave the same way when nid = NUMA_NO_NODE.

Rename tests and other functions in alloc_nid_api.c by removing "_try".
Since the test names will be displayed in verbose output, they need to
be general enough to refer to any of the memblock functions that the
tests may run.

Signed-off-by: Rebecca Mckeever <remckee0@xxxxxxxxx>

[...]

diff --git a/tools/testing/memblock/tests/alloc_nid_api.c b/tools/testing/memblock/tests/alloc_nid_api.c
index 2c2d60f4e3e3..df8e7e038cab 100644
--- a/tools/testing/memblock/tests/alloc_nid_api.c
+++ b/tools/testing/memblock/tests/alloc_nid_api.c
@@ -18,18 +18,27 @@ static const unsigned int node_fractions[] = {
625, /* 1/16 */
};
-static inline const char * const get_memblock_alloc_try_nid_name(int flags)
+static inline const char * const get_memblock_alloc_nid_name(int flags)
{
+ if (flags & TEST_F_EXACT)
+ return "memblock_alloc_exact_nid_raw";
if (flags & TEST_F_RAW)
return "memblock_alloc_try_nid_raw";
return "memblock_alloc_try_nid";
}
-static inline void *run_memblock_alloc_try_nid(phys_addr_t size,
- phys_addr_t align,
- phys_addr_t min_addr,
- phys_addr_t max_addr, int nid)
+static inline void *run_memblock_alloc_nid(phys_addr_t size,
+ phys_addr_t align,
+ phys_addr_t min_addr,
+ phys_addr_t max_addr, int nid)
{

I think we want to assert here that TEST_F_EXACT without TEST_F_RAW is not set --- because there is no API to support it.

Apart from that

Acked-by: David Hildenbrand <david@xxxxxxxxxx>


Thanks!

--
Thanks,

David / dhildenb