Skip to contentSkip to conversation

memblock tests: change build options to run-time options

PATCH Applied Rebecca Mckeever 3 participants 3 messages Jul 14, 2022 – Jul 20, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 memblock tests: change build options to run-time options

Change verbose and movable node build options to run-time options.

Movable node usage:

    $ ./main -m
    Or:
    $ ./main --movable-node

Verbose usage:

    $ ./main -v
    Or:
    $ ./main --verbose
---
 tools/testing/memblock/Makefile               |  5 --
 tools/testing/memblock/linux/memory_hotplug.h |  8 +-
 tools/testing/memblock/main.c                 |  2 +
 .../testing/memblock/scripts/Makefile.include | 10 ---
 tools/testing/memblock/tests/common.c         | 86 ++++++++++++++++---
 tools/testing/memblock/tests/common.h         | 10 +--
 6 files changed, 79 insertions(+), 42 deletions(-)
tools/testing/memblock/Makefile +0 -5
index 9fde49ad73bd..246f7ac8489b 100644
@@ -45,13 +45,8 @@ help:
 	@echo  '  clean		  - Remove generated files and symlinks in the directory'
 	@echo  ''
 	@echo  'Configuration:'
-	@echo  '  make VERBOSE=1            - enable verbose output, which includes the'
-	@echo  '                              names of functions being tested and the'
-	@echo  '                              number of test cases passing'
 	@echo  '  make MEMBLOCK_DEBUG=1     - enable memblock_dbg() messages'
 	@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
tools/testing/memblock/linux/memory_hotplug.h +3 -5
index 47988765a219..dabe2c556858 100644
@@ -7,13 +7,11 @@
 #include <linux/cache.h>
 #include <linux/types.h>
 
+extern bool movable_node_enabled;
+
 static inline bool movable_node_is_enabled(void)
 {
-#ifdef MOVABLE_NODE
-	return true;
-#else
-	return false;
-#endif
+	return movable_node_enabled;
 }
 
 #endif
tools/testing/memblock/main.c +2 -0
index fb183c9e76d1..4ca1024342b1 100644
@@ -3,9 +3,11 @@
 #include "tests/alloc_api.h"
 #include "tests/alloc_helpers_api.h"
 #include "tests/alloc_nid_api.h"
+#include "tests/common.h"
 
 int main(int argc, char **argv)
 {
+	parse_args(argc, argv);
 	memblock_basic_checks();
 	memblock_alloc_checks();
 	memblock_alloc_helpers_checks();
tools/testing/memblock/scripts/Makefile.include +0 -10
index 4401f79bed4c..aa6d82d56a23 100644
@@ -6,11 +6,6 @@ ifeq ($(NUMA), 1)
 	CFLAGS += -D CONFIG_NUMA
 endif
 
-# Simulate movable NUMA memory regions
-ifeq ($(MOVABLE_NODE), 1)
-	CFLAGS += -D MOVABLE_NODE
-endif
-
 # Use 32 bit physical addresses.
 # Remember to install 32-bit version of dependencies.
 ifeq ($(32BIT_PHYS_ADDR_T), 1)
@@ -18,11 +13,6 @@ ifeq ($(32BIT_PHYS_ADDR_T), 1)
 	LDFLAGS += -m32
 endif
 
-# Enable verbose testing output
-ifeq ($(VERBOSE), 1)
-	CFLAGS += -D VERBOSE
-endif
-
 # Enable memblock_dbg() messages
 ifeq ($(MEMBLOCK_DEBUG), 1)
 	CFLAGS += -D MEMBLOCK_DEBUG
tools/testing/memblock/tests/common.c +73 -13

121 lines not on this page · raw message

tools/testing/memblock/tests/common.h +1 -9
index 46de86a755f3..3e7f23d341d7 100644
@@ -70,22 +70,14 @@ void reset_memblock_attributes(void);
 void setup_memblock(void);
 void dummy_physical_memory_init(void);
 void dummy_physical_memory_cleanup(void);
+void parse_args(int argc, char **argv);
 
-#ifdef VERBOSE
 void test_fail(void);
 void test_pass(void);
 void test_print(const char *fmt, ...);
 void prefix_reset(void);
 void prefix_push(const char *prefix);
 void prefix_pop(void);
-#else
-static inline void test_fail(void) {}
-static inline void test_pass(void) {}
-static inline void test_print(const char *fmt, ...) {}
-static inline void prefix_reset(void) {}
-static inline void prefix_push(const char *prefix) {}
-static inline void prefix_pop(void) {}
-#endif /* VERBOSE */
 
 static inline void test_pass_pop(void)
 {
Signature · 1 line
2.34.1
maintainer Applied
#2 lore raw
In reply to Rebecca Mckeever
Quoted 15 lines · Rebecca Mckeever

Change verbose and movable node build options to run-time options.

Movable node usage:

    $ ./main -m
    Or:
    $ ./main --movable-node

Verbose usage:

    $ ./main -v
    Or:
    $ ./main --verbose
Quoted 8 lines
---
 tools/testing/memblock/Makefile               |  5 --
 tools/testing/memblock/linux/memory_hotplug.h |  8 +-
 tools/testing/memblock/main.c                 |  2 +
 .../testing/memblock/scripts/Makefile.include | 10 ---
 tools/testing/memblock/tests/common.c         | 86 ++++++++++++++++---
 tools/testing/memblock/tests/common.h         | 10 +--
 6 files changed, 79 insertions(+), 42 deletions(-)

Applied, thanks!

Signature · 2 lines
Sincerely yours,
Mike.