Hi all, Today's linux-next merge of the kunit-next tree got a conflict in: tools/testing/kunit/kunit.py between commit: d8c23ead708b ("kunit: tool: better handling of quasi-bool args (--json, --raw_output)") from the kunit-fixes tree and commit: 6710951ee039 ("kunit: tool: support running each suite/test separately") from the kunit-next tree. I fixed it up (see below) and can carry the fix as necessary. This is now fixed as far as linux-next is concerned, but any non trivial conflicts should be mentioned to your upstream maintainer when your tree is submitted for merging. You may also want to consider cooperating with the maintainer of the conflicting tree to minimise any particularly complex conflicts. -- Cheers, Stephen Rothwell diff --cc tools/testing/kunit/kunit.py index ac35c61f65f5,7197e5fb8342..000000000000 --- a/tools/testing/kunit/kunit.py +++ b/tools/testing/kunit/kunit.py @@@ -16,9 -17,8 +17,8 @@@ assert sys.version_info >= (3, 7), "Pyt from collections import namedtuple from enum import Enum, auto - from typing import Iterable, Sequence -from typing import Iterable, List ++from typing import Iterable, Sequence, List - import kunit_config import kunit_json import kunit_kernel import kunit_parser @@@ -184,28 -231,8 +231,28 @@@ def run_tests(linux: kunit_kernel.Linux config_result.elapsed_time, build_result.elapsed_time, exec_result.elapsed_time)) - return parse_result + return exec_result +# Problem: +# $ kunit.py run --json +# works as one would expect and prints the parsed test results as JSON. +# $ kunit.py run --json suite_name +# would *not* pass suite_name as the filter_glob and print as json. +# argparse will consider it to be another way of writing +# $ kunit.py run --json=suite_name +# i.e. it would run all tests, and dump the json to a `suite_name` file. +# So we hackily automatically rewrite --json => --json=stdout +pseudo_bool_flag_defaults = { + '--json': 'stdout', + '--raw_output': 'kunit', +} +def massage_argv(argv: Sequence[str]) -> Sequence[str]: + def massage_arg(arg: str) -> str: + if arg not in pseudo_bool_flag_defaults: + return arg + return f'{arg}={pseudo_bool_flag_defaults[arg]}' + return list(map(massage_arg, argv)) + def add_common_opts(parser) -> None: parser.add_argument('--build_dir', help='As in the make command, it specifies the build '
Attachment:
pgpHoKkYA9Yzf.pgp
Description: OpenPGP digital signature