Lines Matching +full:stdout +full:- +full:path
2 # SPDX-License-Identifier: GPL-2.0
26 from kunit_printer import stdout
70 def get_kernel_root_path() -> str:
71 path = sys.argv[0] if not __file__ else __file__
72 parts = os.path.realpath(path).split('tools/testing/kunit')
78 request: KunitConfigRequest) -> KunitResult:
79 stdout.print_with_timestamp('Configuring KUnit Kernel ...')
85 return KunitResult(status, config_end - config_start)
88 request: KunitBuildRequest) -> KunitResult:
89 stdout.print_with_timestamp('Building KUnit Kernel ...')
97 return KunitResult(status, build_end - build_start)
100 request: KunitBuildRequest) -> KunitResult:
107 def _list_tests(linux: kunit_kernel.LinuxSourceTree, request: KunitExecRequest) -> List[str]:
123 # Filter out any extraneous non-test output that might have gotten mixed in.
126 def _list_tests_attr(linux: kunit_kernel.LinuxSourceTree, request: KunitExecRequest) -> Iterable[st…
142 # Filter out any extraneous non-test output that might have gotten mixed in.
145 def _suites_from_test_list(tests: List[str]) -> List[str]:
153 if not suites or suites[-1] != suite:
157 def exec_tests(linux: kunit_kernel.LinuxSourceTree, request: KunitExecRequest) -> KunitResult:
175 # Apply the test-part of the user's glob, if present.
185 stdout.print_with_timestamp('Starting KUnit Kernel ({}/{})...'.format(i+1, len(filter_globs)))
201 exec_time += test_end - test_start
214 def _map_to_overall_status(test_status: kunit_parser.TestStatus) -> KunitStatus:
219 …unitParseRequest, metadata: kunit_json.Metadata, input_data: Iterable[str]) -> Tuple[KunitResult, …
235 parse_time = time.time() - parse_start
241 parse_time = time.time() - parse_start
247 if request.json == 'stdout':
252 stdout.print_with_timestamp("Test results stored in %s" %
253 os.path.abspath(request.json))
261 request: KunitRequest) -> KunitResult:
276 stdout.print_with_timestamp((
279 run_end - run_start,
286 # $ kunit.py run --json
288 # $ kunit.py run --json suite_name
291 # $ kunit.py run --json=suite_name
293 # So we hackily automatically rewrite --json => --json=stdout
295 '--json': 'stdout',
296 '--raw_output': 'kunit',
298 def massage_argv(argv: Sequence[str]) -> Sequence[str]:
299 def massage_arg(arg: str) -> str:
305 def get_default_jobs() -> int:
308 def add_common_opts(parser: argparse.ArgumentParser) -> None:
309 parser.add_argument('--build_dir',
313 parser.add_argument('--make_options',
316 parser.add_argument('--alltests',
319 parser.add_argument('--kunitconfig',
320 help='Path to Kconfig fragment that enables KUnit tests.'
325 parser.add_argument('--kconfig_add',
330 parser.add_argument('--arch',
334 'e.g. i386, x86_64, arm, um, etc. Non-UML '
338 parser.add_argument('--cross_compile',
340 'be set to a toolchain path prefix (the prefix '
342 'example `sparc64-linux-gnu-` if you have the '
344 '`$HOME/toolchains/microblaze/gcc-9.2.0-nolibc/microblaze-linux/bin/microblaze-linux-` '
346 'from the 0-day website to a directory in your '
350 parser.add_argument('--qemu_config',
351 help=('Takes a path to a path to a file containing '
355 parser.add_argument('--qemu_args',
356 help='Additional QEMU arguments, e.g. "-smp 8"',
359 def add_build_opts(parser: argparse.ArgumentParser) -> None:
360 parser.add_argument('--jobs',
365 def add_exec_opts(parser: argparse.ArgumentParser) -> None:
366 parser.add_argument('--timeout',
375 'boot-time, e.g. list* or list*.*del_test',
380 parser.add_argument('--filter',
385 parser.add_argument('--filter_action',
387 'e.g. --filter_action=skip. Otherwise they will not run.',
390 parser.add_argument('--kernel_args',
391 help='Kernel command-line parameters. Maybe be repeated',
393 parser.add_argument('--run_isolated', help='If set, boot the kernel for each '
395 'a non-hermetic test, one that might pass/fail based on '
399 parser.add_argument('--list_tests', help='If set, list all tests that will be '
402 parser.add_argument('--list_tests_attr', help='If set, list all tests and test '
406 def add_parse_opts(parser: argparse.ArgumentParser) -> None:
407 parser.add_argument('--raw_output', help='If set don\'t parse output from kernel. '
409 '--raw_output=all to show everything',
411 parser.add_argument('--json',
413 help='Prints parsed test results as JSON to stdout or a file if '
414 'a filename is specified. Does nothing if --raw_output is set.',
415 type=str, const='stdout', default=None, metavar='FILE')
418 def tree_from_args(cli_args: argparse.Namespace) -> kunit_kernel.LinuxSourceTree:
420 # Allow users to specify multiple arguments in one string, e.g. '-smp 8'
428 # Prepend so user-specified options take prio if we ever allow
429 # --kunitconfig options to have differing options.
441 def run_handler(cli_args: argparse.Namespace) -> None:
442 if not os.path.exists(cli_args.build_dir):
464 def config_handler(cli_args: argparse.Namespace) -> None:
466 not os.path.exists(cli_args.build_dir)):
473 stdout.print_with_timestamp((
480 def build_handler(cli_args: argparse.Namespace) -> None:
486 stdout.print_with_timestamp((
493 def exec_handler(cli_args: argparse.Namespace) -> None:
507 stdout.print_with_timestamp((
513 def parse_handler(cli_args: argparse.Namespace) -> None:
538 def main(argv: Sequence[str]) -> None:
566 # and the '--file' argument is not relevant to 'run', so isn't in