]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
verification/dot2k: Replace is_container() hack with subparsers
authorNam Cao <namcao@linutronix.de>
Fri, 4 Jul 2025 13:19:59 +0000 (15:19 +0200)
committerSteven Rostedt (Google) <rostedt@goodmis.org>
Thu, 24 Jul 2025 14:42:46 +0000 (10:42 -0400)
commit5270a0e3041cba8aef76aaf62408313b9cd4ad9f
tree201bf137ec2bdb5b3037d0f2f76f2aa0ac9c8baf
parent612934e99b562c959ea5fc4c3adc75248b17b818
verification/dot2k: Replace is_container() hack with subparsers

dot2k is used for both generating deterministic automaton (DA) monitor and
generating container monitor.

Generating DA monitor and generating container requires different
parameters. This is implemented by peeking at sys.argv and check whether
"--container" is specified, and use that information to make some
parameters optional or required.

This works, but is quite hacky and ugly.

Replace this hack with Python's built-in subparsers.

The old commands:

  python3 dot2/dot2k -d wip.dot -t per_cpu
  python3 dot2/dot2k -n sched --container

are equivalent to the new commands:

  python3 dot2/dot2k monitor -d wip.dot -t per_cpu
  python3 dot2/dot2k container -n sched

Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Link: https://lore.kernel.org/23c4e3c6e10c39e86d8e6a289208dde407efc4a8.1751634289.git.namcao@linutronix.de
Reviewed-by: Gabriele Monaco <gmonaco@redhat.com>
Signed-off-by: Nam Cao <namcao@linutronix.de>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
tools/verification/dot2/dot2k
tools/verification/dot2/dot2k.py