← Documents Documentation/dev-tools/kunit/run_wrapper.rst GitHub 원문 ↗

Linux 6.18.37 · Dev Tools

Running tests with kunit_tool

kunit_tool의 run pipeline, .kunitconfig, TAP parsing, glob filtering, QEMU·cross compilation과 전체 주요 option을 설명합니다.

Source pathDocumentation/dev-tools/kunit/run_wrapper.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

요약과 해설

run_wrapper.rst:1-337

kunit_tool은 `.kunitconfig`에서 kernel config를 만들고 build한 뒤 UML 또는 QEMU에서 실행해 TAP 결과를 parsing합니다. Run을 config, build, exec로 분리할 수 있어 자동화와 문제 진단에 모두 적합합니다.

Architecture와 toolchain, custom QemuConfig, isolated boot, raw·JSON output, attribute filter까지 command-line에서 제어할 수 있습니다. `.kunitconfig`는 dependency를 포함한 최소 test configuration이며 삭제만으로 기존 `.config`가 다시 생성되지는 않는다는 갱신 규칙에 주의해야 합니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

원문 전체 펼치기
1 .. SPDX-License-Identifier: GPL-2.0
2
3 =============================
4 Running tests with kunit_tool
5 =============================
6
7 We can either run KUnit tests using kunit_tool or can run tests
8 manually, and then use kunit_tool to parse the results. To run tests
9 manually, see: Documentation/dev-tools/kunit/run_manual.rst.
10 As long as we can build the kernel, we can run KUnit.
11
12 kunit_tool is a Python script which configures and builds a kernel, runs
13 tests, and formats the test results.
14
15 Run command:
16
17 .. code-block::
18
19 ./tools/testing/kunit/kunit.py run
20
21 We should see the following:
22
23 .. code-block::
24
25 Configuring KUnit Kernel ...
26 Building KUnit kernel...
27 Starting KUnit kernel...
28
29 We may want to use the following options:
30
31 .. code-block::
32
33 ./tools/testing/kunit/kunit.py run --timeout=30 --jobs=`nproc --all`
34
35 - ``--timeout`` sets a maximum amount of time for tests to run.
36 - ``--jobs`` sets the number of threads to build the kernel.
37
38 kunit_tool will generate a ``.kunitconfig`` with a default
39 configuration, if no other ``.kunitconfig`` file exists
40 (in the build directory). In addition, it verifies that the
41 generated ``.config`` file contains the ``CONFIG`` options in the
42 ``.kunitconfig``.
43 It is also possible to pass a separate ``.kunitconfig`` fragment to
44 kunit_tool. This is useful if we have several different groups of
45 tests we want to run independently, or if we want to use pre-defined
46 test configs for certain subsystems.
47
48 To use a different ``.kunitconfig`` file (such as one
49 provided to test a particular subsystem), pass it as an option:
50
51 .. code-block::
52
53 ./tools/testing/kunit/kunit.py run --kunitconfig=fs/ext4/.kunitconfig
54
55 To view kunit_tool flags (optional command-line arguments), run:
56
57 .. code-block::
58
59 ./tools/testing/kunit/kunit.py run --help
60
61 Creating a ``.kunitconfig`` file
62 ================================
63
64 If we want to run a specific set of tests (rather than those listed
65 in the KUnit ``defconfig``), we can provide Kconfig options in the
66 ``.kunitconfig`` file. For default .kunitconfig, see:
67 https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/testing/kunit/configs/default.config.
68 A ``.kunitconfig`` is a ``minconfig`` (a .config
69 generated by running ``make savedefconfig``), used for running a
70 specific set of tests. This file contains the regular Kernel configs
71 with specific test targets. The ``.kunitconfig`` also
72 contains any other config options required by the tests (For example:
73 dependencies for features under tests, configs that enable/disable
74 certain code blocks, arch configs and so on).
75
76 To create a ``.kunitconfig``, using the KUnit ``defconfig``:
77
78 .. code-block::
79
80 cd $PATH_TO_LINUX_REPO
81 cp tools/testing/kunit/configs/default.config .kunit/.kunitconfig
82
83 We can then add any other Kconfig options. For example:
84
85 .. code-block::
86
87 CONFIG_LIST_KUNIT_TEST=y
88
89 kunit_tool ensures that all config options in ``.kunitconfig`` are
90 set in the kernel ``.config`` before running the tests. It warns if we
91 have not included the options dependencies.
92
93 .. note:: Removing something from the ``.kunitconfig`` will
94 not rebuild the ``.config file``. The configuration is only
95 updated if the ``.kunitconfig`` is not a subset of ``.config``.
96 This means that we can use other tools
97 (For example: ``make menuconfig``) to adjust other config options.
98 The build dir needs to be set for ``make menuconfig`` to
99 work, therefore by default use ``make O=.kunit menuconfig``.
100
101 Configuring, building, and running tests
102 ========================================
103
104 If we want to make manual changes to the KUnit build process, we
105 can run part of the KUnit build process independently.
106 When running kunit_tool, from a ``.kunitconfig``, we can generate a
107 ``.config`` by using the ``config`` argument:
108
109 .. code-block::
110
111 ./tools/testing/kunit/kunit.py config
112
113 To build a KUnit kernel from the current ``.config``, we can use the
114 ``build`` argument:
115
116 .. code-block::
117
118 ./tools/testing/kunit/kunit.py build
119
120 If we already have built UML kernel with built-in KUnit tests, we
121 can run the kernel, and display the test results with the ``exec``
122 argument:
123
124 .. code-block::
125
126 ./tools/testing/kunit/kunit.py exec
127
128 The ``run`` command discussed in section: **Running tests with kunit_tool**,
129 is equivalent to running the above three commands in sequence.
130
131 Parsing test results
132 ====================
133
134 KUnit tests output displays results in TAP (Test Anything Protocol)
135 format. When running tests, kunit_tool parses this output and prints
136 a summary. To see the raw test results in TAP format, we can pass the
137 ``--raw_output`` argument:
138
139 .. code-block::
140
141 ./tools/testing/kunit/kunit.py run --raw_output
142
143 If we have KUnit results in the raw TAP format, we can parse them and
144 print the human-readable summary with the ``parse`` command for
145 kunit_tool. This accepts a filename for an argument, or will read from
146 standard input.
147
148 .. code-block:: bash
149
150 # Reading from a file
151 ./tools/testing/kunit/kunit.py parse /var/log/dmesg
152 # Reading from stdin
153 dmesg | ./tools/testing/kunit/kunit.py parse
154
155 Filtering tests
156 ===============
157
158 By passing a bash style glob filter to the ``exec`` or ``run``
159 commands, we can run a subset of the tests built into a kernel . For
160 example: if we only want to run KUnit resource tests, use:
161
162 .. code-block::
163
164 ./tools/testing/kunit/kunit.py run 'kunit-resource*'
165
166 This uses the standard glob format with wildcard characters.
167
168 .. _kunit-on-qemu:
169
170 Running tests on QEMU
171 =====================
172
173 kunit_tool supports running tests on qemu as well as
174 via UML. To run tests on qemu, by default it requires two flags:
175
176 - ``--arch``: Selects a configs collection (Kconfig, qemu config options
177 and so on), that allow KUnit tests to be run on the specified
178 architecture in a minimal way. The architecture argument is same as
179 the option name passed to the ``ARCH`` variable used by Kbuild.
180 Not all architectures currently support this flag, but we can use
181 ``--qemu_config`` to handle it. If ``um`` is passed (or this flag
182 is ignored), the tests will run via UML. Non-UML architectures,
183 for example: i386, x86_64, arm and so on; run on qemu.
184
185 ``--arch help`` lists all valid ``--arch`` values.
186
187 - ``--cross_compile``: Specifies the Kbuild toolchain. It passes the
188 same argument as passed to the ``CROSS_COMPILE`` variable used by
189 Kbuild. As a reminder, this will be the prefix for the toolchain
190 binaries such as GCC. For example:
191
192 - ``sparc64-linux-gnu`` if we have the sparc toolchain installed on
193 our system.
194
195 - ``$HOME/toolchains/microblaze/gcc-9.2.0-nolibc/microblaze-linux/bin/microblaze-linux``
196 if we have downloaded the microblaze toolchain from the 0-day
197 website to a directory in our home directory called toolchains.
198
199 This means that for most architectures, running under qemu is as simple as:
200
201 .. code-block:: bash
202
203 ./tools/testing/kunit/kunit.py run --arch=x86_64
204
205 When cross-compiling, we'll likely need to specify a different toolchain, for
206 example:
207
208 .. code-block:: bash
209
210 ./tools/testing/kunit/kunit.py run \
211 --arch=s390 \
212 --cross_compile=s390x-linux-gnu-
213
214 If we want to run KUnit tests on an architecture not supported by
215 the ``--arch`` flag, or want to run KUnit tests on qemu using a
216 non-default configuration; then we can write our own``QemuConfig``.
217 These ``QemuConfigs`` are written in Python. They have an import line
218 ``from..qemu_config import QemuArchParams`` at the top of the file.
219 The file must contain a variable called ``QEMU_ARCH`` that has an
220 instance of ``QemuArchParams`` assigned to it. See example in:
221 ``tools/testing/kunit/qemu_configs/x86_64.py``.
222
223 Once we have a ``QemuConfig``, we can pass it into kunit_tool,
224 using the ``--qemu_config`` flag. When used, this flag replaces the
225 ``--arch`` flag. For example: using
226 ``tools/testing/kunit/qemu_configs/x86_64.py``, the invocation appear
227 as
228
229 .. code-block:: bash
230
231 ./tools/testing/kunit/kunit.py run \
232 --timeout=60 \
233 --jobs=12 \
234 --qemu_config=./tools/testing/kunit/qemu_configs/x86_64.py
235
236 Running command-line arguments
237 ==============================
238
239 kunit_tool has a number of other command-line arguments which can
240 be useful for our test environment. Below are the most commonly used
241 command line arguments:
242
243 - ``--help``: Lists all available options. To list common options,
244 place ``--help`` before the command. To list options specific to that
245 command, place ``--help`` after the command.
246
247 .. note:: Different commands (``config``, ``build``, ``run``, etc)
248 have different supported options.
249 - ``--build_dir``: Specifies kunit_tool build directory. It includes
250 the ``.kunitconfig``, ``.config`` files and compiled kernel.
251
252 - ``--make_options``: Specifies additional options to pass to make, when
253 compiling a kernel (using ``build`` or ``run`` commands). For example:
254 to enable compiler warnings, we can pass ``--make_options W=1``.
255
256 - ``--alltests``: Enable a predefined set of options in order to build
257 as many tests as possible.
258
259 .. note:: The list of enabled options can be found in
260 ``tools/testing/kunit/configs/all_tests.config``.
261
262 If you only want to enable all tests with otherwise satisfied
263 dependencies, instead add ``CONFIG_KUNIT_ALL_TESTS=y`` to your
264 ``.kunitconfig``.
265
266 - ``--kunitconfig``: Specifies the path or the directory of the ``.kunitconfig``
267 file. For example:
268
269 - ``lib/kunit/.kunitconfig`` can be the path of the file.
270
271 - ``lib/kunit`` can be the directory in which the file is located.
272
273 This file is used to build and run with a predefined set of tests
274 and their dependencies. For example, to run tests for a given subsystem.
275
276 - ``--kconfig_add``: Specifies additional configuration options to be
277 appended to the ``.kunitconfig`` file. For example:
278
279 .. code-block::
280
281 ./tools/testing/kunit/kunit.py run --kconfig_add CONFIG_KASAN=y
282
283 - ``--arch``: Runs tests on the specified architecture. The architecture
284 argument is same as the Kbuild ARCH environment variable.
285 For example, i386, x86_64, arm, um, etc. Non-UML architectures run on qemu.
286 Default is `um`.
287
288 - ``--cross_compile``: Specifies the Kbuild toolchain. It passes the
289 same argument as passed to the ``CROSS_COMPILE`` variable used by
290 Kbuild. This will be the prefix for the toolchain
291 binaries such as GCC. For example:
292
293 - ``sparc64-linux-gnu-`` if we have the sparc toolchain installed on
294 our system.
295
296 - ``$HOME/toolchains/microblaze/gcc-9.2.0-nolibc/microblaze-linux/bin/microblaze-linux``
297 if we have downloaded the microblaze toolchain from the 0-day
298 website to a specified path in our home directory called toolchains.
299
300 - ``--qemu_config``: Specifies the path to a file containing a
301 custom qemu architecture definition. This should be a python file
302 containing a `QemuArchParams` object.
303
304 - ``--qemu_args``: Specifies additional qemu arguments, for example, ``-smp 8``.
305
306 - ``--jobs``: Specifies the number of jobs (commands) to run simultaneously.
307 By default, this is set to the number of cores on your system.
308
309 - ``--timeout``: Specifies the maximum number of seconds allowed for all tests to run.
310 This does not include the time taken to build the tests.
311
312 - ``--kernel_args``: Specifies additional kernel command-line arguments. May be repeated.
313
314 - ``--run_isolated``: If set, boots the kernel for each individual suite/test.
315 This is useful for debugging a non-hermetic test, one that
316 might pass/fail based on what ran before it.
317
318 - ``--raw_output``: If set, generates unformatted output from kernel. Possible options are:
319
320 - ``all``: To view the full kernel output, use ``--raw_output=all``.
321
322 - ``kunit``: This is the default option and filters to KUnit output. Use ``--raw_output`` or ``--raw_output=kunit``.
323
324 - ``--json``: If set, stores the test results in a JSON format and prints to `stdout` or
325 saves to a file if a filename is specified.
326
327 - ``--filter``: Specifies filters on test attributes, for example, ``speed!=slow``.
328 Multiple filters can be used by wrapping input in quotes and separating filters
329 by commas. Example: ``--filter "speed>slow, module=example"``.
330
331 - ``--filter_action``: If set to ``skip``, filtered tests will be shown as skipped
332 in the output rather than showing no output.
333
334 - ``--list_tests``: If set, lists all tests that will be run.
335
336 - ``--list_tests_attr``: If set, lists all tests that will be run and all of their
337 attributes.
338

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

