kunit.py (7ef925ea819469b1341a9b704c3e72bacf62000c) | kunit.py (5f6aa6d82e45d27f00f39844749ae812c7fd6ab3) |
---|---|
1#!/usr/bin/env python3 2# SPDX-License-Identifier: GPL-2.0 3# 4# A thin wrapper on top of the KUnit Kernel 5# 6# Copyright (C) 2019, Google LLC. 7# Author: Felix Guo <felixguoxiuping@gmail.com> 8# Author: Brendan Higgins <brendanhiggins@google.com> --- 86 unchanged lines hidden (view full) --- 95 kunit_parser.print_with_timestamp('Starting KUnit Kernel ...') 96 test_start = time.time() 97 run_result = linux.run_kernel( 98 args=request.kernel_args, 99 timeout=None if request.alltests else request.timeout, 100 filter_glob=request.filter_glob, 101 build_dir=request.build_dir) 102 | 1#!/usr/bin/env python3 2# SPDX-License-Identifier: GPL-2.0 3# 4# A thin wrapper on top of the KUnit Kernel 5# 6# Copyright (C) 2019, Google LLC. 7# Author: Felix Guo <felixguoxiuping@gmail.com> 8# Author: Brendan Higgins <brendanhiggins@google.com> --- 86 unchanged lines hidden (view full) --- 95 kunit_parser.print_with_timestamp('Starting KUnit Kernel ...') 96 test_start = time.time() 97 run_result = linux.run_kernel( 98 args=request.kernel_args, 99 timeout=None if request.alltests else request.timeout, 100 filter_glob=request.filter_glob, 101 build_dir=request.build_dir) 102 |
103 result = parse_tests(parse_request, run_result) 104 105 # run_kernel() doesn't block on the kernel exiting. 106 # That only happens after we get the last line of output from `run_result`. 107 # So exec_time here actually contains parsing + execution time, which is fine. |
|
103 test_end = time.time() 104 exec_time = test_end - test_start 105 | 108 test_end = time.time() 109 exec_time = test_end - test_start 110 |
106 # Named tuples are immutable, so we rebuild them here manually 107 result = parse_tests(parse_request, run_result) 108 | |
109 return KunitResult(status=result.status, result=result.result, elapsed_time=exec_time) 110 111def parse_tests(request: KunitParseRequest, input_data: Iterable[str]) -> KunitResult: 112 parse_start = time.time() 113 114 test_result = kunit_parser.TestResult(kunit_parser.TestStatus.SUCCESS, 115 [], 116 'Tests not Parsed.') --- 309 unchanged lines hidden --- | 111 return KunitResult(status=result.status, result=result.result, elapsed_time=exec_time) 112 113def parse_tests(request: KunitParseRequest, input_data: Iterable[str]) -> KunitResult: 114 parse_start = time.time() 115 116 test_result = kunit_parser.TestResult(kunit_parser.TestStatus.SUCCESS, 117 [], 118 'Tests not Parsed.') --- 309 unchanged lines hidden --- |