1slow_qtests = { 2 'aspeed_smc-test': 360, 3 'bios-tables-test' : 540, 4 'device-introspect-test' : 720, 5 'migration-test' : 480, 6 'npcm7xx_pwm-test': 300, 7 'npcm7xx_watchdog_timer-test': 120, 8 'qom-test' : 900, 9 'test-hmp' : 240, 10 'pxe-test': 600, 11 'prom-env-test': 360, 12 'boot-serial-test': 240, 13 'qos-test': 120, 14} 15 16qtests_generic = [ 17 'cdrom-test', 18 'device-introspect-test', 19 'machine-none-test', 20 'qmp-test', 21 'qmp-cmd-test', 22 'qom-test', 23 'test-hmp', 24 'qos-test', 25 'readconfig-test', 26 'netdev-socket', 27] 28if enable_modules 29 qtests_generic += [ 'modules-test' ] 30endif 31 32qtests_pci = \ 33 (config_all_devices.has_key('CONFIG_VGA') ? ['display-vga-test'] : []) + \ 34 (config_all_devices.has_key('CONFIG_IVSHMEM_DEVICE') ? ['ivshmem-test'] : []) 35 36qtests_cxl = \ 37 (config_all_devices.has_key('CONFIG_CXL') ? ['cxl-test'] : []) 38 39# FIXME: Get rid of get_option('default_devices') here and check 40# for the availability of the default NICs in the tests 41qtests_filter = \ 42 (get_option('default_devices') and slirp.found() ? ['test-netfilter'] : []) + \ 43 (get_option('default_devices') and host_os != 'windows' ? ['test-filter-mirror'] : []) + \ 44 (get_option('default_devices') and host_os != 'windows' ? ['test-filter-redirector'] : []) 45 46qtests_i386 = \ 47 (slirp.found() ? ['pxe-test'] : []) + \ 48 qtests_filter + \ 49 (have_tools ? ['ahci-test'] : []) + \ 50 (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : []) + \ 51 (config_all_devices.has_key('CONFIG_SGA') ? ['boot-serial-test'] : []) + \ 52 (config_all_devices.has_key('CONFIG_ISA_IPMI_KCS') ? ['ipmi-kcs-test'] : []) + \ 53 (host_os == 'linux' and \ 54 config_all_devices.has_key('CONFIG_ISA_IPMI_BT') and 55 config_all_devices.has_key('CONFIG_IPMI_EXTERN') ? ['ipmi-bt-test'] : []) + \ 56 (config_all_devices.has_key('CONFIG_WDT_IB700') ? ['wdt_ib700-test'] : []) + \ 57 (config_all_devices.has_key('CONFIG_PVPANIC_ISA') ? ['pvpanic-test'] : []) + \ 58 (config_all_devices.has_key('CONFIG_PVPANIC_PCI') ? ['pvpanic-pci-test'] : []) + \ 59 (config_all_devices.has_key('CONFIG_HDA') ? ['intel-hda-test'] : []) + \ 60 (config_all_devices.has_key('CONFIG_I82801B11') ? ['i82801b11-test'] : []) + \ 61 (config_all_devices.has_key('CONFIG_IOH3420') ? ['ioh3420-test'] : []) + \ 62 (config_all_devices.has_key('CONFIG_LPC_ICH9') ? ['lpc-ich9-test'] : []) + \ 63 (config_all_devices.has_key('CONFIG_USB_UHCI') ? ['usb-hcd-uhci-test'] : []) + \ 64 (config_all_devices.has_key('CONFIG_USB_UHCI') and \ 65 config_all_devices.has_key('CONFIG_USB_EHCI') ? ['usb-hcd-ehci-test'] : []) + \ 66 (config_all_devices.has_key('CONFIG_USB_XHCI_NEC') ? ['usb-hcd-xhci-test'] : []) + \ 67 (config_all_devices.has_key('CONFIG_TPM_CRB') ? ['tpm-crb-test'] : []) + \ 68 (config_all_devices.has_key('CONFIG_TPM_CRB') ? ['tpm-crb-swtpm-test'] : []) + \ 69 (config_all_devices.has_key('CONFIG_TPM_TIS_ISA') ? ['tpm-tis-test'] : []) + \ 70 (config_all_devices.has_key('CONFIG_TPM_TIS_ISA') ? ['tpm-tis-swtpm-test'] : []) + \ 71 (config_all_devices.has_key('CONFIG_RTL8139_PCI') ? ['rtl8139-test'] : []) + \ 72 (config_all_devices.has_key('CONFIG_E1000E_PCI_EXPRESS') ? ['fuzz-e1000e-test'] : []) + \ 73 (config_all_devices.has_key('CONFIG_MEGASAS_SCSI_PCI') ? ['fuzz-megasas-test'] : []) + \ 74 (config_all_devices.has_key('CONFIG_LSI_SCSI_PCI') ? ['fuzz-lsi53c895a-test'] : []) + \ 75 (config_all_devices.has_key('CONFIG_VIRTIO_SCSI') ? ['fuzz-virtio-scsi-test'] : []) + \ 76 (config_all_devices.has_key('CONFIG_SB16') ? ['fuzz-sb16-test'] : []) + \ 77 (config_all_devices.has_key('CONFIG_SDHCI_PCI') ? ['fuzz-sdcard-test'] : []) + \ 78 (config_all_devices.has_key('CONFIG_ESP_PCI') ? ['am53c974-test'] : []) + \ 79 (host_os != 'windows' and \ 80 config_all_devices.has_key('CONFIG_ACPI_ERST') ? ['erst-test'] : []) + \ 81 (config_all_devices.has_key('CONFIG_PCIE_PORT') and \ 82 config_all_devices.has_key('CONFIG_VIRTIO_NET') and \ 83 config_all_devices.has_key('CONFIG_Q35') and \ 84 config_all_devices.has_key('CONFIG_VIRTIO_PCI') and \ 85 slirp.found() ? ['virtio-net-failover'] : []) + \ 86 (unpack_edk2_blobs and \ 87 config_all_devices.has_key('CONFIG_HPET') and \ 88 config_all_devices.has_key('CONFIG_PARALLEL') ? ['bios-tables-test'] : []) + \ 89 qtests_pci + \ 90 qtests_cxl + \ 91 ['fdc-test', 92 'ide-test', 93 'hd-geo-test', 94 'boot-order-test', 95 'rtc-test', 96 'i440fx-test', 97 'fw_cfg-test', 98 'device-plug-test', 99 'drive_del-test', 100 'tco-test', 101 'cpu-plug-test', 102 'q35-test', 103 'vmgenid-test', 104 'migration-test', 105 'test-x86-cpuid-compat', 106 'numa-test' 107 ] 108 109if dbus_display 110 qtests_i386 += ['dbus-display-test'] 111endif 112 113dbus_daemon = find_program('dbus-daemon', required: false) 114if dbus_daemon.found() and gdbus_codegen.found() 115 # Temporarily disabled due to Patchew failures: 116 #qtests_i386 += ['dbus-vmstate-test'] 117 dbus_vmstate1 = custom_target('dbus-vmstate description', 118 output: ['dbus-vmstate1.h', 'dbus-vmstate1.c'], 119 input: meson.project_source_root() / 'backends/dbus-vmstate1.xml', 120 command: [gdbus_codegen, '@INPUT@', 121 '--interface-prefix', 'org.qemu', 122 '--generate-c-code', '@BASENAME@']).to_list() 123else 124 dbus_vmstate1 = [] 125endif 126 127qtests_x86_64 = qtests_i386 128 129qtests_alpha = ['boot-serial-test'] + \ 130 qtests_filter + \ 131 (config_all_devices.has_key('CONFIG_VGA') ? ['display-vga-test'] : []) 132 133qtests_avr = [ 'boot-serial-test' ] 134 135qtests_hppa = ['boot-serial-test'] + \ 136 qtests_filter + \ 137 (config_all_devices.has_key('CONFIG_VGA') ? ['display-vga-test'] : []) 138 139qtests_m68k = ['boot-serial-test'] + \ 140 qtests_filter 141 142qtests_microblaze = ['boot-serial-test'] + \ 143 qtests_filter 144 145qtests_microblazeel = qtests_microblaze 146 147qtests_mips = \ 148 qtests_filter + \ 149 (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : []) + \ 150 (config_all_devices.has_key('CONFIG_VGA') ? ['display-vga-test'] : []) 151 152qtests_mipsel = qtests_mips 153qtests_mips64 = qtests_mips 154qtests_mips64el = qtests_mips 155 156qtests_ppc = \ 157 qtests_filter + \ 158 (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : []) + \ 159 (config_all_devices.has_key('CONFIG_M48T59') ? ['m48t59-test'] : []) + \ 160 (config_all_accel.has_key('CONFIG_TCG') ? ['prom-env-test'] : []) + \ 161 (config_all_accel.has_key('CONFIG_TCG') ? ['boot-serial-test'] : []) + \ 162 ['boot-order-test'] 163 164qtests_ppc64 = \ 165 qtests_ppc + \ 166 (config_all_devices.has_key('CONFIG_PSERIES') ? ['device-plug-test'] : []) + \ 167 (config_all_devices.has_key('CONFIG_POWERNV') ? ['pnv-xscom-test'] : []) + \ 168 (config_all_devices.has_key('CONFIG_PSERIES') ? ['rtas-test'] : []) + \ 169 (slirp.found() ? ['pxe-test'] : []) + \ 170 (config_all_devices.has_key('CONFIG_USB_UHCI') ? ['usb-hcd-uhci-test'] : []) + \ 171 (config_all_devices.has_key('CONFIG_USB_XHCI_NEC') ? ['usb-hcd-xhci-test'] : []) + \ 172 qtests_pci + ['migration-test', 'numa-test', 'cpu-plug-test', 'drive_del-test'] 173 174qtests_sh4 = (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : []) 175qtests_sh4eb = (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : []) 176 177qtests_sparc = ['prom-env-test', 'm48t59-test', 'boot-serial-test'] + \ 178 qtests_filter 179 180qtests_sparc64 = \ 181 (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : []) + \ 182 qtests_filter + \ 183 ['prom-env-test', 'boot-serial-test'] 184 185qtests_npcm7xx = \ 186 ['npcm7xx_adc-test', 187 'npcm7xx_gpio-test', 188 'npcm7xx_pwm-test', 189 'npcm7xx_rng-test', 190 'npcm7xx_sdhci-test', 191 'npcm7xx_smbus-test', 192 'npcm7xx_timer-test', 193 'npcm7xx_watchdog_timer-test'] + \ 194 (slirp.found() ? ['npcm7xx_emc-test'] : []) 195qtests_aspeed = \ 196 ['aspeed_hace-test', 197 'aspeed_smc-test', 198 'aspeed_gpio-test'] 199 200qtests_stm32l4x5 = \ 201 ['stm32l4x5_exti-test', 202 'stm32l4x5_syscfg-test'] 203 204qtests_arm = \ 205 (config_all_devices.has_key('CONFIG_MPS2') ? ['sse-timer-test'] : []) + \ 206 (config_all_devices.has_key('CONFIG_CMSDK_APB_DUALTIMER') ? ['cmsdk-apb-dualtimer-test'] : []) + \ 207 (config_all_devices.has_key('CONFIG_CMSDK_APB_TIMER') ? ['cmsdk-apb-timer-test'] : []) + \ 208 (config_all_devices.has_key('CONFIG_CMSDK_APB_WATCHDOG') ? ['cmsdk-apb-watchdog-test'] : []) + \ 209 (config_all_devices.has_key('CONFIG_PFLASH_CFI02') and 210 config_all_devices.has_key('CONFIG_MUSICPAL') ? ['pflash-cfi02-test'] : []) + \ 211 (config_all_devices.has_key('CONFIG_ASPEED_SOC') ? qtests_aspeed : []) + \ 212 (config_all_devices.has_key('CONFIG_NPCM7XX') ? qtests_npcm7xx : []) + \ 213 (config_all_devices.has_key('CONFIG_GENERIC_LOADER') ? ['hexloader-test'] : []) + \ 214 (config_all_devices.has_key('CONFIG_TPM_TIS_I2C') ? ['tpm-tis-i2c-test'] : []) + \ 215 (config_all_devices.has_key('CONFIG_VEXPRESS') ? ['test-arm-mptimer'] : []) + \ 216 (config_all_devices.has_key('CONFIG_MICROBIT') ? ['microbit-test'] : []) + \ 217 (config_all_devices.has_key('CONFIG_STM32L4X5_SOC') ? qtests_stm32l4x5 : []) + \ 218 ['arm-cpu-features', 219 'boot-serial-test'] 220 221# TODO: once aarch64 TCG is fixed on ARM 32 bit host, make bios-tables-test unconditional 222qtests_aarch64 = \ 223 (cpu != 'arm' and unpack_edk2_blobs ? ['bios-tables-test'] : []) + \ 224 (config_all_accel.has_key('CONFIG_TCG') and config_all_devices.has_key('CONFIG_TPM_TIS_SYSBUS') ? \ 225 ['tpm-tis-device-test', 'tpm-tis-device-swtpm-test'] : []) + \ 226 (config_all_devices.has_key('CONFIG_XLNX_ZYNQMP_ARM') ? ['xlnx-can-test', 'fuzz-xlnx-dp-test'] : []) + \ 227 (config_all_devices.has_key('CONFIG_XLNX_VERSAL') ? ['xlnx-canfd-test', 'xlnx-versal-trng-test'] : []) + \ 228 (config_all_devices.has_key('CONFIG_RASPI') ? ['bcm2835-dma-test'] : []) + \ 229 (config_all_accel.has_key('CONFIG_TCG') and \ 230 config_all_devices.has_key('CONFIG_TPM_TIS_I2C') ? ['tpm-tis-i2c-test'] : []) + \ 231 ['arm-cpu-features', 232 'numa-test', 233 'boot-serial-test', 234 'migration-test'] 235 236qtests_s390x = \ 237 qtests_filter + \ 238 ['boot-serial-test', 239 'drive_del-test', 240 'device-plug-test', 241 'virtio-ccw-test', 242 'cpu-plug-test', 243 'migration-test'] 244 245qtests_riscv32 = \ 246 (config_all_devices.has_key('CONFIG_SIFIVE_E_AON') ? ['sifive-e-aon-watchdog-test'] : []) 247 248qos_test_ss = ss.source_set() 249qos_test_ss.add( 250 'ac97-test.c', 251 'adm1272-test.c', 252 'adm1266-test.c', 253 'ds1338-test.c', 254 'e1000-test.c', 255 'eepro100-test.c', 256 'es1370-test.c', 257 'ipoctal232-test.c', 258 'lsm303dlhc-mag-test.c', 259 'isl_pmbus_vr-test.c', 260 'max34451-test.c', 261 'megasas-test.c', 262 'ne2000-test.c', 263 'tulip-test.c', 264 'nvme-test.c', 265 'pca9552-test.c', 266 'pci-test.c', 267 'pcnet-test.c', 268 'sdhci-test.c', 269 'spapr-phb-test.c', 270 'tmp105-test.c', 271 'emc141x-test.c', 272 'usb-hcd-ohci-test.c', 273 'virtio-test.c', 274 'virtio-blk-test.c', 275 'virtio-net-test.c', 276 'virtio-rng-test.c', 277 'virtio-scsi-test.c', 278 'virtio-iommu-test.c', 279 'vmxnet3-test.c', 280 'igb-test.c', 281 'ufs-test.c', 282) 283 284if config_all_devices.has_key('CONFIG_VIRTIO_SERIAL') 285 qos_test_ss.add(files('virtio-serial-test.c')) 286endif 287 288if host_os != 'windows' 289 qos_test_ss.add(files('e1000e-test.c')) 290endif 291if have_virtfs 292 qos_test_ss.add(files('virtio-9p-test.c')) 293endif 294if have_vhost_user 295 qos_test_ss.add(files('vhost-user-test.c')) 296endif 297if have_tools and have_vhost_user_blk_server 298 qos_test_ss.add(files('vhost-user-blk-test.c')) 299endif 300 301tpmemu_files = ['tpm-emu.c', 'tpm-util.c', 'tpm-tests.c'] 302 303migration_files = [files('migration-helpers.c')] 304if gnutls.found() 305 migration_files += [files('../unit/crypto-tls-psk-helpers.c'), gnutls] 306 307 if tasn1.found() 308 migration_files += [files('../unit/crypto-tls-x509-helpers.c', 309 '../unit/pkix_asn1_tab.c'), tasn1] 310 endif 311endif 312 313qtests = { 314 'bios-tables-test': [io, 'boot-sector.c', 'acpi-utils.c', 'tpm-emu.c'], 315 'cdrom-test': files('boot-sector.c'), 316 'dbus-vmstate-test': files('migration-helpers.c') + dbus_vmstate1, 317 'erst-test': files('erst-test.c'), 318 'ivshmem-test': [rt, '../../contrib/ivshmem-server/ivshmem-server.c'], 319 'migration-test': migration_files, 320 'pxe-test': files('boot-sector.c'), 321 'qos-test': [chardev, io, qos_test_ss.apply({}).sources()], 322 'tpm-crb-swtpm-test': [io, tpmemu_files], 323 'tpm-crb-test': [io, tpmemu_files], 324 'tpm-tis-swtpm-test': [io, tpmemu_files, 'tpm-tis-util.c'], 325 'tpm-tis-test': [io, tpmemu_files, 'tpm-tis-util.c'], 326 'tpm-tis-i2c-test': [io, tpmemu_files, 'qtest_aspeed.c'], 327 'tpm-tis-device-swtpm-test': [io, tpmemu_files, 'tpm-tis-util.c'], 328 'tpm-tis-device-test': [io, tpmemu_files, 'tpm-tis-util.c'], 329 'virtio-net-failover': files('migration-helpers.c'), 330 'vmgenid-test': files('boot-sector.c', 'acpi-utils.c'), 331 'netdev-socket': files('netdev-socket.c', '../unit/socket-helpers.c'), 332} 333 334if vnc.found() 335 gvnc = dependency('gvnc-1.0', method: 'pkg-config', required: false) 336 if gvnc.found() 337 qtests += {'vnc-display-test': [gvnc]} 338 qtests_generic += [ 'vnc-display-test' ] 339 endif 340endif 341 342if dbus_display 343 qtests += {'dbus-display-test': [dbus_display1, gio]} 344endif 345 346qtest_executables = {} 347foreach dir : target_dirs 348 if not dir.endswith('-softmmu') 349 continue 350 endif 351 352 target_base = dir.split('-')[0] 353 qtest_emulator = emulators['qemu-system-' + target_base] 354 target_qtests = get_variable('qtests_' + target_base, []) + qtests_generic 355 356 test_deps = roms 357 qtest_env = environment() 358 if have_tools 359 qtest_env.set('QTEST_QEMU_IMG', './qemu-img') 360 test_deps += [qemu_img] 361 endif 362 qtest_env.set('G_TEST_DBUS_DAEMON', meson.project_source_root() / 'tests/dbus-vmstate-daemon.sh') 363 qtest_env.set('QTEST_QEMU_BINARY', './qemu-system-' + target_base) 364 if have_tools and have_vhost_user_blk_server 365 qtest_env.set('QTEST_QEMU_STORAGE_DAEMON_BINARY', './storage-daemon/qemu-storage-daemon') 366 test_deps += [qsd] 367 endif 368 369 qtest_env.set('PYTHON', python.full_path()) 370 371 foreach test : target_qtests 372 # Executables are shared across targets, declare them only the first time we 373 # encounter them 374 if not qtest_executables.has_key(test) 375 src = [test + '.c'] 376 deps = [qemuutil, qos] 377 if test in qtests 378 # use a sourceset to quickly separate sources and deps 379 test_ss = ss.source_set() 380 test_ss.add(qtests[test]) 381 src += test_ss.all_sources() 382 deps += test_ss.all_dependencies() 383 endif 384 qtest_executables += { 385 test: executable(test, src, dependencies: deps) 386 } 387 endif 388 test('qtest-@0@/@1@'.format(target_base, test), 389 qtest_executables[test], 390 depends: [test_deps, qtest_emulator, emulator_modules], 391 env: qtest_env, 392 args: ['--tap', '-k'], 393 protocol: 'tap', 394 timeout: slow_qtests.get(test, 60), 395 priority: slow_qtests.get(test, 60), 396 suite: ['qtest', 'qtest-' + target_base]) 397 endforeach 398endforeach 399