kunit_tool 기본 실행

1-60

SPDX 라이선스 식별자: GPL-2.0

kunit_tool로 테스트 실행

KUnit test는 kunit_tool로 실행하거나 수동으로 실행한 뒤 kunit_tool로 결과만 parsing할 수 있습니다. 수동 실행은 `Documentation/dev-tools/kunit/run_manual.rst`를 참조하십시오. Kernel을 build할 수 있다면 KUnit을 실행할 수 있습니다.

kunit_tool은 kernel 구성과 build, test 실행, 결과 formatting을 수행하는 Python script입니다.

실행 명령은 다음과 같습니다.

./tools/testing/kunit/kunit.py run

다음 진행 message가 나타나야 합니다.

Configuring KUnit Kernel ...
Building KUnit kernel...
Starting KUnit kernel...

다음 option을 사용할 수 있습니다.

./tools/testing/kunit/kunit.py run --timeout=30 --jobs=`nproc --all`

`--timeout`은 테스트가 실행될 최대 시간을 지정하고 `--jobs`는 kernel build에 사용할 thread 수를 지정합니다.

Build directory에 다른 `.kunitconfig`가 없으면 kunit_tool이 기본 configuration으로 새 파일을 생성합니다. 또한 생성된 `.config`가 `.kunitconfig`의 `CONFIG` option을 포함하는지 검증합니다.

