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