1# All QTests for now are POSIX-only, but the dependencies are 2# really in libqtest, not in the testcases themselves. 3if not config_host.has_key('CONFIG_POSIX') 4 subdir_done() 5endif 6 7slow_qtests = { 8 'ahci-test' : 60, 9 'bios-tables-test' : 120, 10 'boot-serial-test' : 60, 11 'migration-test' : 150, 12 'npcm7xx_pwm-test': 150, 13 'prom-env-test' : 60, 14 'pxe-test' : 60, 15 'qos-test' : 60, 16 'qom-test' : 300, 17 'test-hmp' : 120, 18} 19 20qtests_generic = [ 21 'cdrom-test', 22 'device-introspect-test', 23 'machine-none-test', 24 'qmp-test', 25 'qmp-cmd-test', 26 'qom-test', 27 'test-hmp', 28 'qos-test', 29] 30if config_host.has_key('CONFIG_MODULES') 31 qtests_generic += [ 'modules-test' ] 32endif 33if slirp.found() 34 qtests_generic += [ 'test-query-netdev' ] 35endif 36 37qtests_pci = \ 38 (config_all_devices.has_key('CONFIG_VGA') ? ['display-vga-test'] : []) + \ 39 (config_all_devices.has_key('CONFIG_IVSHMEM_DEVICE') ? ['ivshmem-test'] : []) 40 41qtests_i386 = \ 42 (slirp.found() ? ['pxe-test', 'test-netfilter'] : []) + \ 43 (config_host.has_key('CONFIG_POSIX') ? ['test-filter-mirror'] : []) + \ 44 (have_tools ? ['ahci-test'] : []) + \ 45 (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : []) + \ 46 (config_all_devices.has_key('CONFIG_SGA') ? ['boot-serial-test'] : []) + \ 47 (config_all_devices.has_key('CONFIG_RTL8139_PCI') ? ['test-filter-redirector'] : []) + \ 48 (config_all_devices.has_key('CONFIG_ISA_IPMI_KCS') ? ['ipmi-kcs-test'] : []) + \ 49 (config_host.has_key('CONFIG_LINUX') and \ 50 config_all_devices.has_key('CONFIG_ISA_IPMI_BT') ? ['ipmi-bt-test'] : []) + \ 51 (config_all_devices.has_key('CONFIG_WDT_IB700') ? ['wdt_ib700-test'] : []) + \ 52 (config_all_devices.has_key('CONFIG_PVPANIC_ISA') ? ['pvpanic-test'] : []) + \ 53 (config_all_devices.has_key('CONFIG_PVPANIC_PCI') ? ['pvpanic-pci-test'] : []) + \ 54 (config_all_devices.has_key('CONFIG_HDA') ? ['intel-hda-test'] : []) + \ 55 (config_all_devices.has_key('CONFIG_I82801B11') ? ['i82801b11-test'] : []) + \ 56 (config_all_devices.has_key('CONFIG_IOH3420') ? ['ioh3420-test'] : []) + \ 57 (config_all_devices.has_key('CONFIG_USB_UHCI') ? ['usb-hcd-uhci-test'] : []) + \ 58 (config_all_devices.has_key('CONFIG_USB_UHCI') and \ 59 config_all_devices.has_key('CONFIG_USB_EHCI') ? ['usb-hcd-ehci-test'] : []) + \ 60 (config_all_devices.has_key('CONFIG_USB_XHCI_NEC') ? ['usb-hcd-xhci-test'] : []) + \ 61 (config_all_devices.has_key('CONFIG_TPM_CRB') ? ['tpm-crb-test'] : []) + \ 62 (config_all_devices.has_key('CONFIG_TPM_CRB') ? ['tpm-crb-swtpm-test'] : []) + \ 63 (config_all_devices.has_key('CONFIG_TPM_TIS_ISA') ? ['tpm-tis-test'] : []) + \ 64 (config_all_devices.has_key('CONFIG_TPM_TIS_ISA') ? ['tpm-tis-swtpm-test'] : []) + \ 65 (config_all_devices.has_key('CONFIG_RTL8139_PCI') ? ['rtl8139-test'] : []) + \ 66 qtests_pci + \ 67 ['fdc-test', 68 'ide-test', 69 'hd-geo-test', 70 'boot-order-test', 71 'bios-tables-test', 72 'rtc-test', 73 'i440fx-test', 74 'fuzz-test', 75 'fw_cfg-test', 76 'device-plug-test', 77 'drive_del-test', 78 'tco-test', 79 'cpu-plug-test', 80 'q35-test', 81 'vmgenid-test', 82 'migration-test', 83 'test-x86-cpuid-compat', 84 'numa-test'] 85 86dbus_daemon = find_program('dbus-daemon', required: false) 87if dbus_daemon.found() and config_host.has_key('GDBUS_CODEGEN') 88 # Temporarily disabled due to Patchew failures: 89 #qtests_i386 += ['dbus-vmstate-test'] 90 dbus_vmstate1 = custom_target('dbus-vmstate description', 91 output: ['dbus-vmstate1.h', 'dbus-vmstate1.c'], 92 input: files('dbus-vmstate1.xml'), 93 command: [config_host['GDBUS_CODEGEN'], 94 '@INPUT@', 95 '--interface-prefix', 'org.qemu', 96 '--generate-c-code', '@BASENAME@']).to_list() 97else 98 dbus_vmstate1 = [] 99endif 100 101qtests_x86_64 = qtests_i386 102 103qtests_alpha = [ 'boot-serial-test' ] + \ 104 (config_all_devices.has_key('CONFIG_VGA') ? ['display-vga-test'] : []) 105 106qtests_avr = [ 'boot-serial-test' ] 107 108qtests_hppa = [ 'boot-serial-test' ] + \ 109 (config_all_devices.has_key('CONFIG_VGA') ? ['display-vga-test'] : []) 110 111qtests_m68k = [ 'boot-serial-test' ] 112qtests_microblaze = [ 'boot-serial-test' ] 113qtests_microblazeel = qtests_microblaze 114 115qtests_mips = \ 116 (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : []) + \ 117 (config_all_devices.has_key('CONFIG_VGA') ? ['display-vga-test'] : []) 118 119qtests_mips64 = \ 120 (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : []) + \ 121 (config_all_devices.has_key('CONFIG_VGA') ? ['display-vga-test'] : []) 122 123qtests_mips64el = \ 124 (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : []) + \ 125 (config_all_devices.has_key('CONFIG_VGA') ? ['display-vga-test'] : []) 126 127qtests_moxie = [ 'boot-serial-test' ] 128 129qtests_ppc = \ 130 (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : []) + \ 131 (config_all_devices.has_key('CONFIG_M48T59') ? ['m48t59-test'] : []) + \ 132 ['boot-order-test', 'prom-env-test', 'boot-serial-test'] \ 133 134qtests_ppc64 = \ 135 (config_all_devices.has_key('CONFIG_PSERIES') ? ['device-plug-test'] : []) + \ 136 (config_all_devices.has_key('CONFIG_POWERNV') ? ['pnv-xscom-test'] : []) + \ 137 (config_all_devices.has_key('CONFIG_PSERIES') ? ['rtas-test'] : []) + \ 138 (slirp.found() ? ['pxe-test', 'test-netfilter'] : []) + \ 139 (config_all_devices.has_key('CONFIG_USB_UHCI') ? ['usb-hcd-uhci-test'] : []) + \ 140 (config_all_devices.has_key('CONFIG_USB_XHCI_NEC') ? ['usb-hcd-xhci-test'] : []) + \ 141 (config_host.has_key('CONFIG_POSIX') ? ['test-filter-mirror'] : []) + \ 142 qtests_pci + ['migration-test', 'numa-test', 'cpu-plug-test', 'drive_del-test'] 143 144qtests_sh4 = (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : []) 145qtests_sh4eb = (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : []) 146 147qtests_sparc = ['prom-env-test', 'm48t59-test', 'boot-serial-test'] 148 149qtests_sparc64 = \ 150 (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : []) + \ 151 ['prom-env-test', 'boot-serial-test'] 152 153qtests_npcm7xx = \ 154 ['npcm7xx_adc-test', 155 'npcm7xx_gpio-test', 156 'npcm7xx_pwm-test', 157 'npcm7xx_rng-test', 158 'npcm7xx_smbus-test', 159 'npcm7xx_timer-test', 160 'npcm7xx_watchdog_timer-test'] + \ 161 (slirp.found() ? ['npcm7xx_emc-test'] : []) 162qtests_arm = \ 163 (config_all_devices.has_key('CONFIG_MPS2') ? ['sse-timer-test'] : []) + \ 164 (config_all_devices.has_key('CONFIG_CMSDK_APB_DUALTIMER') ? ['cmsdk-apb-dualtimer-test'] : []) + \ 165 (config_all_devices.has_key('CONFIG_CMSDK_APB_TIMER') ? ['cmsdk-apb-timer-test'] : []) + \ 166 (config_all_devices.has_key('CONFIG_CMSDK_APB_WATCHDOG') ? ['cmsdk-apb-watchdog-test'] : []) + \ 167 (config_all_devices.has_key('CONFIG_PFLASH_CFI02') ? ['pflash-cfi02-test'] : []) + \ 168 (config_all_devices.has_key('CONFIG_NPCM7XX') ? qtests_npcm7xx : []) + \ 169 ['arm-cpu-features', 170 'microbit-test', 171 'm25p80-test', 172 'test-arm-mptimer', 173 'boot-serial-test', 174 'hexloader-test'] 175 176# TODO: once aarch64 TCG is fixed on ARM 32 bit host, make bios-tables-test unconditional 177qtests_aarch64 = \ 178 (cpu != 'arm' ? ['bios-tables-test'] : []) + \ 179 (config_all_devices.has_key('CONFIG_TPM_TIS_SYSBUS') ? ['tpm-tis-device-test'] : []) + \ 180 (config_all_devices.has_key('CONFIG_TPM_TIS_SYSBUS') ? ['tpm-tis-device-swtpm-test'] : []) + \ 181 ['arm-cpu-features', 182 'numa-test', 183 'boot-serial-test', 184 'xlnx-can-test', 185 'migration-test'] 186 187qtests_s390x = \ 188 (slirp.found() ? ['pxe-test', 'test-netfilter'] : []) + \ 189 (config_host.has_key('CONFIG_POSIX') ? ['test-filter-mirror'] : []) + \ 190 (config_host.has_key('CONFIG_POSIX') ? ['test-filter-redirector'] : []) + \ 191 ['boot-serial-test', 192 'drive_del-test', 193 'device-plug-test', 194 'virtio-ccw-test', 195 'cpu-plug-test', 196 'migration-test'] 197 198qos_test_ss = ss.source_set() 199qos_test_ss.add( 200 'ac97-test.c', 201 'ds1338-test.c', 202 'e1000-test.c', 203 'e1000e-test.c', 204 'eepro100-test.c', 205 'es1370-test.c', 206 'ipoctal232-test.c', 207 'megasas-test.c', 208 'ne2000-test.c', 209 'tulip-test.c', 210 'nvme-test.c', 211 'pca9552-test.c', 212 'pci-test.c', 213 'pcnet-test.c', 214 'sdhci-test.c', 215 'spapr-phb-test.c', 216 'tmp105-test.c', 217 'emc141x-test.c', 218 'usb-hcd-ohci-test.c', 219 'virtio-test.c', 220 'virtio-blk-test.c', 221 'virtio-net-test.c', 222 'virtio-rng-test.c', 223 'virtio-scsi-test.c', 224 'virtio-serial-test.c', 225 'vmxnet3-test.c', 226) 227if have_virtfs 228 qos_test_ss.add(files('virtio-9p-test.c')) 229endif 230qos_test_ss.add(when: 'CONFIG_VHOST_USER', if_true: files('vhost-user-test.c')) 231 232tpmemu_files = ['tpm-emu.c', 'tpm-util.c', 'tpm-tests.c'] 233 234qtests = { 235 'bios-tables-test': [io, 'boot-sector.c', 'acpi-utils.c', 'tpm-emu.c'], 236 'cdrom-test': files('boot-sector.c'), 237 'dbus-vmstate-test': files('migration-helpers.c') + dbus_vmstate1, 238 'ivshmem-test': [rt, '../../contrib/ivshmem-server/ivshmem-server.c'], 239 'migration-test': files('migration-helpers.c'), 240 'pxe-test': files('boot-sector.c'), 241 'qos-test': [chardev, io, qos_test_ss.apply(config_host, strict: false).sources()], 242 'tpm-crb-swtpm-test': [io, tpmemu_files], 243 'tpm-crb-test': [io, tpmemu_files], 244 'tpm-tis-swtpm-test': [io, tpmemu_files, 'tpm-tis-util.c'], 245 'tpm-tis-test': [io, tpmemu_files, 'tpm-tis-util.c'], 246 'tpm-tis-device-swtpm-test': [io, tpmemu_files, 'tpm-tis-util.c'], 247 'tpm-tis-device-test': [io, tpmemu_files, 'tpm-tis-util.c'], 248 'vmgenid-test': files('boot-sector.c', 'acpi-utils.c'), 249} 250 251qtest_executables = {} 252foreach dir : target_dirs 253 if not dir.endswith('-softmmu') 254 continue 255 endif 256 257 target_base = dir.split('-')[0] 258 qtest_emulator = emulators['qemu-system-' + target_base] 259 target_qtests = get_variable('qtests_' + target_base, []) + qtests_generic 260 261 test_deps = [] 262 qtest_env = environment() 263 if have_tools 264 qtest_env.set('QTEST_QEMU_IMG', './qemu-img') 265 test_deps += [qemu_img] 266 endif 267 qtest_env.set('G_TEST_DBUS_DAEMON', meson.source_root() / 'tests/dbus-vmstate-daemon.sh') 268 qtest_env.set('QTEST_QEMU_BINARY', './qemu-system-' + target_base) 269 270 foreach test : target_qtests 271 # Executables are shared across targets, declare them only the first time we 272 # encounter them 273 if not qtest_executables.has_key(test) 274 src = [test + '.c'] 275 deps = [qemuutil, qos] 276 if test in qtests 277 # use a sourceset to quickly separate sources and deps 278 test_ss = ss.source_set() 279 test_ss.add(qtests[test]) 280 src += test_ss.all_sources() 281 deps += test_ss.all_dependencies() 282 endif 283 qtest_executables += { 284 test: executable(test, src, dependencies: deps) 285 } 286 endif 287 # FIXME: missing dependency on the emulator binary and qemu-img 288 test('qtest-@0@/@1@'.format(target_base, test), 289 qtest_executables[test], 290 depends: [test_deps, qtest_emulator], 291 env: qtest_env, 292 args: ['--tap', '-k'], 293 protocol: 'tap', 294 timeout: slow_qtests.get(test, 30), 295 priority: slow_qtests.get(test, 30), 296 suite: ['qtest', 'qtest-' + target_base]) 297 endforeach 298endforeach 299