별도의 `.kunitconfig` fragment를 kunit_tool에 전달할 수도 있습니다. 여러 test group을 독립적으로 실행하거나 subsystem별 미리 정의된 test config를 사용할 때 유용합니다.

다른 `.kunitconfig` file을 사용하려면 option으로 전달합니다.

./tools/testing/kunit/kunit.py run --kunitconfig=fs/ext4/.kunitconfig

kunit_tool의 선택적 command-line flag를 보려면 다음을 실행합니다.

./tools/testing/kunit/kunit.py run --help

.kunitconfig 생성과 갱신 규칙

61-100

`.kunitconfig` file 만들기

KUnit `defconfig`에 있는 테스트 대신 특정 test set을 실행하려면 `.kunitconfig`에 Kconfig option을 넣습니다. 기본 파일은 https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/testing/kunit/configs/default.config 에 있습니다.

`.kunitconfig`는 `make savedefconfig`가 생성한 `.config`인 minconfig이며 특정 test set 실행에 사용합니다. 일반 kernel config와 특정 test target을 포함하고, feature dependency, 특정 code block 활성화 또는 비활성화, architecture config처럼 테스트에 필요한 다른 option도 포함합니다.

KUnit defconfig에서 `.kunitconfig`를 만듭니다.

cd $PATH_TO_LINUX_REPO
cp tools/testing/kunit/configs/default.config .kunit/.kunitconfig

