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

2 # SPDX-License-Identifier: GPL-2.0
15 import time
66 def get_kernel_root_path() -> str:
74 request: KunitConfigRequest) -> KunitResult:
77 config_start = time.time()
79 config_end = time.time()
82 config_end - config_start)
84 config_end - config_start)
87 request: KunitBuildRequest) -> KunitResult:
90 build_start = time.time()
94 build_end = time.time()
97 build_end - build_start)
100 build_end - build_start)
102 build_end - build_start)
105 request: KunitBuildRequest) -> KunitResult:
112 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 _suites_from_test_list(tests: List[str]) -> List[str]:
136 if not suites or suites[-1] != suite:
142 def exec_tests(linux: kunit_kernel.LinuxSourceTree, request: KunitExecRequest) -> KunitResult:
150 # Apply the test-part of the user's glob, if present.
162 test_start = time.time()
172 # So exec_time here actually contains parsing + execution time, which is fine.
173 test_end = time.time()
174 exec_time += test_end - test_start
187 def _map_to_overall_status(test_status: kunit_parser.TestStatus) -> KunitStatus:
192 …unitParseRequest, metadata: kunit_json.Metadata, input_data: Iterable[str]) -> Tuple[KunitResult, …
193 parse_start = time.time()
212 parse_end = time.time()
227 return KunitResult(KunitStatus.TEST_FAILURE, parse_end - parse_start), test_result
229 return KunitResult(KunitStatus.SUCCESS, parse_end - parse_start), test_result
232 request: KunitRequest) -> KunitResult:
233 run_start = time.time()
245 run_end = time.time()
248 'Elapsed time: %.3fs total, %.3fs configuring, %.3fs ' +
250 run_end - run_start,
257 # $ kunit.py run --json
259 # $ kunit.py run --json suite_name
262 # $ kunit.py run --json=suite_name
263 # i.e. it would run all tests, and dump the json to a `suite_name` file.
264 # So we hackily automatically rewrite --json => --json=stdout
266 '--json': 'stdout',
267 '--raw_output': 'kunit',
269 def massage_argv(argv: Sequence[str]) -> Sequence[str]:
270 def massage_arg(arg: str) -> str:
276 def get_default_jobs() -> int:
279 def add_common_opts(parser) -> None:
280 parser.add_argument('--build_dir',
284 parser.add_argument('--make_options',
287 parser.add_argument('--alltests',
288 help='Run all KUnit tests via tools/testing/kunit/configs/all_tests.config',
290 parser.add_argument('--kunitconfig',
296 parser.add_argument('--kconfig_add',
301 parser.add_argument('--arch',
302 help=('Specifies the architecture to run tests under. '
305 'e.g. i386, x86_64, arm, um, etc. Non-UML '
306 'architectures run on QEMU.'),
309 parser.add_argument('--cross_compile',
313 'example `sparc64-linux-gnu-` if you have the '
315 '`$HOME/toolchains/microblaze/gcc-9.2.0-nolibc/microblaze-linux/bin/microblaze-linux-` '
317 'from the 0-day website to a directory in your '
321 parser.add_argument('--qemu_config',
326 parser.add_argument('--qemu_args',
327 help='Additional QEMU arguments, e.g. "-smp 8"',
330 def add_build_opts(parser) -> None:
331 parser.add_argument('--jobs',
333 'jobs (commands) to run simultaneously."',
336 def add_exec_opts(parser) -> None:
337 parser.add_argument('--timeout',
339 'to run. This does not include time taken to build the '
345 help='Filter which KUnit test suites/tests run at '
346 'boot-time, e.g. list* or list*.*del_test',
351 parser.add_argument('--kernel_args',
352 help='Kernel command-line parameters. Maybe be repeated',
354 parser.add_argument('--run_isolated', help='If set, boot the kernel for each '
356 'a non-hermetic test, one that might pass/fail based on '
361 def add_parse_opts(parser) -> None:
362 parser.add_argument('--raw_output', help='If set don\'t format output from kernel. '
363 'If set to --raw_output=kunit, filters to just KUnit output.',
365 parser.add_argument('--json',
373 def tree_from_args(cli_args: argparse.Namespace) -> kunit_kernel.LinuxSourceTree:
375 # Allow users to specify multiple arguments in one string, e.g. '-smp 8'
383 # Prepend so user-specified options take prio if we ever allow
384 # --kunitconfig options to have differing options.
401 # The 'run' command will config, build, exec, and parse in one go.
402 run_parser = subparser.add_parser('run', help='Runs KUnit tests.')
417 exec_parser = subparser.add_parser('exec', help='Run a kernel with KUnit tests')
424 # and the '--file' argument is not relevant to 'run', so isn't in
439 if cli_args.subcommand == 'run':
466 'Elapsed time: %.3fs\n') % (
477 'Elapsed time: %.3fs\n') % (
492 'Elapsed time: %.3fs\n') % (result.elapsed_time))
497 sys.stdin.reconfigure(errors='backslashreplace') # pytype: disable=attribute-error