xref: /kvm-unit-tests/docs/unittests.txt (revision 3dbf3c405853c55b231b4ee0d64036f257f6ed09)
1unittests
2*********
3
4run_tests.sh is driven by the <arch>/unittests.cfg file. That file defines
5test cases by specifying an executable (target image) under the <arch>/
6directory, and how to run it. This way, for example, a single file can
7provide multiple test cases by being run with different host configurations
8and/or different parameters passed to it.
9
10Detailed output from run_tests.sh unit tests are stored in files under
11the logs/ directory.
12
13unittests.cfg format
14====================
15
16# is the comment symbol, all following contents of the line is ignored.
17
18Each unit test is defined with a [unit-test-name] line, followed by
19a set of parameters that control how the test case is run. The name is
20arbitrary and appears in the status reporting output.
21
22Parameters appear on their own lines under the test name, and have a
23param = value format.
24
25Available parameters
26====================
27Note! Some parameters like smp and extra_params modify how a test is run,
28while others like arch and accel restrict the configurations in which the
29test is run.
30
31file
32----
33file = <filename>
34
35This parameter is mandatory and specifies which binary under the <arch>/
36directory to run. Typically this is <name>.flat or <name>.elf, depending
37on the arch. The directory name is not included, only the file name.
38
39arch
40----
41For <arch>/ directories that support multiple architectures, this restricts
42the test to the specified arch. By default, the test will run on any
43architecture.
44
45smp
46---
47smp = <number>
48
49Optional, the number of processors created in the machine to run the test.
50Defaults to 1. $MAX_SMP can be used to specify the maximum supported.
51
52extra_params
53------------
54These are extra parameters supplied to the QEMU process. -append '...' can
55be used to pass arguments into the test case argv. Multiple parameters can
56be added, for example:
57
58extra_params = -m 256 -append 'smp=2'
59
60groups
61------
62groups = <group_name1> <group_name2> ...
63
64Used to group the test cases for the `run_tests.sh -g ...` run group
65option. Adding a test to the nodefault group will cause it to not be
66run by default.
67
68accel
69-----
70accel = kvm|tcg
71
72This restricts the test to the specified accelerator. By default, the
73test will run on either accelerator. (Note, the accelerator can be
74specified with ACCEL= environment variable, and defaults to KVM if
75available).
76
77timeout
78-------
79timeout = <duration>
80
81Optional timeout in seconds, after which the test will be killed and fail.
82
83check
84-----
85check = <path>=<<value>
86
87Check a file for a particular value before running a test. The check line
88can contain multiple files to check separated by a space, but each check
89parameter needs to be of the form <path>=<value>
90