그 뒤 다른 Kconfig option을 추가할 수 있습니다.

CONFIG_LIST_KUNIT_TEST=y

kunit_tool은 테스트 실행 전에 `.kunitconfig`의 모든 option이 kernel `.config`에 설정되었는지 확인하고 dependency option이 빠졌으면 warning을 냅니다.

참고: `.kunitconfig`에서 항목을 제거해도 `.config`를 다시 build하지 않습니다. `.kunitconfig`가 `.config`의 subset이 아닐 때만 configuration을 갱신합니다. 따라서 `make menuconfig` 같은 다른 tool로 나머지 option을 조정할 수 있습니다. Build directory를 지정해야 하므로 기본적으로 `make O=.kunit menuconfig`를 사용합니다.

Config, build, exec 단계 분리

101-130

테스트 구성, build, 실행

KUnit build process를 수동으로 변경하려면 일부 단계를 독립적으로 실행할 수 있습니다. `.kunitconfig`에서 `.config`를 생성하려면 `config` argument를 사용합니다.

./tools/testing/kunit/kunit.py config

현재 `.config`에서 KUnit kernel을 build하려면 `build`를 사용합니다.

./tools/testing/kunit/kunit.py build

Built-in KUnit test를 포함한 UML kernel을 이미 build했다면 `exec`로 kernel을 실행하고 결과를 표시합니다.

