From: Gabriele Monaco <gmonaco@redhat.com>
To: linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org,
Steven Rostedt <rostedt@goodmis.org>,
Gabriele Monaco <gmonaco@redhat.com>
Cc: Nam Cao <namcao@linutronix.de>,
Thomas Weissschuh <thomas.weissschuh@linutronix.de>,
Tomas Glozar <tglozar@redhat.com>, John Kacur <jkacur@redhat.com>,
Wen Yang <wen.yang@linux.dev>
Subject: [RFC PATCH 06/12] verification/rvgen: Fix options shared among commands
Date: Mon, 27 Apr 2026 17:11:28 +0200 [thread overview]
Message-ID: <20260427151134.192971-7-gmonaco@redhat.com> (raw)
In-Reply-To: <20260427151134.192971-1-gmonaco@redhat.com>
After rvgen was refactored to use subparsers, the common options (-a and
-D) were left in the main parser. This meant that they needed to be
called /before/ the subcommand and using them without subcommand was
allowed. This is not the original intent.
rvgen -D "some description" container -n name
Define the options as parent in the subparsers to allow them to be used
from both subcommands together with other options.
rvgen container -n name -D "some description"
Signed-off-by: Gabriele Monaco <gmonaco@redhat.com>
---
tools/verification/rvgen/__main__.py | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/tools/verification/rvgen/__main__.py b/tools/verification/rvgen/__main__.py
index 3be7f85fe37b..5c923dc10d0f 100644
--- a/tools/verification/rvgen/__main__.py
+++ b/tools/verification/rvgen/__main__.py
@@ -18,14 +18,16 @@ if __name__ == '__main__':
import sys
parser = argparse.ArgumentParser(description='Generate kernel rv monitor')
- parser.add_argument("-D", "--description", dest="description", required=False)
- parser.add_argument("-a", "--auto_patch", dest="auto_patch",
+
+ parent_parser = argparse.ArgumentParser(add_help=False)
+ parent_parser.add_argument("-D", "--description", dest="description", required=False)
+ parent_parser.add_argument("-a", "--auto_patch", dest="auto_patch",
action="store_true", required=False,
help="Patch the kernel in place")
subparsers = parser.add_subparsers(dest="subcmd", required=True)
- monitor_parser = subparsers.add_parser("monitor")
+ monitor_parser = subparsers.add_parser("monitor", parents=[parent_parser])
monitor_parser.add_argument('-n', "--model_name", dest="model_name")
monitor_parser.add_argument("-p", "--parent", dest="parent",
required=False, help="Create a monitor nested to parent")
@@ -36,7 +38,7 @@ if __name__ == '__main__':
monitor_parser.add_argument('-t', "--monitor_type", dest="monitor_type", required=True,
help=f"Available options: {', '.join(Monitor.monitor_types.keys())}")
- container_parser = subparsers.add_parser("container")
+ container_parser = subparsers.add_parser("container", parents=[parent_parser])
container_parser.add_argument('-n', "--model_name", dest="model_name", required=True)
params = parser.parse_args()
--
2.53.0
next prev parent reply other threads:[~2026-04-27 15:12 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-27 15:11 [RFC PATCH 00/12] rv: Add selftests to tools and KUnit tests Gabriele Monaco
2026-04-27 15:11 ` [RFC PATCH 01/12] tools/rv: Fix substring match bug in monitor name search Gabriele Monaco
2026-04-27 15:11 ` [RFC PATCH 02/12] tools/rv: Fix substring match when listing container monitors Gabriele Monaco
2026-04-27 15:11 ` [RFC PATCH 03/12] tools/rv: Fix exit status when monitor execution fails Gabriele Monaco
2026-04-27 15:11 ` [RFC PATCH 04/12] tools/rv: Fix cleanup after failed trace setup Gabriele Monaco
2026-04-27 15:11 ` [RFC PATCH 05/12] tools/rv: Add selftests Gabriele Monaco
2026-04-27 15:11 ` Gabriele Monaco [this message]
2026-04-27 15:11 ` [RFC PATCH 07/12] verification/rvgen: Add golden and spec folders for tests Gabriele Monaco
2026-04-27 15:11 ` [RFC PATCH 08/12] verification/rvgen: Add selftests Gabriele Monaco
2026-04-27 15:11 ` [RFC PATCH 09/12] rv: Add KUnit stub to rv_react() and rv_*_task_monitor_slot() Gabriele Monaco
2026-04-27 15:11 ` [RFC PATCH 10/12] rv: Add KUnit tests for some DA/HA monitors Gabriele Monaco
2026-04-27 15:11 ` [RFC PATCH 11/12] rv: Add KUnit stubs for current and smp_processor_id() Gabriele Monaco
2026-04-27 15:11 ` [RFC PATCH 12/12] rv: Add KUnit tests for some LTL monitors Gabriele Monaco
2026-04-28 15:09 ` [RFC PATCH 00/12] rv: Add selftests to tools and KUnit tests Wen Yang
2026-04-28 15:27 ` Gabriele Monaco
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260427151134.192971-7-gmonaco@redhat.com \
--to=gmonaco@redhat.com \
--cc=jkacur@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=namcao@linutronix.de \
--cc=rostedt@goodmis.org \
--cc=tglozar@redhat.com \
--cc=thomas.weissschuh@linutronix.de \
--cc=wen.yang@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox