Lines Matching +full:stdout +full:- +full:path
2 # SPDX-License-Identifier: GPL-2.0
26 from kunit_printer import stdout, null_printer
72 def get_kernel_root_path() -> str:
73 path = sys.argv[0] if not __file__ else __file__
74 parts = os.path.realpath(path).split('tools/testing/kunit')
80 request: KunitConfigRequest) -> KunitResult:
81 stdout.print_with_timestamp('Configuring KUnit Kernel ...')
87 return KunitResult(status, config_end - config_start)
90 request: KunitBuildRequest) -> KunitResult:
91 stdout.print_with_timestamp('Building KUnit Kernel ...')
99 return KunitResult(status, build_end - build_start)
102 request: KunitBuildRequest) -> KunitResult:
109 def _list_tests(linux: kunit_kernel.LinuxSourceTree, request: KunitExecRequest) -> List[str]:
125 # Filter out any extraneous non-test output that might have gotten mixed in.
128 def _list_tests_attr(linux: kunit_kernel.LinuxSourceTree, request: KunitExecRequest) -> Iterable[st…
144 # Filter out any extraneous non-test output that might have gotten mixed in.
147 def _suites_from_test_list(tests: List[str]) -> List[str]:
155 if not suites or suites[-1] != suite:
159 def exec_tests(linux: kunit_kernel.LinuxSourceTree, request: KunitExecRequest) -> KunitResult:
177 # Apply the test-part of the user's glob, if present.
187 stdout.print_with_timestamp('Starting KUnit Kernel ({}/{})...'.format(i+1, len(filter_globs)))
203 exec_time += test_end - test_start
216 def _map_to_overall_status(test_status: kunit_parser.TestStatus) -> KunitStatus:
221 …unitParseRequest, metadata: kunit_json.Metadata, input_data: Iterable[str]) -> Tuple[KunitResult, …
237 parse_time = time.time() - parse_start
240 default_printer = stdout
246 parse_time = time.time() - parse_start
249 kunit_parser.print_test(test, request.failed, stdout)
250 kunit_parser.print_summary_line(test, stdout)
256 if request.json == 'stdout':
261 stdout.print_with_timestamp("Test results stored in %s" %
262 os.path.abspath(request.json))
270 request: KunitRequest) -> KunitResult:
285 stdout.print_with_timestamp((
288 run_end - run_start,
295 # $ kunit.py run --json
297 # $ kunit.py run --json suite_name
300 # $ kunit.py run --json=suite_name
302 # So we hackily automatically rewrite --json => --json=stdout
304 '--json': 'stdout',
305 '--raw_output': 'kunit',
307 def massage_argv(argv: Sequence[str]) -> Sequence[str]:
308 def massage_arg(arg: str) -> str:
314 def get_default_jobs() -> int:
319 # See https://github.com/python/cpython/blob/b61fece/Lib/os.py#L1175-L1186.
326 def add_common_opts(parser: argparse.ArgumentParser) -> None:
327 parser.add_argument('--build_dir',
331 parser.add_argument('--make_options',
334 parser.add_argument('--alltests',
337 parser.add_argument('--kunitconfig',
338 help='Path to Kconfig fragment that enables KUnit tests.'
343 parser.add_argument('--kconfig_add',
348 parser.add_argument('--arch',
352 'e.g. i386, x86_64, arm, um, etc. Non-UML '
356 parser.add_argument('--cross_compile',
358 'be set to a toolchain path prefix (the prefix '
360 'example `sparc64-linux-gnu-` if you have the '
362 '`$HOME/toolchains/microblaze/gcc-9.2.0-nolibc/microblaze-linux/bin/microblaze-linux-` '
364 'from the 0-day website to a directory in your '
368 parser.add_argument('--qemu_config',
369 help=('Takes a path to a path to a file containing '
373 parser.add_argument('--qemu_args',
374 help='Additional QEMU arguments, e.g. "-smp 8"',
377 def add_build_opts(parser: argparse.ArgumentParser) -> None:
378 parser.add_argument('--jobs',
383 def add_exec_opts(parser: argparse.ArgumentParser) -> None:
384 parser.add_argument('--timeout',
393 'boot-time, e.g. list* or list*.*del_test',
398 parser.add_argument('--filter',
403 parser.add_argument('--filter_action',
405 'e.g. --filter_action=skip. Otherwise they will not run.',
408 parser.add_argument('--kernel_args',
409 help='Kernel command-line parameters. Maybe be repeated',
411 parser.add_argument('--run_isolated', help='If set, boot the kernel for each '
413 'a non-hermetic test, one that might pass/fail based on '
417 parser.add_argument('--list_tests', help='If set, list all tests that will be '
420 parser.add_argument('--list_tests_attr', help='If set, list all tests and test '
424 def add_parse_opts(parser: argparse.ArgumentParser) -> None:
425 parser.add_argument('--raw_output', help='If set don\'t parse output from kernel. '
427 '--raw_output=all to show everything',
429 parser.add_argument('--json',
431 help='Prints parsed test results as JSON to stdout or a file if '
432 'a filename is specified. Does nothing if --raw_output is set.',
433 type=str, const='stdout', default=None, metavar='FILE')
434 parser.add_argument('--summary',
436 'Does nothing if --raw_output is set.',
438 parser.add_argument('--failed',
440 'Does nothing if --raw_output is set.',
444 def tree_from_args(cli_args: argparse.Namespace) -> kunit_kernel.LinuxSourceTree:
446 # Allow users to specify multiple arguments in one string, e.g. '-smp 8'
454 # Prepend so user-specified options take prio if we ever allow
455 # --kunitconfig options to have differing options.
467 def run_handler(cli_args: argparse.Namespace) -> None:
468 if not os.path.exists(cli_args.build_dir):
492 def config_handler(cli_args: argparse.Namespace) -> None:
494 not os.path.exists(cli_args.build_dir)):
501 stdout.print_with_timestamp((
508 def build_handler(cli_args: argparse.Namespace) -> None:
514 stdout.print_with_timestamp((
521 def exec_handler(cli_args: argparse.Namespace) -> None:
537 stdout.print_with_timestamp((
543 def parse_handler(cli_args: argparse.Namespace) -> None:
569 def main(argv: Sequence[str]) -> None:
597 # and the '--file' argument is not relevant to 'run', so isn't in