]> git.baikalelectronics.ru Git - kernel.git/commit
kunit: tool: more descriptive metavars/--help output
authorDaniel Latypov <dlatypov@google.com>
Sat, 26 Feb 2022 21:23:25 +0000 (13:23 -0800)
committerShuah Khan <skhan@linuxfoundation.org>
Mon, 4 Apr 2022 22:22:14 +0000 (16:22 -0600)
commitb9d903361c514ce8651cf64163e1e2718836b3d0
tree2c537fd70a18e0b585b2841f9bf3068442367d1f
parent112e5ee2e64000e772bebdd0d11102e6dc6fa1e6
kunit: tool: more descriptive metavars/--help output

Before, our help output contained lines like
  --kconfig_add KCONFIG_ADD
  --qemu_config qemu_config
  --jobs jobs

They're not very helpful.

The former kind come from the automatic 'metavar' we get from argparse,
the uppercase version of the flag name.
The latter are where we manually specified metavar as the flag name.

After:
  --build_dir DIR
  --make_options X=Y
  --kunitconfig PATH
  --kconfig_add CONFIG_X=Y
  --arch ARCH
  --cross_compile PREFIX
  --qemu_config FILE
  --jobs N
  --timeout SECONDS
  --raw_output [{all,kunit}]
  --json [FILE]

This patch tries to make the code more clear by specifying the _type_ of
input we expect, e.g. --build_dir is a DIR, --qemu_config is a FILE.
I also switched it to uppercase since it looked more clearly like
placeholder text that way.

This patch also changes --raw_output to specify `choices` to make it
more clear what the options are, and this way argparse can validate it
for us, as shown by the added test case.

Signed-off-by: Daniel Latypov <dlatypov@google.com>
Reviewed-by: David Gow <davidgow@google.com>
Reviewed-by: Brendan Higgins <brendanhiggins@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
tools/testing/kunit/kunit.py
tools/testing/kunit/kunit_tool_test.py