./tools/testing/kunit/kunit.py exec

앞에서 설명한 `run` command는 위 세 command를 순서대로 실행한 것과 같습니다.

kunit_tool run pipeline
config.kunitconfig에서 .config 생성과 검증
build현재 .config로 KUnit kernel compile
execUML 또는 선택한 emulator에서 kernel 실행
runconfig → build → exec를 연속 수행

전체 run을 단계별로 분리하면 configuration, build, runtime 중 어느 지점이 실패했는지 확인할 수 있습니다.

결과 parsing과 test filter

131-169

Test result parsing

KUnit test output은 TAP 형식으로 결과를 표시합니다. kunit_tool은 실행 중 이 출력을 parsing해 summary를 출력합니다. Raw TAP 결과를 보려면 `--raw_output`을 전달합니다.

./tools/testing/kunit/kunit.py run --raw_output

Raw TAP 형식의 KUnit 결과가 있다면 kunit_tool의 `parse` command로 사람이 읽을 수 있는 summary를 출력할 수 있습니다. Filename argument를 받거나 standard input에서 읽습니다.

# Reading from a file
./tools/testing/kunit/kunit.py parse /var/log/dmesg
# Reading from stdin
dmesg | ./tools/testing/kunit/kunit.py parse

Test filtering

`exec` 또는 `run` command에 bash style glob filter를 전달하면 kernel에 build된 테스트 일부만 실행할 수 있습니다. KUnit resource test만 실행하는 예는 다음과 같습니다.

