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