Skip to contentSkip to conversation

memblock tests: add command line help option and update obsolete comments

PATCH Applied Rebecca Mckeever 2 participants 4 messages Aug 14, 2022 – Aug 23, 2022

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

cover memblock tests: add command line help option and update obsolete comments

These patches add a help command line option to the help message and update references to an obsolete build option in comments.

Rebecca Mckeever (2):
memblock tests: add command line help option
memblock tests: update reference to obsolete build option in comments

 tools/testing/memblock/tests/common.c | 4 +++-
 tools/testing/memblock/tests/common.h | 9 ++++++---
 2 files changed, 9 insertions(+), 4 deletions(-)
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/2 memblock tests: add command line help option

Add a help command line option to the help message. Add the help option to the short and long options so it will be recognized as a valid option.

Usage:

    $ ./main -h
    Or:
    $ ./main --help
---
 tools/testing/memblock/tests/common.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
tools/testing/memblock/tests/common.c +3 -1
index e43b2676af81..76a8ad818f3a 100644
@@ -14,14 +14,16 @@ static struct test_memory memory_block;
 static const char __maybe_unused *prefixes[PREFIXES_MAX];
 static int __maybe_unused nr_prefixes;
 
-static const char *short_opts = "mv";
+static const char *short_opts = "hmv";
 static const struct option long_opts[] = {
+	{"help", 0, NULL, 'h'},
 	{"movable-node", 0, NULL, 'm'},
 	{"verbose", 0, NULL, 'v'},
 	{NULL, 0, NULL, 0}
 };
 
 static const char * const help_opts[] = {
+	"display this help message and exit",
 	"disallow allocations from regions marked as hotplugged\n\t\t\t"
 		"by simulating enabling the \"movable_node\" kernel\n\t\t\t"
 		"parameter",
Signature · 1 line
2.25.1
#2 lore raw

PATCH 2/2 memblock tests: update reference to obsolete build option in comments

In reply to Rebecca Mckeever

The VERBOSE build option was replaced with the --verbose runtime option, but the comments describing the ASSERT_*() macros still refer to the VERBOSE build option. Update these comments so that they refer to the --verbose runtime option.

---
 tools/testing/memblock/tests/common.h | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
tools/testing/memblock/tests/common.h +6 -3
index 3e7f23d341d7..d396e5423a8e 100644
@@ -16,7 +16,8 @@
  * ASSERT_EQ():
  * Check the condition
  * @_expected == @_seen
- * If false, print failed test message (if in VERBOSE mode) and then assert
+ * If false, print failed test message (if running with --verbose) and then
+ * assert.
  */
 #define ASSERT_EQ(_expected, _seen) do { \
 	if ((_expected) != (_seen)) \
@@ -28,7 +29,8 @@
  * ASSERT_NE():
  * Check the condition
  * @_expected != @_seen
- * If false, print failed test message (if in VERBOSE mode) and then assert
+ * If false, print failed test message (if running with --verbose) and then
+ * assert.
  */
 #define ASSERT_NE(_expected, _seen) do { \
 	if ((_expected) == (_seen)) \
@@ -40,7 +42,8 @@
  * ASSERT_LT():
  * Check the condition
  * @_expected < @_seen
- * If false, print failed test message (if in VERBOSE mode) and then assert
+ * If false, print failed test message (if running with --verbose) and then
+ * assert.
  */
 #define ASSERT_LT(_expected, _seen) do { \
 	if ((_expected) >= (_seen)) \
Signature · 1 line
2.25.1
maintainer Applied
#3 lore raw
In reply to Rebecca Mckeever
Quoted 10 lines · Rebecca Mckeever

These patches add a help command line option to the help message and update references to an obsolete build option in comments.

Rebecca Mckeever (2):
memblock tests: add command line help option
memblock tests: update reference to obsolete build option in comments

 tools/testing/memblock/tests/common.c | 4 +++-
 tools/testing/memblock/tests/common.h | 9 ++++++---
 2 files changed, 9 insertions(+), 4 deletions(-)

Applied, thanks!

Signature · 2 lines
Sincerely yours,
Mike.