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