Re: [PATCH v2 1/5] memblock tests: add range tests for memblock_alloc_exact_nid_raw

From: David Hildenbrand
Date: Mon Oct 10 2022 - 07:16:14 EST


On 03.10.22 01:41, Rebecca Mckeever wrote:
Add tests for memblock_alloc_exact_nid_raw() that are very similar to
the range tests for memblock_alloc_try_nid_raw().

Signed-off-by: Rebecca Mckeever <remckee0@xxxxxxxxx>
---
tools/testing/memblock/Makefile | 2 +-
tools/testing/memblock/main.c | 2 +
.../memblock/tests/alloc_exact_nid_api.c | 1208 +++++++++++++++++
.../memblock/tests/alloc_exact_nid_api.h | 9 +
4 files changed, 1220 insertions(+), 1 deletion(-)
create mode 100644 tools/testing/memblock/tests/alloc_exact_nid_api.c
create mode 100644 tools/testing/memblock/tests/alloc_exact_nid_api.h

diff --git a/tools/testing/memblock/Makefile b/tools/testing/memblock/Makefile
index 246f7ac8489b..2310ac4d080e 100644
--- a/tools/testing/memblock/Makefile
+++ b/tools/testing/memblock/Makefile
@@ -7,7 +7,7 @@ CFLAGS += -I. -I../../include -Wall -O2 -fsanitize=address \
LDFLAGS += -fsanitize=address -fsanitize=undefined
TARGETS = main
TEST_OFILES = tests/alloc_nid_api.o tests/alloc_helpers_api.o tests/alloc_api.o \
- tests/basic_api.o tests/common.o
+ tests/basic_api.o tests/common.o tests/alloc_exact_nid_api.o
DEP_OFILES = memblock.o lib/slab.o mmzone.o slab.o
OFILES = main.o $(DEP_OFILES) $(TEST_OFILES)
EXTR_SRC = ../../../mm/memblock.c
diff --git a/tools/testing/memblock/main.c b/tools/testing/memblock/main.c
index 4ca1024342b1..278f9dec5008 100644
--- a/tools/testing/memblock/main.c
+++ b/tools/testing/memblock/main.c
@@ -3,6 +3,7 @@
#include "tests/alloc_api.h"
#include "tests/alloc_helpers_api.h"
#include "tests/alloc_nid_api.h"
+#include "tests/alloc_exact_nid_api.h"
#include "tests/common.h"
int main(int argc, char **argv)
@@ -12,6 +13,7 @@ int main(int argc, char **argv)
memblock_alloc_checks();
memblock_alloc_helpers_checks();
memblock_alloc_nid_checks();
+ memblock_alloc_exact_nid_checks();
return 0;
}


memblock_alloc_exact_nid_raw(NUMA_NO_NODE) behaves exactly the way memblock_alloc_try_nid_raw(NUMA_NO_NODE) behaves -- which is essentially memblock_alloc_raw().

So do we really need a separate set of tests for these?

--
Thanks,

David / dhildenb