./tools/testing/kunit/kunit.py run 'kunit-resource*'

Wildcard character를 사용하는 표준 glob 형식을 사용합니다.

QEMU와 cross compilation

170-235

QEMU에서 테스트 실행

원문의 `kunit-on-qemu` anchor는 이 QEMU 실행 절을 가리킵니다.

kunit_tool은 UML뿐 아니라 QEMU에서도 테스트 실행을 지원합니다. 기본적으로 QEMU 실행에는 `--arch`와 `--cross_compile` 두 flag가 필요합니다.

`--arch`는 지정 architecture에서 KUnit test를 최소 구성으로 실행할 수 있게 하는 Kconfig와 QEMU option 등의 config collection을 선택합니다. Argument는 Kbuild의 ARCH variable에 전달하는 option 이름과 같습니다.

모든 architecture가 이 flag를 지원하는 것은 아니며 이 경우 `--qemu_config`를 사용할 수 있습니다. `um`을 전달하거나 flag를 생략하면 UML에서 실행하고 i386, x86_64, arm 같은 non-UML architecture는 QEMU에서 실행합니다. `--arch help`는 유효한 값을 나열합니다.

`--cross_compile`은 Kbuild toolchain을 지정하며 Kbuild의 CROSS_COMPILE variable과 같은 argument를 전달합니다. GCC 같은 toolchain binary의 prefix입니다. 예를 들어 설치된 sparc toolchain은 `sparc64-linux-gnu`, home의 toolchains 디렉터리에 받은 microblaze toolchain은 `$HOME/toolchains/microblaze/gcc-9.2.0-nolibc/microblaze-linux/bin/microblaze-linux`를 사용할 수 있습니다.

대부분의 architecture는 QEMU에서 다음처럼 간단히 실행합니다.

./tools/testing/kunit/kunit.py run --arch=x86_64

Cross-compilation에는 다른 toolchain을 지정해야 할 수 있습니다.

./tools/testing/kunit/kunit.py run \
        --arch=s390 \
        --cross_compile=s390x-linux-gnu-

`--arch`가 지원하지 않는 architecture에서 실행하거나 non-default QEMU configuration을 쓰려면 custom `QemuConfig`를 작성합니다. Python file 맨 위에서 `from..qemu_config import QemuArchParams`를 import하고 `QemuArchParams` instance를 할당한 `QEMU_ARCH` variable을 포함해야 합니다. 예는 `tools/testing/kunit/qemu_configs/x86_64.py`입니다.

작성한 QemuConfig는 `--qemu_config` flag로 전달하며 이 flag는 `--arch`를 대체합니다.

./tools/testing/kunit/kunit.py run \
        --timeout=60 \
        --jobs=12 \
        --qemu_config=./tools/testing/kunit/qemu_configs/x86_64.py
kunit_tool 실행 환경 선택
--arch 생략 또는 umUML 실행
지원되는 non-UML --arch기본 QEMU config 선택
Cross architecture--cross_compile toolchain prefix 추가
Custom 환경--qemu_config가 --arch를 대체

Architecture flag와 custom QemuConfig에 따라 UML 또는 QEMU 실행 경로가 결정됩니다.

주요 command-line argument

236-337

Command-line argument 실행

kunit_tool은 test environment에 유용한 여러 command-line argument를 제공합니다. 주요 argument는 다음과 같습니다.

`--help`: 사용 가능한 option을 나열합니다. Command 앞에 두면 공통 option, 뒤에 두면 해당 command 전용 option을 표시합니다. `config`, `build`, `run` 등은 지원 option이 서로 다릅니다.

`--build_dir`: `.kunitconfig`, `.config`, compile된 kernel을 포함하는 kunit_tool build directory를 지정합니다.

