blob: ac35c61f65f5fd43457957f178f3ca72721bfedc [file] [log] [blame]
Finn Behrensc25ce582020-11-23 15:15:33 +01001#!/usr/bin/env python3
Felix Guo6ebf5862019-09-23 02:02:43 -07002# 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>
9
10import argparse
11import sys
12import os
13import time
14
SeongJae Parkdf4b0802021-07-12 19:52:58 +000015assert sys.version_info >= (3, 7), "Python version is too old"
16
Felix Guo6ebf5862019-09-23 02:02:43 -070017from collections import namedtuple
18from enum import Enum, auto
Daniel Latypovd8c23ea2021-09-22 09:39:21 -070019from typing import Iterable, Sequence
Felix Guo6ebf5862019-09-23 02:02:43 -070020
21import kunit_config
Heidi Fahim21a6d172020-08-11 14:27:56 -070022import kunit_json
Felix Guo6ebf5862019-09-23 02:02:43 -070023import kunit_kernel
24import kunit_parser
25
David Gow45ba7a82020-04-30 21:27:01 -070026KunitResult = namedtuple('KunitResult', ['status','result','elapsed_time'])
Felix Guo6ebf5862019-09-23 02:02:43 -070027
David Gow45ba7a82020-04-30 21:27:01 -070028KunitConfigRequest = namedtuple('KunitConfigRequest',
Vitor Massaru Iha01397e82020-05-29 16:28:45 -030029 ['build_dir', 'make_options'])
David Gow45ba7a82020-04-30 21:27:01 -070030KunitBuildRequest = namedtuple('KunitBuildRequest',
31 ['jobs', 'build_dir', 'alltests',
32 'make_options'])
33KunitExecRequest = namedtuple('KunitExecRequest',
Daniel Latypov6cb51a12021-07-15 09:08:19 -070034 ['timeout', 'build_dir', 'alltests',
35 'filter_glob', 'kernel_args'])
David Gow45ba7a82020-04-30 21:27:01 -070036KunitParseRequest = namedtuple('KunitParseRequest',
Heidi Fahim21a6d172020-08-11 14:27:56 -070037 ['raw_output', 'input_data', 'build_dir', 'json'])
Heidi Fahim021ed9f2020-03-16 13:21:25 -070038KunitRequest = namedtuple('KunitRequest', ['raw_output','timeout', 'jobs',
Daniel Latypovd992880b2021-02-05 16:08:53 -080039 'build_dir', 'alltests', 'filter_glob',
Daniel Latypov6cb51a12021-07-15 09:08:19 -070040 'kernel_args', 'json', 'make_options'])
Felix Guo6ebf5862019-09-23 02:02:43 -070041
Heidi Fahimbe886ba2020-02-18 14:19:16 -080042KernelDirectoryPath = sys.argv[0].split('tools/testing/kunit/')[0]
43
Felix Guo6ebf5862019-09-23 02:02:43 -070044class KunitStatus(Enum):
45 SUCCESS = auto()
46 CONFIG_FAILURE = auto()
47 BUILD_FAILURE = auto()
48 TEST_FAILURE = auto()
49
Daniel Latypov09641f72021-01-14 16:39:11 -080050def get_kernel_root_path() -> str:
51 path = sys.argv[0] if not __file__ else __file__
52 parts = os.path.realpath(path).split('tools/testing/kunit')
Heidi Fahimbe886ba2020-02-18 14:19:16 -080053 if len(parts) != 2:
54 sys.exit(1)
55 return parts[0]
56
David Gow45ba7a82020-04-30 21:27:01 -070057def config_tests(linux: kunit_kernel.LinuxSourceTree,
58 request: KunitConfigRequest) -> KunitResult:
59 kunit_parser.print_with_timestamp('Configuring KUnit Kernel ...')
60
Felix Guo6ebf5862019-09-23 02:02:43 -070061 config_start = time.time()
Greg Thelen0476e692020-03-23 12:04:59 -070062 success = linux.build_reconfig(request.build_dir, request.make_options)
Felix Guo6ebf5862019-09-23 02:02:43 -070063 config_end = time.time()
64 if not success:
David Gow45ba7a82020-04-30 21:27:01 -070065 return KunitResult(KunitStatus.CONFIG_FAILURE,
66 'could not configure kernel',
67 config_end - config_start)
68 return KunitResult(KunitStatus.SUCCESS,
69 'configured kernel successfully',
70 config_end - config_start)
Felix Guo6ebf5862019-09-23 02:02:43 -070071
David Gow45ba7a82020-04-30 21:27:01 -070072def build_tests(linux: kunit_kernel.LinuxSourceTree,
73 request: KunitBuildRequest) -> KunitResult:
Felix Guo6ebf5862019-09-23 02:02:43 -070074 kunit_parser.print_with_timestamp('Building KUnit Kernel ...')
75
76 build_start = time.time()
Brendan Higgins87c9c162021-05-26 14:24:06 -070077 success = linux.build_kernel(request.alltests,
78 request.jobs,
79 request.build_dir,
80 request.make_options)
Felix Guo6ebf5862019-09-23 02:02:43 -070081 build_end = time.time()
82 if not success:
David Gowee614922020-06-15 23:47:30 -070083 return KunitResult(KunitStatus.BUILD_FAILURE,
84 'could not build kernel',
85 build_end - build_start)
David Gow45ba7a82020-04-30 21:27:01 -070086 if not success:
87 return KunitResult(KunitStatus.BUILD_FAILURE,
88 'could not build kernel',
89 build_end - build_start)
90 return KunitResult(KunitStatus.SUCCESS,
91 'built kernel successfully',
92 build_end - build_start)
Felix Guo6ebf5862019-09-23 02:02:43 -070093
David Gow45ba7a82020-04-30 21:27:01 -070094def exec_tests(linux: kunit_kernel.LinuxSourceTree,
95 request: KunitExecRequest) -> KunitResult:
Felix Guo6ebf5862019-09-23 02:02:43 -070096 kunit_parser.print_with_timestamp('Starting KUnit Kernel ...')
97 test_start = time.time()
David Gow45ba7a82020-04-30 21:27:01 -070098 result = linux.run_kernel(
Daniel Latypov6cb51a12021-07-15 09:08:19 -070099 args=request.kernel_args,
Heidi Fahim021ed9f2020-03-16 13:21:25 -0700100 timeout=None if request.alltests else request.timeout,
Daniel Latypovd992880b2021-02-05 16:08:53 -0800101 filter_glob=request.filter_glob,
Heidi Fahim021ed9f2020-03-16 13:21:25 -0700102 build_dir=request.build_dir)
David Gow45ba7a82020-04-30 21:27:01 -0700103
Felix Guo6ebf5862019-09-23 02:02:43 -0700104 test_end = time.time()
105
David Gow45ba7a82020-04-30 21:27:01 -0700106 return KunitResult(KunitStatus.SUCCESS,
107 result,
108 test_end - test_start)
109
110def parse_tests(request: KunitParseRequest) -> KunitResult:
111 parse_start = time.time()
112
113 test_result = kunit_parser.TestResult(kunit_parser.TestStatus.SUCCESS,
114 [],
115 'Tests not Parsed.')
Heidi Fahim21a6d172020-08-11 14:27:56 -0700116
David Gow45ba7a82020-04-30 21:27:01 -0700117 if request.raw_output:
Daniel Latypov6a499c92021-08-05 16:51:44 -0700118 output: Iterable[str] = request.input_data
119 if request.raw_output == 'all':
120 pass
121 elif request.raw_output == 'kunit':
122 output = kunit_parser.extract_tap_lines(output)
123 else:
124 print(f'Unknown --raw_output option "{request.raw_output}"', file=sys.stderr)
125 for line in output:
126 print(line.rstrip())
127
David Gow45ba7a82020-04-30 21:27:01 -0700128 else:
129 test_result = kunit_parser.parse_run_tests(request.input_data)
130 parse_end = time.time()
131
Heidi Fahim21a6d172020-08-11 14:27:56 -0700132 if request.json:
133 json_obj = kunit_json.get_json_result(
134 test_result=test_result,
135 def_config='kunit_defconfig',
136 build_dir=request.build_dir,
137 json_path=request.json)
138 if request.json == 'stdout':
139 print(json_obj)
140
David Gow45ba7a82020-04-30 21:27:01 -0700141 if test_result.status != kunit_parser.TestStatus.SUCCESS:
142 return KunitResult(KunitStatus.TEST_FAILURE, test_result,
143 parse_end - parse_start)
144
145 return KunitResult(KunitStatus.SUCCESS, test_result,
146 parse_end - parse_start)
147
David Gow45ba7a82020-04-30 21:27:01 -0700148def run_tests(linux: kunit_kernel.LinuxSourceTree,
149 request: KunitRequest) -> KunitResult:
150 run_start = time.time()
151
152 config_request = KunitConfigRequest(request.build_dir,
David Gow45ba7a82020-04-30 21:27:01 -0700153 request.make_options)
154 config_result = config_tests(linux, config_request)
155 if config_result.status != KunitStatus.SUCCESS:
156 return config_result
157
158 build_request = KunitBuildRequest(request.jobs, request.build_dir,
159 request.alltests,
160 request.make_options)
161 build_result = build_tests(linux, build_request)
162 if build_result.status != KunitStatus.SUCCESS:
163 return build_result
164
165 exec_request = KunitExecRequest(request.timeout, request.build_dir,
Daniel Latypov6cb51a12021-07-15 09:08:19 -0700166 request.alltests, request.filter_glob,
167 request.kernel_args)
David Gow45ba7a82020-04-30 21:27:01 -0700168 exec_result = exec_tests(linux, exec_request)
169 if exec_result.status != KunitStatus.SUCCESS:
170 return exec_result
171
172 parse_request = KunitParseRequest(request.raw_output,
Heidi Fahim21a6d172020-08-11 14:27:56 -0700173 exec_result.result,
174 request.build_dir,
175 request.json)
David Gow45ba7a82020-04-30 21:27:01 -0700176 parse_result = parse_tests(parse_request)
177
178 run_end = time.time()
179
Felix Guo6ebf5862019-09-23 02:02:43 -0700180 kunit_parser.print_with_timestamp((
181 'Elapsed time: %.3fs total, %.3fs configuring, %.3fs ' +
182 'building, %.3fs running\n') % (
David Gow45ba7a82020-04-30 21:27:01 -0700183 run_end - run_start,
184 config_result.elapsed_time,
185 build_result.elapsed_time,
186 exec_result.elapsed_time))
187 return parse_result
Felix Guo6ebf5862019-09-23 02:02:43 -0700188
Daniel Latypovd8c23ea2021-09-22 09:39:21 -0700189# Problem:
190# $ kunit.py run --json
191# works as one would expect and prints the parsed test results as JSON.
192# $ kunit.py run --json suite_name
193# would *not* pass suite_name as the filter_glob and print as json.
194# argparse will consider it to be another way of writing
195# $ kunit.py run --json=suite_name
196# i.e. it would run all tests, and dump the json to a `suite_name` file.
197# So we hackily automatically rewrite --json => --json=stdout
198pseudo_bool_flag_defaults = {
199 '--json': 'stdout',
200 '--raw_output': 'kunit',
201}
202def massage_argv(argv: Sequence[str]) -> Sequence[str]:
203 def massage_arg(arg: str) -> str:
204 if arg not in pseudo_bool_flag_defaults:
205 return arg
206 return f'{arg}={pseudo_bool_flag_defaults[arg]}'
207 return list(map(massage_arg, argv))
208
Daniel Latypov09641f72021-01-14 16:39:11 -0800209def add_common_opts(parser) -> None:
David Gow45ba7a82020-04-30 21:27:01 -0700210 parser.add_argument('--build_dir',
211 help='As in the make command, it specifies the build '
212 'directory.',
Daniel Latypov6a499c92021-08-05 16:51:44 -0700213 type=str, default='.kunit', metavar='build_dir')
David Gow45ba7a82020-04-30 21:27:01 -0700214 parser.add_argument('--make_options',
215 help='X=Y make option, can be repeated.',
216 action='append')
217 parser.add_argument('--alltests',
218 help='Run all KUnit tests through allyesconfig',
219 action='store_true')
Daniel Latypov243180f2021-02-01 12:55:14 -0800220 parser.add_argument('--kunitconfig',
Daniel Latypov98547812021-02-22 14:52:41 -0800221 help='Path to Kconfig fragment that enables KUnit tests.'
222 ' If given a directory, (e.g. lib/kunit), "/.kunitconfig" '
223 'will get automatically appended.',
Daniel Latypov243180f2021-02-01 12:55:14 -0800224 metavar='kunitconfig')
David Gow45ba7a82020-04-30 21:27:01 -0700225
Brendan Higgins87c9c162021-05-26 14:24:06 -0700226 parser.add_argument('--arch',
227 help=('Specifies the architecture to run tests under. '
228 'The architecture specified here must match the '
229 'string passed to the ARCH make param, '
230 'e.g. i386, x86_64, arm, um, etc. Non-UML '
231 'architectures run on QEMU.'),
232 type=str, default='um', metavar='arch')
233
234 parser.add_argument('--cross_compile',
235 help=('Sets make\'s CROSS_COMPILE variable; it should '
236 'be set to a toolchain path prefix (the prefix '
237 'of gcc and other tools in your toolchain, for '
238 'example `sparc64-linux-gnu-` if you have the '
239 'sparc toolchain installed on your system, or '
240 '`$HOME/toolchains/microblaze/gcc-9.2.0-nolibc/microblaze-linux/bin/microblaze-linux-` '
241 'if you have downloaded the microblaze toolchain '
242 'from the 0-day website to a directory in your '
243 'home directory called `toolchains`).'),
244 metavar='cross_compile')
245
246 parser.add_argument('--qemu_config',
247 help=('Takes a path to a path to a file containing '
248 'a QemuArchParams object.'),
249 type=str, metavar='qemu_config')
250
Daniel Latypov09641f72021-01-14 16:39:11 -0800251def add_build_opts(parser) -> None:
David Gow45ba7a82020-04-30 21:27:01 -0700252 parser.add_argument('--jobs',
253 help='As in the make command, "Specifies the number of '
254 'jobs (commands) to run simultaneously."',
255 type=int, default=8, metavar='jobs')
256
Daniel Latypov09641f72021-01-14 16:39:11 -0800257def add_exec_opts(parser) -> None:
David Gow45ba7a82020-04-30 21:27:01 -0700258 parser.add_argument('--timeout',
259 help='maximum number of seconds to allow for all tests '
260 'to run. This does not include time taken to build the '
261 'tests.',
262 type=int,
263 default=300,
264 metavar='timeout')
Daniel Latypovd992880b2021-02-05 16:08:53 -0800265 parser.add_argument('filter_glob',
266 help='maximum number of seconds to allow for all tests '
267 'to run. This does not include time taken to build the '
268 'tests.',
269 type=str,
270 nargs='?',
271 default='',
272 metavar='filter_glob')
Daniel Latypov6cb51a12021-07-15 09:08:19 -0700273 parser.add_argument('--kernel_args',
274 help='Kernel command-line parameters. Maybe be repeated',
275 action='append')
David Gow45ba7a82020-04-30 21:27:01 -0700276
Daniel Latypov09641f72021-01-14 16:39:11 -0800277def add_parse_opts(parser) -> None:
Daniel Latypov6a499c92021-08-05 16:51:44 -0700278 parser.add_argument('--raw_output', help='If set don\'t format output from kernel. '
279 'If set to --raw_output=kunit, filters to just KUnit output.',
280 type=str, nargs='?', const='all', default=None)
Heidi Fahim21a6d172020-08-11 14:27:56 -0700281 parser.add_argument('--json',
282 nargs='?',
283 help='Stores test results in a JSON, and either '
284 'prints to stdout or saves to file if a '
285 'filename is specified',
286 type=str, const='stdout', default=None)
Felix Guo6ebf5862019-09-23 02:02:43 -0700287
Brendan Higginsff7b4372019-09-23 02:02:44 -0700288def main(argv, linux=None):
Felix Guo6ebf5862019-09-23 02:02:43 -0700289 parser = argparse.ArgumentParser(
290 description='Helps writing and running KUnit tests.')
291 subparser = parser.add_subparsers(dest='subcommand')
292
David Gow45ba7a82020-04-30 21:27:01 -0700293 # The 'run' command will config, build, exec, and parse in one go.
Felix Guo6ebf5862019-09-23 02:02:43 -0700294 run_parser = subparser.add_parser('run', help='Runs KUnit tests.')
David Gow45ba7a82020-04-30 21:27:01 -0700295 add_common_opts(run_parser)
David Gow45ba7a82020-04-30 21:27:01 -0700296 add_build_opts(run_parser)
297 add_exec_opts(run_parser)
298 add_parse_opts(run_parser)
Felix Guo6ebf5862019-09-23 02:02:43 -0700299
David Gow45ba7a82020-04-30 21:27:01 -0700300 config_parser = subparser.add_parser('config',
301 help='Ensures that .config contains all of '
302 'the options in .kunitconfig')
303 add_common_opts(config_parser)
Felix Guo6ebf5862019-09-23 02:02:43 -0700304
David Gow45ba7a82020-04-30 21:27:01 -0700305 build_parser = subparser.add_parser('build', help='Builds a kernel with KUnit tests')
306 add_common_opts(build_parser)
307 add_build_opts(build_parser)
Felix Guo6ebf5862019-09-23 02:02:43 -0700308
David Gow45ba7a82020-04-30 21:27:01 -0700309 exec_parser = subparser.add_parser('exec', help='Run a kernel with KUnit tests')
310 add_common_opts(exec_parser)
311 add_exec_opts(exec_parser)
312 add_parse_opts(exec_parser)
Felix Guo6ebf5862019-09-23 02:02:43 -0700313
David Gow45ba7a82020-04-30 21:27:01 -0700314 # The 'parse' option is special, as it doesn't need the kernel source
315 # (therefore there is no need for a build_dir, hence no add_common_opts)
316 # and the '--file' argument is not relevant to 'run', so isn't in
317 # add_parse_opts()
318 parse_parser = subparser.add_parser('parse',
319 help='Parses KUnit results from a file, '
320 'and parses formatted results.')
321 add_parse_opts(parse_parser)
322 parse_parser.add_argument('file',
323 help='Specifies the file to read results from.',
324 type=str, nargs='?', metavar='input_file')
Greg Thelen0476e692020-03-23 12:04:59 -0700325
Daniel Latypovd8c23ea2021-09-22 09:39:21 -0700326 cli_args = parser.parse_args(massage_argv(argv))
Felix Guo6ebf5862019-09-23 02:02:43 -0700327
Brendan Higgins5578d002020-08-11 14:27:55 -0700328 if get_kernel_root_path():
329 os.chdir(get_kernel_root_path())
330
Felix Guo6ebf5862019-09-23 02:02:43 -0700331 if cli_args.subcommand == 'run':
Vitor Massaru Iha01397e82020-05-29 16:28:45 -0300332 if not os.path.exists(cli_args.build_dir):
333 os.mkdir(cli_args.build_dir)
Brendan Higgins82206a02020-09-28 13:02:27 -0700334
Brendan Higginsff7b4372019-09-23 02:02:44 -0700335 if not linux:
Brendan Higgins87c9c162021-05-26 14:24:06 -0700336 linux = kunit_kernel.LinuxSourceTree(cli_args.build_dir,
337 kunitconfig_path=cli_args.kunitconfig,
338 arch=cli_args.arch,
339 cross_compile=cli_args.cross_compile,
340 qemu_config_path=cli_args.qemu_config)
Andy Shevchenkofcdb0bc2020-10-26 18:59:25 +0200341
Felix Guo6ebf5862019-09-23 02:02:43 -0700342 request = KunitRequest(cli_args.raw_output,
343 cli_args.timeout,
344 cli_args.jobs,
Brendan Higginsff7b4372019-09-23 02:02:44 -0700345 cli_args.build_dir,
Greg Thelen0476e692020-03-23 12:04:59 -0700346 cli_args.alltests,
Daniel Latypovd992880b2021-02-05 16:08:53 -0800347 cli_args.filter_glob,
Daniel Latypov6cb51a12021-07-15 09:08:19 -0700348 cli_args.kernel_args,
Heidi Fahim21a6d172020-08-11 14:27:56 -0700349 cli_args.json,
Greg Thelen0476e692020-03-23 12:04:59 -0700350 cli_args.make_options)
Felix Guo6ebf5862019-09-23 02:02:43 -0700351 result = run_tests(linux, request)
352 if result.status != KunitStatus.SUCCESS:
353 sys.exit(1)
David Gow45ba7a82020-04-30 21:27:01 -0700354 elif cli_args.subcommand == 'config':
Brendan Higgins82206a02020-09-28 13:02:27 -0700355 if cli_args.build_dir and (
356 not os.path.exists(cli_args.build_dir)):
357 os.mkdir(cli_args.build_dir)
358
David Gow45ba7a82020-04-30 21:27:01 -0700359 if not linux:
Brendan Higgins87c9c162021-05-26 14:24:06 -0700360 linux = kunit_kernel.LinuxSourceTree(cli_args.build_dir,
361 kunitconfig_path=cli_args.kunitconfig,
362 arch=cli_args.arch,
363 cross_compile=cli_args.cross_compile,
364 qemu_config_path=cli_args.qemu_config)
Andy Shevchenkofcdb0bc2020-10-26 18:59:25 +0200365
David Gow45ba7a82020-04-30 21:27:01 -0700366 request = KunitConfigRequest(cli_args.build_dir,
David Gow45ba7a82020-04-30 21:27:01 -0700367 cli_args.make_options)
368 result = config_tests(linux, request)
369 kunit_parser.print_with_timestamp((
370 'Elapsed time: %.3fs\n') % (
371 result.elapsed_time))
372 if result.status != KunitStatus.SUCCESS:
373 sys.exit(1)
374 elif cli_args.subcommand == 'build':
David Gow45ba7a82020-04-30 21:27:01 -0700375 if not linux:
Brendan Higgins87c9c162021-05-26 14:24:06 -0700376 linux = kunit_kernel.LinuxSourceTree(cli_args.build_dir,
377 kunitconfig_path=cli_args.kunitconfig,
378 arch=cli_args.arch,
379 cross_compile=cli_args.cross_compile,
380 qemu_config_path=cli_args.qemu_config)
Andy Shevchenkofcdb0bc2020-10-26 18:59:25 +0200381
David Gow45ba7a82020-04-30 21:27:01 -0700382 request = KunitBuildRequest(cli_args.jobs,
383 cli_args.build_dir,
384 cli_args.alltests,
385 cli_args.make_options)
386 result = build_tests(linux, request)
387 kunit_parser.print_with_timestamp((
388 'Elapsed time: %.3fs\n') % (
389 result.elapsed_time))
390 if result.status != KunitStatus.SUCCESS:
391 sys.exit(1)
392 elif cli_args.subcommand == 'exec':
David Gow45ba7a82020-04-30 21:27:01 -0700393 if not linux:
Brendan Higgins87c9c162021-05-26 14:24:06 -0700394 linux = kunit_kernel.LinuxSourceTree(cli_args.build_dir,
395 kunitconfig_path=cli_args.kunitconfig,
396 arch=cli_args.arch,
397 cross_compile=cli_args.cross_compile,
398 qemu_config_path=cli_args.qemu_config)
Andy Shevchenkofcdb0bc2020-10-26 18:59:25 +0200399
David Gow45ba7a82020-04-30 21:27:01 -0700400 exec_request = KunitExecRequest(cli_args.timeout,
401 cli_args.build_dir,
Daniel Latypovd992880b2021-02-05 16:08:53 -0800402 cli_args.alltests,
Daniel Latypov6cb51a12021-07-15 09:08:19 -0700403 cli_args.filter_glob,
404 cli_args.kernel_args)
David Gow45ba7a82020-04-30 21:27:01 -0700405 exec_result = exec_tests(linux, exec_request)
406 parse_request = KunitParseRequest(cli_args.raw_output,
Heidi Fahim21a6d172020-08-11 14:27:56 -0700407 exec_result.result,
408 cli_args.build_dir,
409 cli_args.json)
David Gow45ba7a82020-04-30 21:27:01 -0700410 result = parse_tests(parse_request)
411 kunit_parser.print_with_timestamp((
412 'Elapsed time: %.3fs\n') % (
413 exec_result.elapsed_time))
414 if result.status != KunitStatus.SUCCESS:
415 sys.exit(1)
416 elif cli_args.subcommand == 'parse':
417 if cli_args.file == None:
418 kunit_output = sys.stdin
419 else:
420 with open(cli_args.file, 'r') as f:
421 kunit_output = f.read().splitlines()
422 request = KunitParseRequest(cli_args.raw_output,
Heidi Fahim21a6d172020-08-11 14:27:56 -0700423 kunit_output,
David Gow3959d0a2020-10-21 00:16:03 -0700424 None,
Heidi Fahim21a6d172020-08-11 14:27:56 -0700425 cli_args.json)
David Gow45ba7a82020-04-30 21:27:01 -0700426 result = parse_tests(request)
427 if result.status != KunitStatus.SUCCESS:
428 sys.exit(1)
Felix Guo6ebf5862019-09-23 02:02:43 -0700429 else:
430 parser.print_help()
431
432if __name__ == '__main__':
Brendan Higginsff7b4372019-09-23 02:02:44 -0700433 main(sys.argv[1:])