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 qemu_params/extra_params modify how a 28test is run, while others like arch and accel restrict the configurations 29in which the test 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 45machine 46------- 47For those architectures that support multiple machine types, this restricts 48the test to the specified machine. By default, the test will run on 49any machine type. (Note, the machine can be specified with the MACHINE= 50environment variable, and defaults to the architecture's default.) 51 52smp 53--- 54smp = <number> 55 56Optional, the number of processors created in the machine to run the test. 57Defaults to 1. $MAX_SMP can be used to specify the maximum supported. 58 59qemu_params 60------------ 61These are extra parameters supplied to the QEMU process. -append '...' can 62be used to pass arguments into the test case argv. Multiple parameters can 63be added, for example: 64 65qemu_params = -m 256 -append 'smp=2' 66 67extra_params 68------------ 69Alias for 'qemu_params', supported for compatibility purposes. Use 70'qemu_params' for new tests. 71 72groups 73------ 74groups = <group_name1> <group_name2> ... 75 76Used to group the test cases for the `run_tests.sh -g ...` run group 77option. The group name is arbitrary, except for these special groups: 78- Tests in the "nodefault" group are not run by default (with no -g option). 79- Tests in the "migration" group are run with the migration harness and 80 are expected to make migrate_*() calls. 81- Tests in the "panic" group expect QEMU to enter the GUEST_PANICKED state. 82 83accel 84----- 85accel = kvm|tcg 86 87This restricts the test to the specified accelerator. By default, the 88test will run on either accelerator. (Note, the accelerator can be 89specified with ACCEL= environment variable, and defaults to KVM if 90available). 91 92timeout 93------- 94timeout = <duration> 95 96Optional timeout in seconds, after which the test will be killed and fail. 97 98check 99----- 100check = <path>=<value> 101 102Check a file for a particular value before running a test. The check line 103can contain multiple files to check separated by a space, but each check 104parameter needs to be of the form <path>=<value> 105 106The path and value cannot contain space, =, or shell wildcard characters. 107