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 (config_all_devices.has_key('CONFIG_MEGASAS_SCSI_PCI') ? ['fuzz-megasas-test'] : []) + \ 22 (config_all_devices.has_key('CONFIG_LSI_SCSI_PCI') ? ['fuzz-lsi53c895a-test'] : []) + \ 23 (config_all_devices.has_key('CONFIG_VIRTIO_SCSI') ? ['fuzz-virtio-scsi-test'] : []) + \ 24 (config_all_devices.has_key('CONFIG_SB16') ? ['fuzz-sb16-test'] : []) + \ 25 (config_all_devices.has_key('CONFIG_SDHCI_PCI') ? ['fuzz-sdcard-test'] : []) + \ 26 [ 27 'cdrom-test', 28 'device-introspect-test', 29 'machine-none-test', 30 'qmp-test', 31 'qmp-cmd-test', 32 'qom-test', 33 'test-hmp', 34 'qos-test', 35] 36if config_host.has_key('CONFIG_MODULES') 37 qtests_generic += [ 'modules-test' ] 38endif 39 40qtests_pci = \ 41 (config_all_devices.has_key('CONFIG_VGA') ? ['display-vga-test'] : []) + \ 42 (config_all_devices.has_key('CONFIG_IVSHMEM_DEVICE') ? ['ivshmem-test'] : []) 43 44qtests_i386 = \ 45 (slirp.found() ? ['pxe-test', 'test-netfilter'] : []) + \ 46 (config_host.has_key('CONFIG_POSIX') ? ['test-filter-mirror'] : []) + \ 47 (have_tools ? ['ahci-test'] : []) + \ 48 (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : []) + \ 49 (config_all_devices.has_key('CONFIG_SGA') ? ['boot-serial-test'] : []) + \ 50 (config_all_devices.has_key('CONFIG_ISA_IPMI_KCS') ? ['ipmi-kcs-test'] : []) + \ 51 (config_host.has_key('CONFIG_LINUX') and \ 52 config_all_devices.has_key('CONFIG_ISA_IPMI_BT') ? ['ipmi-bt-test'] : []) + \ 53 (config_all_devices.has_key('CONFIG_WDT_IB700') ? ['wdt_ib700-test'] : []) + \ 54 (config_all_devices.has_key('CONFIG_PVPANIC_ISA') ? ['pvpanic-test'] : []) + \ 55 (config_all_devices.has_key('CONFIG_PVPANIC_PCI') ? ['pvpanic-pci-test'] : []) + \ 56 (config_all_devices.has_key('CONFIG_HDA') ? ['intel-hda-test'] : []) + \ 57 (config_all_devices.has_key('CONFIG_I82801B11') ? ['i82801b11-test'] : []) + \ 58 (config_all_devices.has_key('CONFIG_IOH3420') ? ['ioh3420-test'] : []) + \ 59 (config_all_devices.has_key('CONFIG_LPC_ICH9') ? ['lpc-ich9-test'] : []) + \ 60 (config_all_devices.has_key('CONFIG_USB_UHCI') ? ['usb-hcd-uhci-test'] : []) + \ 61 (config_all_devices.has_key('CONFIG_USB_UHCI') and \ 62 config_all_devices.has_key('CONFIG_USB_EHCI') ? ['usb-hcd-ehci-test'] : []) + \ 63 (config_all_devices.has_key('CONFIG_USB_XHCI_NEC') ? ['usb-hcd-xhci-test'] : []) + \ 64 (config_all_devices.has_key('CONFIG_TPM_CRB') ? ['tpm-crb-test'] : []) + \ 65 (config_all_devices.has_key('CONFIG_TPM_CRB') ? ['tpm-crb-swtpm-test'] : []) + \ 66 (config_all_devices.has_key('CONFIG_TPM_TIS_ISA') ? ['tpm-tis-test'] : []) + \ 67 (config_all_devices.has_key('CONFIG_TPM_TIS_ISA') ? ['tpm-tis-swtpm-test'] : []) + \ 68 (config_all_devices.has_key('CONFIG_RTL8139_PCI') ? ['rtl8139-test'] : []) + \ 69 (config_all_devices.has_key('CONFIG_E1000E_PCI_EXPRESS') ? ['fuzz-e1000e-test'] : []) + \ 70 (config_all_devices.has_key('CONFIG_ESP_PCI') ? ['am53c974-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.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_mips64 = \ 146 ['test-filter-mirror', 'test-filter-redirector'] + \ 147 (slirp.found() ? ['test-netfilter'] : []) + \ 148 (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : []) + \ 149 (config_all_devices.has_key('CONFIG_VGA') ? ['display-vga-test'] : []) 150 151qtests_mips64el = \ 152 ['test-filter-mirror', 'test-filter-redirector'] + \ 153 (slirp.found() ? ['test-netfilter'] : []) + \ 154 (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : []) + \ 155 (config_all_devices.has_key('CONFIG_VGA') ? ['display-vga-test'] : []) 156 157qtests_ppc = \ 158 ['test-filter-mirror', 'test-filter-redirector'] + \ 159 (slirp.found() ? ['test-netfilter'] : []) + \ 160 (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : []) + \ 161 (config_all_devices.has_key('CONFIG_M48T59') ? ['m48t59-test'] : []) + \ 162 ['boot-order-test', 'prom-env-test', 'boot-serial-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 ['test-filter-mirror', 'test-filter-redirector'] + \ 179 (slirp.found() ? ['test-netfilter'] : []) 180 181qtests_sparc64 = \ 182 (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : []) + \ 183 (slirp.found() ? ['test-netfilter'] : []) + \ 184 ['test-filter-mirror', 'test-filter-redirector'] + \ 185 ['prom-env-test', 'boot-serial-test'] 186 187qtests_npcm7xx = \ 188 ['npcm7xx_adc-test', 189 'npcm7xx_gpio-test', 190 'npcm7xx_pwm-test', 191 'npcm7xx_rng-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'] 199qtests_arm = \ 200 (config_all_devices.has_key('CONFIG_MPS2') ? ['sse-timer-test'] : []) + \ 201 (config_all_devices.has_key('CONFIG_CMSDK_APB_DUALTIMER') ? ['cmsdk-apb-dualtimer-test'] : []) + \ 202 (config_all_devices.has_key('CONFIG_CMSDK_APB_TIMER') ? ['cmsdk-apb-timer-test'] : []) + \ 203 (config_all_devices.has_key('CONFIG_CMSDK_APB_WATCHDOG') ? ['cmsdk-apb-watchdog-test'] : []) + \ 204 (config_all_devices.has_key('CONFIG_PFLASH_CFI02') ? ['pflash-cfi02-test'] : []) + \ 205 (config_all_devices.has_key('CONFIG_ASPEED_SOC') ? qtests_aspeed : []) + \ 206 (config_all_devices.has_key('CONFIG_NPCM7XX') ? qtests_npcm7xx : []) + \ 207 ['arm-cpu-features', 208 'microbit-test', 209 'test-arm-mptimer', 210 'boot-serial-test', 211 'hexloader-test'] 212 213# TODO: once aarch64 TCG is fixed on ARM 32 bit host, make bios-tables-test unconditional 214qtests_aarch64 = \ 215 (cpu != 'arm' and unpack_edk2_blobs ? ['bios-tables-test'] : []) + \ 216 (config_all_devices.has_key('CONFIG_TPM_TIS_SYSBUS') ? ['tpm-tis-device-test'] : []) + \ 217 (config_all_devices.has_key('CONFIG_TPM_TIS_SYSBUS') ? ['tpm-tis-device-swtpm-test'] : []) + \ 218 (config_all_devices.has_key('CONFIG_XLNX_ZYNQMP_ARM') ? ['xlnx-can-test', 'fuzz-xlnx-dp-test'] : []) + \ 219 ['arm-cpu-features', 220 'numa-test', 221 'boot-serial-test', 222 'migration-test'] 223 224qtests_s390x = \ 225 (slirp.found() ? ['pxe-test', 'test-netfilter'] : []) + \ 226 (config_host.has_key('CONFIG_POSIX') ? ['test-filter-mirror'] : []) + \ 227 (config_host.has_key('CONFIG_POSIX') ? ['test-filter-redirector'] : []) + \ 228 ['boot-serial-test', 229 'drive_del-test', 230 'device-plug-test', 231 'virtio-ccw-test', 232 'cpu-plug-test', 233 'migration-test'] 234 235qos_test_ss = ss.source_set() 236qos_test_ss.add( 237 'ac97-test.c', 238 'adm1272-test.c', 239 'ds1338-test.c', 240 'e1000-test.c', 241 'e1000e-test.c', 242 'eepro100-test.c', 243 'es1370-test.c', 244 'ipoctal232-test.c', 245 'max34451-test.c', 246 'megasas-test.c', 247 'ne2000-test.c', 248 'tulip-test.c', 249 'nvme-test.c', 250 'pca9552-test.c', 251 'pci-test.c', 252 'pcnet-test.c', 253 'sdhci-test.c', 254 'spapr-phb-test.c', 255 'tmp105-test.c', 256 'emc141x-test.c', 257 'usb-hcd-ohci-test.c', 258 'virtio-test.c', 259 'virtio-blk-test.c', 260 'virtio-net-test.c', 261 'virtio-rng-test.c', 262 'virtio-scsi-test.c', 263 'virtio-serial-test.c', 264 'virtio-iommu-test.c', 265 'vmxnet3-test.c', 266) 267if have_virtfs 268 qos_test_ss.add(files('virtio-9p-test.c')) 269endif 270qos_test_ss.add(when: 'CONFIG_VHOST_USER', if_true: files('vhost-user-test.c')) 271if have_tools and have_vhost_user_blk_server 272 qos_test_ss.add(files('vhost-user-blk-test.c')) 273endif 274 275tpmemu_files = ['tpm-emu.c', 'tpm-util.c', 'tpm-tests.c'] 276 277qtests = { 278 'bios-tables-test': [io, 'boot-sector.c', 'acpi-utils.c', 'tpm-emu.c'], 279 'cdrom-test': files('boot-sector.c'), 280 'dbus-vmstate-test': files('migration-helpers.c') + dbus_vmstate1, 281 'ivshmem-test': [rt, '../../contrib/ivshmem-server/ivshmem-server.c'], 282 'migration-test': files('migration-helpers.c'), 283 'pxe-test': files('boot-sector.c'), 284 'qos-test': [chardev, io, qos_test_ss.apply(config_host, strict: false).sources()], 285 'tpm-crb-swtpm-test': [io, tpmemu_files], 286 'tpm-crb-test': [io, tpmemu_files], 287 'tpm-tis-swtpm-test': [io, tpmemu_files, 'tpm-tis-util.c'], 288 'tpm-tis-test': [io, tpmemu_files, 'tpm-tis-util.c'], 289 'tpm-tis-device-swtpm-test': [io, tpmemu_files, 'tpm-tis-util.c'], 290 'tpm-tis-device-test': [io, tpmemu_files, 'tpm-tis-util.c'], 291 'vmgenid-test': files('boot-sector.c', 'acpi-utils.c'), 292} 293 294if dbus_display 295qtests += {'dbus-display-test': [dbus_display1, gio]} 296endif 297 298qtest_executables = {} 299foreach dir : target_dirs 300 if not dir.endswith('-softmmu') 301 continue 302 endif 303 304 target_base = dir.split('-')[0] 305 qtest_emulator = emulators['qemu-system-' + target_base] 306 target_qtests = get_variable('qtests_' + target_base, []) + qtests_generic 307 308 test_deps = roms 309 qtest_env = environment() 310 if have_tools 311 qtest_env.set('QTEST_QEMU_IMG', './qemu-img') 312 test_deps += [qemu_img] 313 endif 314 qtest_env.set('G_TEST_DBUS_DAEMON', meson.project_source_root() / 'tests/dbus-vmstate-daemon.sh') 315 qtest_env.set('QTEST_QEMU_BINARY', './qemu-system-' + target_base) 316 if have_tools and have_vhost_user_blk_server 317 qtest_env.set('QTEST_QEMU_STORAGE_DAEMON_BINARY', './storage-daemon/qemu-storage-daemon') 318 test_deps += [qsd] 319 endif 320 321 foreach test : target_qtests 322 # Executables are shared across targets, declare them only the first time we 323 # encounter them 324 if not qtest_executables.has_key(test) 325 src = [test + '.c'] 326 deps = [qemuutil, qos] 327 if test in qtests 328 # use a sourceset to quickly separate sources and deps 329 test_ss = ss.source_set() 330 test_ss.add(qtests[test]) 331 src += test_ss.all_sources() 332 deps += test_ss.all_dependencies() 333 endif 334 qtest_executables += { 335 test: executable(test, src, dependencies: deps) 336 } 337 endif 338 test('qtest-@0@/@1@'.format(target_base, test), 339 qtest_executables[test], 340 depends: [test_deps, qtest_emulator, emulator_modules], 341 env: qtest_env, 342 args: ['--tap', '-k'], 343 protocol: 'tap', 344 timeout: slow_qtests.get(test, 30), 345 priority: slow_qtests.get(test, 30), 346 suite: ['qtest', 'qtest-' + target_base]) 347 endforeach 348endforeach 349