kunit.py (6f84981772535e670e4e2df051a672af229b6694) kunit.py (1fdc6f4f274748f43ebb93eeaaa23c3c69f9c3a5)
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>

--- 63 unchanged lines hidden (view full) ---

72
73def config_tests(linux: kunit_kernel.LinuxSourceTree,
74 request: KunitConfigRequest) -> KunitResult:
75 stdout.print_with_timestamp('Configuring KUnit Kernel ...')
76
77 config_start = time.time()
78 success = linux.build_reconfig(request.build_dir, request.make_options)
79 config_end = time.time()
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>

--- 63 unchanged lines hidden (view full) ---

72
73def config_tests(linux: kunit_kernel.LinuxSourceTree,
74 request: KunitConfigRequest) -> KunitResult:
75 stdout.print_with_timestamp('Configuring KUnit Kernel ...')
76
77 config_start = time.time()
78 success = linux.build_reconfig(request.build_dir, request.make_options)
79 config_end = time.time()
80 if not success:
81 return KunitResult(KunitStatus.CONFIG_FAILURE,
82 config_end - config_start)
83 return KunitResult(KunitStatus.SUCCESS,
84 config_end - config_start)
80 status = KunitStatus.SUCCESS if success else KunitStatus.CONFIG_FAILURE
81 return KunitResult(status, config_end - config_start)
85
86def build_tests(linux: kunit_kernel.LinuxSourceTree,
87 request: KunitBuildRequest) -> KunitResult:
88 stdout.print_with_timestamp('Building KUnit Kernel ...')
89
90 build_start = time.time()
91 success = linux.build_kernel(request.jobs,
92 request.build_dir,
93 request.make_options)
94 build_end = time.time()
82
83def build_tests(linux: kunit_kernel.LinuxSourceTree,
84 request: KunitBuildRequest) -> KunitResult:
85 stdout.print_with_timestamp('Building KUnit Kernel ...')
86
87 build_start = time.time()
88 success = linux.build_kernel(request.jobs,
89 request.build_dir,
90 request.make_options)
91 build_end = time.time()
95 if not success:
96 return KunitResult(KunitStatus.BUILD_FAILURE,
97 build_end - build_start)
98 if not success:
99 return KunitResult(KunitStatus.BUILD_FAILURE,
100 build_end - build_start)
101 return KunitResult(KunitStatus.SUCCESS,
102 build_end - build_start)
92 status = KunitStatus.SUCCESS if success else KunitStatus.BUILD_FAILURE
93 return KunitResult(status, build_end - build_start)
103
104def config_and_build_tests(linux: kunit_kernel.LinuxSourceTree,
105 request: KunitBuildRequest) -> KunitResult:
106 config_result = config_tests(linux, request)
107 if config_result.status != KunitStatus.SUCCESS:
108 return config_result
109
110 return build_tests(linux, request)

--- 29 unchanged lines hidden (view full) ---

140
141
142def exec_tests(linux: kunit_kernel.LinuxSourceTree, request: KunitExecRequest) -> KunitResult:
143 filter_globs = [request.filter_glob]
144 if request.run_isolated:
145 tests = _list_tests(linux, request)
146 if request.run_isolated == 'test':
147 filter_globs = tests
94
95def config_and_build_tests(linux: kunit_kernel.LinuxSourceTree,
96 request: KunitBuildRequest) -> KunitResult:
97 config_result = config_tests(linux, request)
98 if config_result.status != KunitStatus.SUCCESS:
99 return config_result
100
101 return build_tests(linux, request)

--- 29 unchanged lines hidden (view full) ---

131
132
133def exec_tests(linux: kunit_kernel.LinuxSourceTree, request: KunitExecRequest) -> KunitResult:
134 filter_globs = [request.filter_glob]
135 if request.run_isolated:
136 tests = _list_tests(linux, request)
137 if request.run_isolated == 'test':
138 filter_globs = tests
148 if request.run_isolated == 'suite':
139 elif request.run_isolated == 'suite':
149 filter_globs = _suites_from_test_list(tests)
150 # Apply the test-part of the user's glob, if present.
151 if '.' in request.filter_glob:
152 test_glob = request.filter_glob.split('.', maxsplit=2)[1]
153 filter_globs = [g + '.'+ test_glob for g in filter_globs]
154
155 metadata = kunit_json.Metadata(arch=linux.arch(), build_dir=request.build_dir, def_config='kunit_defconfig')
156

--- 359 unchanged lines hidden ---
140 filter_globs = _suites_from_test_list(tests)
141 # Apply the test-part of the user's glob, if present.
142 if '.' in request.filter_glob:
143 test_glob = request.filter_glob.split('.', maxsplit=2)[1]
144 filter_globs = [g + '.'+ test_glob for g in filter_globs]
145
146 metadata = kunit_json.Metadata(arch=linux.arch(), build_dir=request.build_dir, def_config='kunit_defconfig')
147

--- 359 unchanged lines hidden ---