Skip to content

Conversation

@vladimiroltean
Copy link
Contributor

  1. The --list-tests command doesn't actually work unless you specify a lot of unnecessary arguments.
  2. It is easy to pass wrong test names to --test and --disable-test unless you see the format that the script wants them in, as per --list-test. Actually reject the wrong names.

There are 2 problems with the --list-tests command:

- The arguments --tree and the --patch/--mdir group are marked as
  required=True, forcing argparse to demand them even when they aren't
  needed (like for --list-tests).

- The main() function tries to access args.tree before checking if
  --list-tests was specified, which would cause a crash even if the
  parser requirement was removed. This problem is masked by the first
  one, so it makes sense to handle them together.

$ ./ingest_mdir.py --list-tests # should have succeeded
ingest_mdir.py: error: the following arguments are required: --tree

$ ./ingest_mdir.py --tree dummy --list-tests
ingest_mdir.py: error: one of the arguments --patch --mdir is required

$ ./ingest_mdir.py --tree dummy --patch dummy2 --list-tests # only this variant succeeds

Remove the required=True from the patch_arg group and the --tree
argument, and add manual handling for them if --list-tests wasn't
specified.

Also, move the args.tree dereference after the list_tests check and
the manual verification that the argument was provided.

Signed-off-by: Vladimir Oltean <[email protected]>
Currently, if we specify an invalid test name such as "checkpatch"
instead of "patch/checkpatch", the script falls through with no test
run, and no indication as to what was wrong. That is admittedly not very
friendly.

We'd need to call list_tests regardless of whether the --list-tests
argument was specified, and validate against its output. However, this
makes it redundant to have that function, we can just move it into main().

Signed-off-by: Vladimir Oltean <[email protected]>
@kuba-moo kuba-moo merged commit c6748a0 into linux-netdev:main Oct 28, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants