Lines Matching +full:run +full:- +full:time

2 # SPDX-License-Identifier: GPL-2.0
15 import time
72 def get_kernel_root_path() -> str:
80 request: KunitConfigRequest) -> KunitResult:
83 config_start = time.time()
85 config_end = time.time()
87 return KunitResult(status, config_end - config_start)
90 request: KunitBuildRequest) -> KunitResult:
93 build_start = time.time()
97 build_end = time.time()
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.
189 test_start = time.time()
201 # So exec_time here actually contains parsing + execution time, which is fine.
202 test_end = time.time()
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, …
222 parse_start = time.time()
237 parse_time = time.time() - parse_start
246 parse_time = time.time() - parse_start
270 request: KunitRequest) -> KunitResult:
271 run_start = time.time()
283 run_end = time.time()
286 'Elapsed time: %.3fs total, %.3fs configuring, %.3fs ' +
288 run_end - run_start,
295 # $ kunit.py run --json
297 # $ kunit.py run --json suite_name
300 # $ kunit.py run --json=suite_name
301 # i.e. it would run all tests, and dump the json to a `suite_name` file.
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',
335 help='Run all KUnit tests via tools/testing/kunit/configs/all_tests.config',
337 parser.add_argument('--kunitconfig',
343 parser.add_argument('--kconfig_add',
348 parser.add_argument('--arch',
349 help=('Specifies the architecture to run tests under. '
352 'e.g. i386, x86_64, arm, um, etc. Non-UML '
353 'architectures run on QEMU.'),
356 parser.add_argument('--cross_compile',
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',
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',
380 'jobs (commands) to run simultaneously."',
383 def add_exec_opts(parser: argparse.ArgumentParser) -> None:
384 parser.add_argument('--timeout',
386 'to run. This does not include time taken to build the '
392 help='Filter which KUnit test suites/tests run at '
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 '
418 'run.',
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',
432 'a filename is specified. Does nothing if --raw_output is set.',
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:
492 def config_handler(cli_args: argparse.Namespace) -> None:
502 'Elapsed time: %.3fs\n') % (
508 def build_handler(cli_args: argparse.Namespace) -> None:
515 'Elapsed time: %.3fs\n') % (
521 def exec_handler(cli_args: argparse.Namespace) -> None:
538 'Elapsed time: %.3fs\n') % (result.elapsed_time))
543 def parse_handler(cli_args: argparse.Namespace) -> None:
561 'run': run_handler,
569 def main(argv: Sequence[str]) -> None:
574 # The 'run' command will config, build, exec, and parse in one go.
575 run_parser = subparser.add_parser('run', help='Runs KUnit tests.')
590 exec_parser = subparser.add_parser('exec', help='Run a kernel with KUnit tests')
597 # and the '--file' argument is not relevant to 'run', so isn't in