`--make_options`: `build`나 `run`으로 kernel을 compile할 때 make에 전달할 추가 option을 지정합니다. Compiler warning을 켜려면 `--make_options W=1`을 사용합니다.

`--alltests`: 가능한 많은 테스트를 build하도록 미리 정의된 option set을 활성화합니다. Option 목록은 `tools/testing/kunit/configs/all_tests.config`에 있습니다. Dependency가 이미 충족된 모든 테스트만 켜려면 `.kunitconfig`에 `CONFIG_KUNIT_ALL_TESTS=y`를 추가합니다.

`--kunitconfig`: `.kunitconfig` file 경로나 이를 포함한 directory를 지정합니다. 예를 들어 `lib/kunit/.kunitconfig` 또는 `lib/kunit`입니다. 특정 subsystem의 test와 dependency처럼 미리 정의한 set으로 build하고 실행할 때 사용합니다.

`--kconfig_add`: `.kunitconfig`에 덧붙일 추가 configuration option을 지정합니다.

./tools/testing/kunit/kunit.py run --kconfig_add CONFIG_KASAN=y

`--arch`: Kbuild ARCH environment variable과 같은 architecture를 지정합니다. 예: i386, x86_64, arm, um. Non-UML은 QEMU에서 실행하며 기본값은 `um`입니다.

`--cross_compile`: Kbuild CROSS_COMPILE과 같은 toolchain prefix를 지정합니다. 예: `sparc64-linux-gnu-` 또는 `$HOME/toolchains/microblaze/gcc-9.2.0-nolibc/microblaze-linux/bin/microblaze-linux`.

`--qemu_config`: custom QEMU architecture 정의를 담은 Python file 경로를 지정합니다. File은 `QemuArchParams` object를 포함해야 합니다.

`--qemu_args`: `-smp 8` 같은 추가 QEMU argument를 지정합니다.

`--jobs`: 동시에 실행할 job 또는 command 수입니다. 기본값은 system core 수입니다.

`--timeout`: 모든 테스트에 허용되는 최대 실행 초입니다. Test build 시간은 포함하지 않습니다.

`--kernel_args`: 추가 kernel command-line argument이며 여러 번 지정할 수 있습니다.

`--run_isolated`: 개별 suite 또는 test마다 kernel을 boot합니다. 앞서 실행된 항목에 따라 성공과 실패가 달라지는 non-hermetic test를 디버깅할 때 유용합니다.

`--raw_output`: format하지 않은 kernel output을 생성합니다. `all`은 전체 kernel output을 표시하고 기본값인 `kunit`은 KUnit output만 filtering합니다. `--raw_output`, `--raw_output=kunit`, `--raw_output=all`을 사용할 수 있습니다.

`--json`: test result를 JSON 형식으로 저장해 stdout에 출력하거나 filename을 지정했다면 file에 저장합니다.

`--filter`: `speed!=slow` 같은 test attribute filter를 지정합니다. 여러 filter는 quote 안에서 comma로 구분합니다. 예: `--filter "speed>slow, module=example"`.

`--filter_action`: `skip`이면 filter된 테스트를 출력에서 숨기지 않고 skipped로 표시합니다.

`--list_tests`: 실행할 모든 테스트를 나열합니다.

`--list_tests_attr`: 실행할 모든 테스트와 각 테스트의 모든 attribute를 나열합니다.

kunit_tool option 그룹
그룹대표 option목적
구성--kunitconfig, --kconfig_add, --alltestsTest와 dependency 선택
Build--build_dir, --make_options, --jobsOutput과 compile 제어
Architecture--arch, --cross_compile, --qemu_configUML·QEMU·toolchain 선택
실행--timeout, --kernel_args, --run_isolatedRuntime와 격리 제어
출력--raw_output, --jsonLog와 result 형식 선택
Filter--filter, --filter_action, --list_tests_attr실행 대상과 표시 범위

긴 option 목록을 구성, build, 실행, 출력과 선택이라는 작업별로 묶었습니다.