aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tools/testing/memblock/Makefile
diff options
context:
space:
mode:
authorKarolina Drobnik <karolinadrobnik@gmail.com>2022-02-02 12:03:09 +0100
committerMike Rapoport <rppt@linux.ibm.com>2022-02-20 08:44:37 +0200
commit16802e55dea9534c18a30bd8eeefea8a06337916 (patch)
tree3baa119284c22435f524bf65c86e0ef00968dae0 /tools/testing/memblock/Makefile
parenttools/include: Add debugfs.h stub (diff)
downloadwireguard-linux-16802e55dea9534c18a30bd8eeefea8a06337916.tar.xz
wireguard-linux-16802e55dea9534c18a30bd8eeefea8a06337916.zip
memblock tests: Add skeleton of the memblock simulator
Add basic project files, together with local stubs of required headers. Update tools/include/slab.h to include definitions used by memblock. Signed-off-by: Karolina Drobnik <karolinadrobnik@gmail.com> Signed-off-by: Mike Rapoport <rppt@kernel.org> Link: https://lore.kernel.org/r/d296fceb023a04b316a31fbff9acf1e76ac684e4.1643796665.git.karolinadrobnik@gmail.com
Diffstat (limited to 'tools/testing/memblock/Makefile')
-rw-r--r--tools/testing/memblock/Makefile52
1 files changed, 52 insertions, 0 deletions
diff --git a/tools/testing/memblock/Makefile b/tools/testing/memblock/Makefile
new file mode 100644
index 000000000000..e43ed9de9bcf
--- /dev/null
+++ b/tools/testing/memblock/Makefile
@@ -0,0 +1,52 @@
+# SPDX-License-Identifier: GPL-2.0
+
+# Memblock simulator requires AddressSanitizer (libasan) and liburcu development
+# packages installed
+CFLAGS += -I. -I../../include -Wall -O2 -fsanitize=address \
+ -fsanitize=undefined -D CONFIG_PHYS_ADDR_T_64BIT
+LDFLAGS += -fsanitize=address -fsanitize=undefined
+TARGETS = main
+OFILES = main.o memblock.o lib/slab.o mmzone.o slab.o
+EXTR_SRC = ../../../mm/memblock.c
+
+ifeq ($(BUILD), 32)
+ CFLAGS += -m32
+ LDFLAGS += -m32
+endif
+
+# Process user parameters
+include scripts/Makefile.include
+
+main: $(OFILES)
+
+$(OFILES): include
+
+include: ../../../include/linux/memblock.h ../../include/linux/*.h \
+ ../../include/asm/*.h
+
+ @mkdir -p linux
+ test -L linux/memblock.h || ln -s ../../../../include/linux/memblock.h linux/memblock.h
+ test -L asm/cmpxchg.h || ln -s ../../../arch/x86/include/asm/cmpxchg.h asm/cmpxchg.h
+
+memblock.c: $(EXTR_SRC)
+ test -L memblock.c || ln -s $(EXTR_SRC) memblock.c
+
+clean:
+ $(RM) $(TARGETS) $(OFILES) linux/memblock.h memblock.c asm/cmpxchg.h
+
+help:
+ @echo 'Memblock simulator'
+ @echo ''
+ @echo 'Available targets:'
+ @echo ' main - Build the memblock simulator'
+ @echo ' clean - Remove generated files and symlinks in the directory'
+ @echo ''
+ @echo 'Configuration:'
+ @echo ' make NUMA=1 - simulate enabled NUMA'
+ @echo ' make MOVABLE_NODE=1 - override `movable_node_is_enabled`'
+ @echo ' definition to simulate movable NUMA nodes'
+ @echo ' make 32BIT_PHYS_ADDR_T=1 - Use 32 bit physical addresses'
+
+vpath %.c ../../lib
+
+.PHONY: clean include help