tests: Add DO_TEST_CAPS_ARCH_VER_FULL()
[libvirt/ericb.git] / tests / qemuxml2argvtest.c
blob748d43f4884b52d332ec53ce8aea32ab6adcdb3f
1 #include <config.h>
3 #include <unistd.h>
5 #include <sys/types.h>
6 #include <fcntl.h>
8 #include "testutils.h"
10 #ifdef WITH_QEMU
12 # include "internal.h"
13 # include "viralloc.h"
14 # include "qemu/qemu_alias.h"
15 # include "qemu/qemu_capabilities.h"
16 # include "qemu/qemu_command.h"
17 # include "qemu/qemu_domain.h"
18 # include "qemu/qemu_migration.h"
19 # include "qemu/qemu_process.h"
20 # include "datatypes.h"
21 # include "conf/storage_conf.h"
22 # include "cpu/cpu_map.h"
23 # include "virstring.h"
24 # include "storage/storage_driver.h"
25 # include "virmock.h"
26 # include "virfilewrapper.h"
27 # include "configmake.h"
29 # define LIBVIRT_QEMU_CAPSPRIV_H_ALLOW
30 # include "qemu/qemu_capspriv.h"
32 # include "testutilsqemu.h"
34 # define VIR_FROM_THIS VIR_FROM_QEMU
36 static virQEMUDriver driver;
38 static unsigned char *
39 fakeSecretGetValue(virSecretPtr obj ATTRIBUTE_UNUSED,
40 size_t *value_size,
41 unsigned int fakeflags ATTRIBUTE_UNUSED,
42 unsigned int internalFlags ATTRIBUTE_UNUSED)
44 char *secret;
45 if (VIR_STRDUP(secret, "AQCVn5hO6HzFAhAAq0NCv8jtJcIcE+HOBlMQ1A") < 0)
46 return NULL;
47 *value_size = strlen(secret);
48 return (unsigned char *) secret;
51 static virSecretPtr
52 fakeSecretLookupByUsage(virConnectPtr conn,
53 int usageType,
54 const char *usageID)
56 unsigned char uuid[VIR_UUID_BUFLEN];
57 if (usageType == VIR_SECRET_USAGE_TYPE_VOLUME) {
58 if (!STRPREFIX(usageID, "/storage/guest_disks/")) {
59 virReportError(VIR_ERR_INTERNAL_ERROR,
60 "test provided invalid volume storage prefix '%s'",
61 usageID);
62 return NULL;
64 } else if (STRNEQ(usageID, "mycluster_myname")) {
65 virReportError(VIR_ERR_INTERNAL_ERROR,
66 "test provided incorrect usage '%s'", usageID);
67 return NULL;
70 if (virUUIDGenerate(uuid) < 0)
71 return NULL;
73 return virGetSecret(conn, uuid, usageType, usageID);
76 static virSecretPtr
77 fakeSecretLookupByUUID(virConnectPtr conn,
78 const unsigned char *uuid)
80 /* NB: This mocked value could be "tls" or "volume" depending on
81 * which test is being run, we'll leave at NONE (or 0) */
82 return virGetSecret(conn, uuid, VIR_SECRET_USAGE_TYPE_NONE, "");
85 static virSecretDriver fakeSecretDriver = {
86 .connectNumOfSecrets = NULL,
87 .connectListSecrets = NULL,
88 .secretLookupByUUID = fakeSecretLookupByUUID,
89 .secretLookupByUsage = fakeSecretLookupByUsage,
90 .secretDefineXML = NULL,
91 .secretGetXMLDesc = NULL,
92 .secretSetValue = NULL,
93 .secretGetValue = fakeSecretGetValue,
94 .secretUndefine = NULL,
98 # define STORAGE_POOL_XML_PATH "storagepoolxml2xmlout/"
99 static const unsigned char fakeUUID[VIR_UUID_BUFLEN] = "fakeuuid";
101 static virStoragePoolPtr
102 fakeStoragePoolLookupByName(virConnectPtr conn,
103 const char *name)
105 char *xmlpath = NULL;
106 virStoragePoolPtr ret = NULL;
108 if (STRNEQ(name, "inactive")) {
109 if (virAsprintf(&xmlpath, "%s/%s%s.xml",
110 abs_srcdir,
111 STORAGE_POOL_XML_PATH,
112 name) < 0)
113 return NULL;
115 if (!virFileExists(xmlpath)) {
116 virReportError(VIR_ERR_NO_STORAGE_POOL,
117 "File '%s' not found", xmlpath);
118 goto cleanup;
122 ret = virGetStoragePool(conn, name, fakeUUID, NULL, NULL);
124 cleanup:
125 VIR_FREE(xmlpath);
126 return ret;
130 static virStorageVolPtr
131 fakeStorageVolLookupByName(virStoragePoolPtr pool,
132 const char *name)
134 char **volinfo = NULL;
135 virStorageVolPtr ret = NULL;
137 if (STREQ(pool->name, "inactive")) {
138 virReportError(VIR_ERR_OPERATION_INVALID,
139 "storage pool '%s' is not active", pool->name);
140 return NULL;
143 if (STREQ(name, "nonexistent")) {
144 virReportError(VIR_ERR_NO_STORAGE_VOL,
145 "no storage vol with matching name '%s'", name);
146 return NULL;
149 if (!strchr(name, '+'))
150 goto fallback;
152 if (!(volinfo = virStringSplit(name, "+", 2)))
153 return NULL;
155 if (!volinfo[1])
156 goto fallback;
158 ret = virGetStorageVol(pool->conn, pool->name, volinfo[1], volinfo[0],
159 NULL, NULL);
161 cleanup:
162 virStringListFree(volinfo);
163 return ret;
165 fallback:
166 ret = virGetStorageVol(pool->conn, pool->name, name, "block", NULL, NULL);
167 goto cleanup;
170 static int
171 fakeStorageVolGetInfo(virStorageVolPtr vol,
172 virStorageVolInfoPtr info)
174 memset(info, 0, sizeof(*info));
176 info->type = virStorageVolTypeFromString(vol->key);
178 if (info->type < 0) {
179 virReportError(VIR_ERR_INTERNAL_ERROR,
180 "Invalid volume type '%s'", vol->key);
181 return -1;
184 return 0;
188 static char *
189 fakeStorageVolGetPath(virStorageVolPtr vol)
191 char *ret = NULL;
193 ignore_value(virAsprintf(&ret, "/some/%s/device/%s", vol->key, vol->name));
195 return ret;
199 static char *
200 fakeStoragePoolGetXMLDesc(virStoragePoolPtr pool,
201 unsigned int flags_unused ATTRIBUTE_UNUSED)
203 char *xmlpath = NULL;
204 char *xmlbuf = NULL;
206 if (STREQ(pool->name, "inactive")) {
207 virReportError(VIR_ERR_NO_STORAGE_POOL, NULL);
208 return NULL;
211 if (virAsprintf(&xmlpath, "%s/%s%s.xml",
212 abs_srcdir,
213 STORAGE_POOL_XML_PATH,
214 pool->name) < 0)
215 return NULL;
217 if (virTestLoadFile(xmlpath, &xmlbuf) < 0) {
218 virReportError(VIR_ERR_INTERNAL_ERROR,
219 "failed to load XML file '%s'",
220 xmlpath);
221 goto cleanup;
224 cleanup:
225 VIR_FREE(xmlpath);
227 return xmlbuf;
230 static int
231 fakeStoragePoolIsActive(virStoragePoolPtr pool)
233 if (STREQ(pool->name, "inactive"))
234 return 0;
236 return 1;
239 /* Test storage pool implementation
241 * These functions aid testing of storage pool related stuff when creating a
242 * qemu command line.
244 * There are a few "magic" values to pass to these functions:
246 * 1) "inactive" as a pool name to create an inactive pool. All other names are
247 * interpreted as file names in storagepoolxml2xmlout/ and are used as the
248 * definition for the pool. If the file doesn't exist the pool doesn't exist.
250 * 2) "nonexistent" returns an error while looking up a volume. Otherwise
251 * pattern VOLUME_TYPE+VOLUME_PATH can be used to simulate a volume in a pool.
252 * This creates a fake path for this volume. If the '+' sign is omitted, block
253 * type is assumed.
255 static virStorageDriver fakeStorageDriver = {
256 .storagePoolLookupByName = fakeStoragePoolLookupByName,
257 .storageVolLookupByName = fakeStorageVolLookupByName,
258 .storagePoolGetXMLDesc = fakeStoragePoolGetXMLDesc,
259 .storageVolGetPath = fakeStorageVolGetPath,
260 .storageVolGetInfo = fakeStorageVolGetInfo,
261 .storagePoolIsActive = fakeStoragePoolIsActive,
265 /* virNetDevOpenvswitchGetVhostuserIfname mocks a portdev name - handle that */
266 static virNWFilterBindingPtr
267 fakeNWFilterBindingLookupByPortDev(virConnectPtr conn,
268 const char *portdev)
270 if (STREQ(portdev, "vhost-user0"))
271 return virGetNWFilterBinding(conn, "fake_vnet0", "fakeFilterName");
273 virReportError(VIR_ERR_NO_NWFILTER_BINDING,
274 "no nwfilter binding for port dev '%s'", portdev);
275 return NULL;
279 static int
280 fakeNWFilterBindingDelete(virNWFilterBindingPtr binding ATTRIBUTE_UNUSED)
282 return 0;
286 static virNWFilterDriver fakeNWFilterDriver = {
287 .nwfilterBindingLookupByPortDev = fakeNWFilterBindingLookupByPortDev,
288 .nwfilterBindingDelete = fakeNWFilterBindingDelete,
292 static int
293 testAddCPUModels(virQEMUCapsPtr caps, bool skipLegacy)
295 virArch arch = virQEMUCapsGetArch(caps);
296 const char *x86Models[] = {
297 "Opteron_G3", "Opteron_G2", "Opteron_G1",
298 "Nehalem", "Penryn", "Conroe",
299 "Haswell-noTSX", "Haswell",
301 const char *x86LegacyModels[] = {
302 "n270", "athlon", "pentium3", "pentium2", "pentium",
303 "486", "coreduo", "kvm32", "qemu32", "kvm64",
304 "core2duo", "phenom", "qemu64",
306 const char *armModels[] = {
307 "cortex-a9", "cortex-a8", "cortex-a57", "cortex-a53",
309 const char *ppc64Models[] = {
310 "POWER8", "POWER7",
312 const char *s390xModels[] = {
313 "z990", "zEC12", "z13",
316 if (ARCH_IS_X86(arch)) {
317 if (virQEMUCapsAddCPUDefinitions(caps, VIR_DOMAIN_VIRT_KVM, x86Models,
318 ARRAY_CARDINALITY(x86Models),
319 VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0 ||
320 virQEMUCapsAddCPUDefinitions(caps, VIR_DOMAIN_VIRT_QEMU, x86Models,
321 ARRAY_CARDINALITY(x86Models),
322 VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0)
323 return -1;
325 if (!skipLegacy) {
326 if (virQEMUCapsAddCPUDefinitions(caps, VIR_DOMAIN_VIRT_KVM,
327 x86LegacyModels,
328 ARRAY_CARDINALITY(x86LegacyModels),
329 VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0 ||
330 virQEMUCapsAddCPUDefinitions(caps, VIR_DOMAIN_VIRT_QEMU,
331 x86LegacyModels,
332 ARRAY_CARDINALITY(x86LegacyModels),
333 VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0)
334 return -1;
336 } else if (ARCH_IS_ARM(arch)) {
337 if (virQEMUCapsAddCPUDefinitions(caps, VIR_DOMAIN_VIRT_KVM, armModels,
338 ARRAY_CARDINALITY(armModels),
339 VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0 ||
340 virQEMUCapsAddCPUDefinitions(caps, VIR_DOMAIN_VIRT_QEMU, armModels,
341 ARRAY_CARDINALITY(armModels),
342 VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0)
343 return -1;
344 } else if (ARCH_IS_PPC64(arch)) {
345 if (virQEMUCapsAddCPUDefinitions(caps, VIR_DOMAIN_VIRT_KVM, ppc64Models,
346 ARRAY_CARDINALITY(ppc64Models),
347 VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0 ||
348 virQEMUCapsAddCPUDefinitions(caps, VIR_DOMAIN_VIRT_QEMU, ppc64Models,
349 ARRAY_CARDINALITY(ppc64Models),
350 VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0)
351 return -1;
352 } else if (ARCH_IS_S390(arch)) {
353 if (virQEMUCapsAddCPUDefinitions(caps, VIR_DOMAIN_VIRT_KVM, s390xModels,
354 ARRAY_CARDINALITY(s390xModels),
355 VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0)
356 return -1;
359 return 0;
363 static int
364 testUpdateQEMUCaps(const struct testQemuInfo *info,
365 virDomainObjPtr vm,
366 virCapsPtr caps)
368 int ret = -1;
370 if (!caps)
371 goto cleanup;
373 virQEMUCapsSetArch(info->qemuCaps, vm->def->os.arch);
375 virQEMUCapsInitQMPBasicArch(info->qemuCaps);
377 if (testAddCPUModels(info->qemuCaps,
378 !!(info->flags & FLAG_SKIP_LEGACY_CPUS)) < 0)
379 goto cleanup;
381 virQEMUCapsInitHostCPUModel(info->qemuCaps, caps->host.arch,
382 VIR_DOMAIN_VIRT_KVM);
383 virQEMUCapsInitHostCPUModel(info->qemuCaps, caps->host.arch,
384 VIR_DOMAIN_VIRT_QEMU);
386 ret = 0;
388 cleanup:
389 return ret;
393 static int
394 testCheckExclusiveFlags(int flags)
396 virCheckFlags(FLAG_EXPECT_FAILURE |
397 FLAG_EXPECT_PARSE_ERROR |
398 FLAG_FIPS |
399 FLAG_REAL_CAPS |
400 FLAG_SKIP_LEGACY_CPUS |
401 0, -1);
403 VIR_EXCLUSIVE_FLAGS_RET(FLAG_REAL_CAPS, FLAG_SKIP_LEGACY_CPUS, -1);
404 return 0;
408 static int
409 testCompareXMLToArgv(const void *data)
411 struct testQemuInfo *info = (void *) data;
412 char *migrateURI = NULL;
413 char *actualargv = NULL;
414 unsigned int flags = info->flags;
415 unsigned int parseFlags = info->parseFlags;
416 int ret = -1;
417 virDomainObjPtr vm = NULL;
418 virDomainChrSourceDef monitor_chr;
419 virConnectPtr conn;
420 char *log = NULL;
421 virCommandPtr cmd = NULL;
422 size_t i;
423 qemuDomainObjPrivatePtr priv = NULL;
425 memset(&monitor_chr, 0, sizeof(monitor_chr));
427 if (!(conn = virGetConnect()))
428 goto cleanup;
430 conn->secretDriver = &fakeSecretDriver;
431 conn->storageDriver = &fakeStorageDriver;
432 conn->nwfilterDriver = &fakeNWFilterDriver;
434 virSetConnectInterface(conn);
435 virSetConnectNetwork(conn);
436 virSetConnectNWFilter(conn);
437 virSetConnectNodeDev(conn);
438 virSetConnectSecret(conn);
439 virSetConnectStorage(conn);
441 if (virQEMUCapsGet(info->qemuCaps, QEMU_CAPS_ENABLE_FIPS))
442 flags |= FLAG_FIPS;
444 if (testCheckExclusiveFlags(info->flags) < 0)
445 goto cleanup;
447 if (qemuTestCapsCacheInsert(driver.qemuCapsCache, info->qemuCaps) < 0)
448 goto cleanup;
450 if (info->migrateFrom &&
451 !(migrateURI = qemuMigrationDstGetURI(info->migrateFrom,
452 info->migrateFd)))
453 goto cleanup;
455 if (!(vm = virDomainObjNew(driver.xmlopt)))
456 goto cleanup;
458 parseFlags |= VIR_DOMAIN_DEF_PARSE_INACTIVE;
459 if (!(vm->def = virDomainDefParseFile(info->infile,
460 driver.caps, driver.xmlopt,
461 NULL, parseFlags))) {
462 if (flags & FLAG_EXPECT_PARSE_ERROR)
463 goto ok;
464 goto cleanup;
466 if (flags & FLAG_EXPECT_PARSE_ERROR) {
467 VIR_TEST_DEBUG("passed instead of expected parse error");
468 goto cleanup;
470 priv = vm->privateData;
472 if (virBitmapParse("0-3", &priv->autoNodeset, 4) < 0)
473 goto cleanup;
475 if (!virDomainDefCheckABIStability(vm->def, vm->def, driver.xmlopt)) {
476 VIR_TEST_DEBUG("ABI stability check failed on %s", info->infile);
477 goto cleanup;
480 vm->def->id = -1;
482 if (qemuProcessPrepareMonitorChr(&monitor_chr, priv->libDir) < 0)
483 goto cleanup;
485 if (!(info->flags & FLAG_REAL_CAPS) &&
486 testUpdateQEMUCaps(info, vm, driver.caps) < 0)
487 goto cleanup;
489 log = virTestLogContentAndReset();
490 VIR_FREE(log);
491 virResetLastError();
493 for (i = 0; i < vm->def->nhostdevs; i++) {
494 virDomainHostdevDefPtr hostdev = vm->def->hostdevs[i];
496 if (hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
497 hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI &&
498 hostdev->source.subsys.u.pci.backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT) {
499 hostdev->source.subsys.u.pci.backend = VIR_DOMAIN_HOSTDEV_PCI_BACKEND_KVM;
503 if (vm->def->vsock) {
504 virDomainVsockDefPtr vsock = vm->def->vsock;
505 qemuDomainVsockPrivatePtr vsockPriv =
506 (qemuDomainVsockPrivatePtr)vsock->privateData;
508 if (vsock->auto_cid == VIR_TRISTATE_BOOL_YES)
509 vsock->guest_cid = 42;
511 vsockPriv->vhostfd = 6789;
514 if (vm->def->tpm) {
515 switch (vm->def->tpm->type) {
516 case VIR_DOMAIN_TPM_TYPE_EMULATOR:
517 VIR_FREE(vm->def->tpm->data.emulator.source.data.file.path);
518 if (VIR_STRDUP(vm->def->tpm->data.emulator.source.data.file.path,
519 "/dev/test") < 0)
520 goto cleanup;
521 vm->def->tpm->data.emulator.source.type = VIR_DOMAIN_CHR_TYPE_FILE;
522 break;
523 case VIR_DOMAIN_TPM_TYPE_PASSTHROUGH:
524 case VIR_DOMAIN_TPM_TYPE_LAST:
525 break;
529 if (!(cmd = qemuProcessCreatePretendCmd(&driver, vm, migrateURI,
530 (flags & FLAG_FIPS), false,
531 VIR_QEMU_PROCESS_START_COLD))) {
532 if (flags & FLAG_EXPECT_FAILURE)
533 goto ok;
534 goto cleanup;
536 if (flags & FLAG_EXPECT_FAILURE) {
537 VIR_TEST_DEBUG("passed instead of expected failure");
538 goto cleanup;
541 if (!(actualargv = virCommandToString(cmd, false)))
542 goto cleanup;
544 if (virTestCompareToFile(actualargv, info->outfile) < 0)
545 goto cleanup;
547 ret = 0;
550 if (ret == 0 && flags & FLAG_EXPECT_FAILURE) {
551 ret = -1;
552 VIR_TEST_DEBUG("Error expected but there wasn't any.\n");
553 goto cleanup;
555 if (!virTestOOMActive()) {
556 if (flags & FLAG_EXPECT_FAILURE) {
557 if ((log = virTestLogContentAndReset()))
558 VIR_TEST_DEBUG("Got expected error: \n%s", log);
560 virResetLastError();
561 ret = 0;
564 cleanup:
565 VIR_FREE(log);
566 VIR_FREE(actualargv);
567 virDomainChrSourceDefClear(&monitor_chr);
568 virCommandFree(cmd);
569 virObjectUnref(vm);
570 virSetConnectSecret(NULL);
571 virSetConnectStorage(NULL);
572 virObjectUnref(conn);
573 VIR_FREE(migrateURI);
574 return ret;
577 static int
578 testInfoSetPaths(struct testQemuInfo *info,
579 const char *suffix)
581 if (virAsprintf(&info->infile, "%s/qemuxml2argvdata/%s.xml",
582 abs_srcdir, info->name) < 0 ||
583 virAsprintf(&info->outfile, "%s/qemuxml2argvdata/%s%s.args",
584 abs_srcdir, info->name, suffix ? suffix : "") < 0) {
585 return -1;
588 return 0;
591 # define FAKEROOTDIRTEMPLATE abs_builddir "/fakerootdir-XXXXXX"
593 static int
594 mymain(void)
596 int ret = 0;
597 char *fakerootdir;
598 virHashTablePtr capslatest = NULL;
600 if (VIR_STRDUP_QUIET(fakerootdir, FAKEROOTDIRTEMPLATE) < 0) {
601 fprintf(stderr, "Out of memory\n");
602 abort();
605 if (!mkdtemp(fakerootdir)) {
606 fprintf(stderr, "Cannot create fakerootdir");
607 abort();
610 setenv("LIBVIRT_FAKE_ROOT_DIR", fakerootdir, 1);
612 /* Set the timezone because we are mocking the time() function.
613 * If we don't do that, then localtime() may return unpredictable
614 * results. In order to detect things that just work by a blind
615 * chance, we need to set an virtual timezone that no libvirt
616 * developer resides in. */
617 if (setenv("TZ", "VIR00:30", 1) < 0) {
618 perror("setenv");
619 return EXIT_FAILURE;
622 if (qemuTestDriverInit(&driver) < 0)
623 return EXIT_FAILURE;
625 driver.privileged = true;
627 VIR_FREE(driver.config->defaultTLSx509certdir);
628 if (VIR_STRDUP_QUIET(driver.config->defaultTLSx509certdir, "/etc/pki/qemu") < 0)
629 return EXIT_FAILURE;
630 VIR_FREE(driver.config->vncTLSx509certdir);
631 if (VIR_STRDUP_QUIET(driver.config->vncTLSx509certdir, "/etc/pki/libvirt-vnc") < 0)
632 return EXIT_FAILURE;
633 VIR_FREE(driver.config->spiceTLSx509certdir);
634 if (VIR_STRDUP_QUIET(driver.config->spiceTLSx509certdir, "/etc/pki/libvirt-spice") < 0)
635 return EXIT_FAILURE;
636 VIR_FREE(driver.config->chardevTLSx509certdir);
637 if (VIR_STRDUP_QUIET(driver.config->chardevTLSx509certdir, "/etc/pki/libvirt-chardev") < 0)
638 return EXIT_FAILURE;
639 VIR_FREE(driver.config->vxhsTLSx509certdir);
640 if (VIR_STRDUP_QUIET(driver.config->vxhsTLSx509certdir, "/etc/pki/libvirt-vxhs/dummy,path") < 0)
641 return EXIT_FAILURE;
642 VIR_FREE(driver.config->nbdTLSx509certdir);
643 if (VIR_STRDUP_QUIET(driver.config->nbdTLSx509certdir, "/etc/pki/libvirt-nbd/dummy,path") < 0)
644 return EXIT_FAILURE;
646 VIR_FREE(driver.config->hugetlbfs);
647 if (VIR_ALLOC_N(driver.config->hugetlbfs, 2) < 0)
648 return EXIT_FAILURE;
649 driver.config->nhugetlbfs = 2;
650 if (VIR_STRDUP(driver.config->hugetlbfs[0].mnt_dir, "/dev/hugepages2M") < 0 ||
651 VIR_STRDUP(driver.config->hugetlbfs[1].mnt_dir, "/dev/hugepages1G") < 0)
652 return EXIT_FAILURE;
653 driver.config->hugetlbfs[0].size = 2048;
654 driver.config->hugetlbfs[0].deflt = true;
655 driver.config->hugetlbfs[1].size = 1048576;
656 driver.config->spiceTLS = 1;
657 if (VIR_STRDUP_QUIET(driver.config->spicePassword, "123456") < 0)
658 return EXIT_FAILURE;
659 VIR_FREE(driver.config->memoryBackingDir);
660 if (VIR_STRDUP_QUIET(driver.config->memoryBackingDir, "/var/lib/libvirt/qemu/ram") < 0)
661 return EXIT_FAILURE;
662 VIR_FREE(driver.config->nvramDir);
663 if (VIR_STRDUP(driver.config->nvramDir, "/var/lib/libvirt/qemu/nvram") < 0)
664 return EXIT_FAILURE;
666 capslatest = testQemuGetLatestCaps();
667 if (!capslatest)
668 return EXIT_FAILURE;
670 virFileWrapperAddPrefix(SYSCONFDIR "/qemu/firmware",
671 abs_srcdir "/qemufirmwaredata/etc/qemu/firmware");
672 virFileWrapperAddPrefix(PREFIX "/share/qemu/firmware",
673 abs_srcdir "/qemufirmwaredata/usr/share/qemu/firmware");
674 virFileWrapperAddPrefix("/home/user/.config/qemu/firmware",
675 abs_srcdir "/qemufirmwaredata/home/user/.config/qemu/firmware");
678 * The following set of macros allows testing of XML -> argv conversion with a
679 * real set of capabilities gathered from a real qemu copy. It is desired to use
680 * these for positive test cases as it provides combinations of flags which
681 * can be met in real life.
683 * The capabilities are taken from the real capabilities stored in
684 * tests/qemucapabilitiesdata.
686 * It is suggested to use the DO_TEST_CAPS_LATEST macro which always takes the
687 * most recent capability set. In cases when the new code would change behaviour
688 * the test cases should be forked using DO_TEST_CAPS_VER with the appropriate
689 * version.
691 # define DO_TEST_INTERNAL(_name, _suffix, ...) \
692 do { \
693 static struct testQemuInfo info = { \
694 .name = _name, \
695 }; \
696 if (testQemuInfoSetArgs(&info, capslatest, \
697 __VA_ARGS__, ARG_END) < 0) \
698 return EXIT_FAILURE; \
699 if (testInfoSetPaths(&info, _suffix) < 0) { \
700 VIR_TEST_DEBUG("Failed to generate paths for '%s'", _name); \
701 return EXIT_FAILURE; \
703 if (virTestRun("QEMU XML-2-ARGV " _name _suffix, \
704 testCompareXMLToArgv, &info) < 0) \
705 ret = -1; \
706 testQemuInfoClear(&info); \
707 } while (0)
709 # define DO_TEST_CAPS_INTERNAL(name, arch, ver, ...) \
710 DO_TEST_INTERNAL(name, "." arch "-" ver, \
711 ARG_CAPS_ARCH, arch, \
712 ARG_CAPS_VER, ver, \
713 __VA_ARGS__)
715 # define DO_TEST_CAPS_ARCH_LATEST_FULL(name, arch, ...) \
716 DO_TEST_CAPS_INTERNAL(name, arch, "latest", __VA_ARGS__)
718 # define DO_TEST_CAPS_ARCH_VER_FULL(name, arch, ver, ...) \
719 DO_TEST_CAPS_INTERNAL(name, arch, ver, __VA_ARGS__)
721 # define DO_TEST_CAPS_ARCH_LATEST(name, arch) \
722 DO_TEST_CAPS_ARCH_LATEST_FULL(name, arch, ARG_END)
724 # define DO_TEST_CAPS_ARCH_VER(name, arch, ver) \
725 DO_TEST_CAPS_ARCH_VER_FULL(name, arch, ver, ARG_END)
727 # define DO_TEST_CAPS_LATEST(name) \
728 DO_TEST_CAPS_ARCH_LATEST(name, "x86_64")
730 # define DO_TEST_CAPS_VER(name, ver) \
731 DO_TEST_CAPS_ARCH_VER(name, "x86_64", ver)
733 # define DO_TEST_CAPS_LATEST_FAILURE(name) \
734 DO_TEST_CAPS_ARCH_LATEST_FULL(name, "x86_64", \
735 ARG_FLAGS, FLAG_EXPECT_FAILURE)
737 # define DO_TEST_CAPS_LATEST_PARSE_ERROR(name) \
738 DO_TEST_CAPS_ARCH_LATEST_FULL(name, "x86_64", \
739 ARG_FLAGS, FLAG_EXPECT_PARSE_ERROR)
741 # define DO_TEST_FULL(name, ...) \
742 DO_TEST_INTERNAL(name, "", \
743 __VA_ARGS__, QEMU_CAPS_LAST)
745 /* All the following macros require an explicit QEMU_CAPS_* list
746 * at the end of the argument list, or the NONE placeholder.
747 * */
748 # define DO_TEST(name, ...) \
749 DO_TEST_FULL(name, \
750 ARG_QEMU_CAPS, __VA_ARGS__)
752 # define DO_TEST_GIC(name, gic, ...) \
753 DO_TEST_FULL(name, \
754 ARG_GIC, gic, \
755 ARG_QEMU_CAPS, __VA_ARGS__)
757 # define DO_TEST_FAILURE(name, ...) \
758 DO_TEST_FULL(name, \
759 ARG_FLAGS, FLAG_EXPECT_FAILURE, \
760 ARG_QEMU_CAPS, __VA_ARGS__)
762 # define DO_TEST_PARSE_ERROR(name, ...) \
763 DO_TEST_FULL(name, \
764 ARG_FLAGS, FLAG_EXPECT_PARSE_ERROR | FLAG_EXPECT_FAILURE, \
765 ARG_QEMU_CAPS, __VA_ARGS__)
767 # define NONE QEMU_CAPS_LAST
769 /* Unset or set all envvars here that are copied in qemudBuildCommandLine
770 * using ADD_ENV_COPY, otherwise these tests may fail due to unexpected
771 * values for these envvars */
772 setenv("PATH", "/bin", 1);
773 setenv("USER", "test", 1);
774 setenv("LOGNAME", "test", 1);
775 setenv("HOME", "/home/test", 1);
776 unsetenv("TMPDIR");
777 unsetenv("LD_PRELOAD");
778 unsetenv("LD_LIBRARY_PATH");
779 unsetenv("QEMU_AUDIO_DRV");
780 unsetenv("SDL_AUDIODRIVER");
782 DO_TEST("minimal", NONE);
783 DO_TEST("minimal-sandbox",
784 QEMU_CAPS_SECCOMP_BLACKLIST);
785 DO_TEST_PARSE_ERROR("minimal-no-memory", NONE);
786 DO_TEST("minimal-msg-timestamp", QEMU_CAPS_MSG_TIMESTAMP);
788 DO_TEST_CAPS_LATEST("genid");
789 DO_TEST_CAPS_LATEST("genid-auto");
791 DO_TEST("machine-aliases1", NONE);
792 DO_TEST("machine-aliases2", QEMU_CAPS_KVM);
793 DO_TEST("machine-core-on", NONE);
794 driver.config->dumpGuestCore = true;
795 DO_TEST("machine-core-off", NONE);
796 driver.config->dumpGuestCore = false;
797 DO_TEST("machine-smm-opt",
798 QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
799 QEMU_CAPS_DEVICE_PCI_BRIDGE,
800 QEMU_CAPS_DEVICE_IOH3420,
801 QEMU_CAPS_ICH9_AHCI,
802 QEMU_CAPS_MACHINE_SMM_OPT,
803 QEMU_CAPS_VIRTIO_SCSI);
804 DO_TEST("machine-vmport-opt",
805 QEMU_CAPS_MACHINE_VMPORT_OPT);
806 DO_TEST("default-kvm-host-arch", NONE);
807 DO_TEST("default-qemu-host-arch", NONE);
808 DO_TEST("x86-kvm-32-on-64", NONE);
809 DO_TEST("boot-cdrom", NONE);
810 DO_TEST("boot-network", NONE);
811 DO_TEST("boot-floppy", NONE);
812 DO_TEST("boot-floppy-q35",
813 QEMU_CAPS_DEVICE_IOH3420,
814 QEMU_CAPS_ICH9_AHCI);
815 DO_TEST("boot-multi", NONE);
816 DO_TEST("boot-menu-enable", NONE);
817 DO_TEST("boot-menu-enable-with-timeout",
818 QEMU_CAPS_SPLASH_TIMEOUT);
819 DO_TEST_FAILURE("boot-menu-enable-with-timeout", NONE);
820 DO_TEST_PARSE_ERROR("boot-menu-enable-with-timeout-invalid", NONE);
821 DO_TEST("boot-menu-disable", NONE);
822 DO_TEST("boot-menu-disable-drive", NONE);
823 DO_TEST_PARSE_ERROR("boot-dev+order",
824 QEMU_CAPS_VIRTIO_BLK_SCSI);
825 DO_TEST("boot-order",
826 QEMU_CAPS_VIRTIO_BLK_SCSI);
827 DO_TEST("boot-complex",
828 QEMU_CAPS_VIRTIO_BLK_SCSI);
829 DO_TEST("boot-strict",
830 QEMU_CAPS_BOOT_STRICT,
831 QEMU_CAPS_VIRTIO_BLK_SCSI);
833 DO_TEST("reboot-timeout-disabled", QEMU_CAPS_REBOOT_TIMEOUT);
834 DO_TEST("reboot-timeout-enabled", QEMU_CAPS_REBOOT_TIMEOUT);
835 DO_TEST_FAILURE("reboot-timeout-enabled", NONE);
837 DO_TEST("bios",
838 QEMU_CAPS_DEVICE_ISA_SERIAL,
839 QEMU_CAPS_SGA);
840 DO_TEST("bios-nvram", NONE);
841 DO_TEST("bios-nvram-secure",
842 QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
843 QEMU_CAPS_DEVICE_PCI_BRIDGE,
844 QEMU_CAPS_DEVICE_IOH3420,
845 QEMU_CAPS_ICH9_AHCI,
846 QEMU_CAPS_MACHINE_SMM_OPT,
847 QEMU_CAPS_VIRTIO_SCSI);
849 /* Make sure all combinations of ACPI and UEFI behave as expected */
850 DO_TEST("q35-acpi-uefi", NONE);
851 DO_TEST_PARSE_ERROR("q35-noacpi-uefi", NONE);
852 DO_TEST("q35-noacpi-nouefi", NONE);
853 DO_TEST("q35-acpi-nouefi", NONE);
855 DO_TEST("clock-utc", NONE);
856 DO_TEST("clock-localtime", NONE);
857 DO_TEST("clock-localtime-basis-localtime", NONE);
858 DO_TEST("clock-variable", NONE);
859 DO_TEST("clock-france", NONE);
860 DO_TEST("clock-hpet-off", NONE);
861 DO_TEST("clock-catchup", QEMU_CAPS_KVM_PIT_TICK_POLICY);
862 DO_TEST("cpu-kvmclock", NONE);
863 DO_TEST("cpu-host-kvmclock", NONE);
864 DO_TEST("kvmclock", QEMU_CAPS_KVM);
865 DO_TEST("clock-timer-hyperv-rtc", QEMU_CAPS_KVM);
867 DO_TEST("cpu-eoi-disabled", NONE);
868 DO_TEST("cpu-eoi-enabled", NONE);
869 DO_TEST("controller-order",
870 QEMU_CAPS_KVM,
871 QEMU_CAPS_PIIX3_USB_UHCI,
872 QEMU_CAPS_CCID_PASSTHRU,
873 QEMU_CAPS_SPICE,
874 QEMU_CAPS_HDA_DUPLEX,
875 QEMU_CAPS_USB_HUB,
876 QEMU_CAPS_DEVICE_ISA_SERIAL,
877 QEMU_CAPS_DEVICE_CIRRUS_VGA);
878 DO_TEST_CAPS_VER("eoi-disabled", "2.7.0");
879 DO_TEST_CAPS_VER("eoi-disabled", "4.0.0");
880 DO_TEST_CAPS_LATEST("eoi-disabled");
881 DO_TEST_CAPS_VER("eoi-enabled", "2.7.0");
882 DO_TEST_CAPS_VER("eoi-enabled", "4.0.0");
883 DO_TEST_CAPS_LATEST("eoi-enabled");
884 DO_TEST_CAPS_VER("pv-spinlock-disabled", "2.7.0");
885 DO_TEST_CAPS_VER("pv-spinlock-disabled", "4.0.0");
886 DO_TEST_CAPS_LATEST("pv-spinlock-disabled");
887 DO_TEST_CAPS_VER("pv-spinlock-enabled", "2.7.0");
888 DO_TEST_CAPS_VER("pv-spinlock-enabled", "4.0.0");
889 DO_TEST_CAPS_LATEST("pv-spinlock-enabled");
890 DO_TEST_CAPS_VER("kvmclock+eoi-disabled", "2.7.0");
891 DO_TEST_CAPS_VER("kvmclock+eoi-disabled", "4.0.0");
892 DO_TEST_CAPS_LATEST("kvmclock+eoi-disabled");
894 DO_TEST("hyperv", NONE);
895 DO_TEST("hyperv-off", NONE);
896 DO_TEST("hyperv-panic", NONE);
898 DO_TEST("kvm-features", NONE);
899 DO_TEST("kvm-features-off", NONE);
901 DO_TEST("pmu-feature", NONE);
902 DO_TEST("pmu-feature-off", NONE);
904 DO_TEST("pages-discard",
905 QEMU_CAPS_OBJECT_MEMORY_FILE,
906 QEMU_CAPS_OBJECT_MEMORY_FILE_DISCARD);
907 DO_TEST("pages-discard-hugepages",
908 QEMU_CAPS_OBJECT_MEMORY_RAM,
909 QEMU_CAPS_OBJECT_MEMORY_FILE,
910 QEMU_CAPS_OBJECT_MEMORY_FILE_DISCARD);
911 DO_TEST("pages-dimm-discard",
912 QEMU_CAPS_DEVICE_PC_DIMM,
913 QEMU_CAPS_OBJECT_MEMORY_FILE,
914 QEMU_CAPS_OBJECT_MEMORY_FILE_DISCARD);
915 DO_TEST("hugepages-default", NONE);
916 DO_TEST("hugepages-default-2M", NONE);
917 DO_TEST("hugepages-default-system-size", NONE);
918 DO_TEST_PARSE_ERROR("hugepages-default-1G-nodeset-2M", NONE);
919 DO_TEST("hugepages-nodeset", NONE);
920 DO_TEST_PARSE_ERROR("hugepages-nodeset-nonexist",
921 QEMU_CAPS_DEVICE_PC_DIMM,
922 QEMU_CAPS_OBJECT_MEMORY_FILE,
923 QEMU_CAPS_OBJECT_MEMORY_FILE_DISCARD);
924 DO_TEST("hugepages-numa-default",
925 QEMU_CAPS_OBJECT_MEMORY_FILE);
926 DO_TEST("hugepages-numa-default-2M",
927 QEMU_CAPS_OBJECT_MEMORY_RAM,
928 QEMU_CAPS_OBJECT_MEMORY_FILE);
929 DO_TEST("hugepages-numa-default-dimm",
930 QEMU_CAPS_DEVICE_PC_DIMM,
931 QEMU_CAPS_OBJECT_MEMORY_FILE);
932 DO_TEST("hugepages-numa-nodeset",
933 QEMU_CAPS_OBJECT_MEMORY_RAM,
934 QEMU_CAPS_OBJECT_MEMORY_FILE);
935 DO_TEST("hugepages-numa-nodeset-part",
936 QEMU_CAPS_OBJECT_MEMORY_RAM,
937 QEMU_CAPS_OBJECT_MEMORY_FILE);
938 DO_TEST_PARSE_ERROR("hugepages-numa-nodeset-nonexist",
939 QEMU_CAPS_OBJECT_MEMORY_RAM,
940 QEMU_CAPS_OBJECT_MEMORY_FILE);
941 DO_TEST("hugepages-shared",
942 QEMU_CAPS_OBJECT_MEMORY_RAM,
943 QEMU_CAPS_OBJECT_MEMORY_FILE);
944 DO_TEST_PARSE_ERROR("hugepages-memaccess-invalid", NONE);
945 DO_TEST("hugepages-memaccess", QEMU_CAPS_OBJECT_MEMORY_FILE,
946 QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_DEVICE_PC_DIMM,
947 QEMU_CAPS_NUMA);
948 DO_TEST("hugepages-memaccess2", QEMU_CAPS_OBJECT_MEMORY_FILE,
949 QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_DEVICE_PC_DIMM,
950 QEMU_CAPS_NUMA);
951 DO_TEST_PARSE_ERROR("hugepages-memaccess3",
952 QEMU_CAPS_OBJECT_MEMORY_RAM,
953 QEMU_CAPS_OBJECT_MEMORY_FILE);
954 DO_TEST_CAPS_LATEST("hugepages-nvdimm");
955 DO_TEST("nosharepages", QEMU_CAPS_MEM_MERGE);
956 DO_TEST("disk-cdrom", NONE);
957 DO_TEST_CAPS_VER("disk-cdrom", "2.12.0");
958 DO_TEST_CAPS_LATEST("disk-cdrom");
959 DO_TEST_CAPS_LATEST("disk-cdrom-bus-other");
960 DO_TEST("disk-iscsi", NONE);
961 DO_TEST("disk-cdrom-network", QEMU_CAPS_KVM);
962 DO_TEST_CAPS_VER("disk-cdrom-network", "2.12.0");
963 DO_TEST_CAPS_LATEST("disk-cdrom-network");
964 DO_TEST("disk-cdrom-tray",
965 QEMU_CAPS_VIRTIO_TX_ALG);
966 DO_TEST_CAPS_VER("disk-cdrom-tray", "2.12.0");
967 DO_TEST_CAPS_LATEST("disk-cdrom-tray");
968 DO_TEST("disk-floppy", NONE);
969 DO_TEST_CAPS_VER("disk-floppy", "2.12.0");
970 DO_TEST_CAPS_LATEST("disk-floppy");
971 DO_TEST_CAPS_VER("disk-floppy-q35-2_9", "2.12.0");
972 DO_TEST_CAPS_LATEST("disk-floppy-q35-2_9");
973 DO_TEST_CAPS_VER("disk-floppy-q35-2_11", "2.12.0");
974 DO_TEST_CAPS_LATEST("disk-floppy-q35-2_11");
975 DO_TEST_FAILURE("disk-floppy-pseries",
976 QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE);
977 DO_TEST("disk-floppy-tray", NONE);
978 DO_TEST("disk-virtio-s390",
979 QEMU_CAPS_VIRTIO_S390);
980 DO_TEST("disk-virtio", NONE);
981 DO_TEST("disk-virtio-ccw",
982 QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
983 DO_TEST("disk-virtio-ccw-many",
984 QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
985 DO_TEST("disk-virtio-s390-zpci",
986 QEMU_CAPS_DEVICE_ZPCI,
987 QEMU_CAPS_CCW,
988 QEMU_CAPS_VIRTIO_S390);
989 DO_TEST("disk-order", QEMU_CAPS_VIRTIO_BLK_SCSI);
990 DO_TEST("disk-virtio-queues",
991 QEMU_CAPS_VIRTIO_BLK_NUM_QUEUES);
992 DO_TEST("disk-boot-disk", NONE);
993 DO_TEST("disk-boot-cdrom", NONE);
994 DO_TEST("floppy-drive-fat", NONE);
995 DO_TEST_CAPS_VER("floppy-drive-fat", "2.12.0");
996 DO_TEST_CAPS_LATEST("floppy-drive-fat");
997 DO_TEST("disk-readonly-disk", NONE);
998 DO_TEST_CAPS_VER("disk-readonly-disk", "2.12.0");
999 DO_TEST_CAPS_LATEST("disk-readonly-disk");
1000 DO_TEST("disk-fmt-qcow", NONE);
1001 DO_TEST_PARSE_ERROR("disk-fmt-cow", NONE);
1002 DO_TEST_PARSE_ERROR("disk-fmt-dir", NONE);
1003 DO_TEST_PARSE_ERROR("disk-fmt-iso", NONE);
1004 DO_TEST_CAPS_VER("disk-shared", "2.12.0");
1005 DO_TEST_CAPS_LATEST("disk-shared");
1006 DO_TEST_PARSE_ERROR("disk-shared-qcow", NONE);
1007 DO_TEST("disk-error-policy", NONE);
1008 DO_TEST_CAPS_VER("disk-error-policy", "2.12.0");
1009 DO_TEST_CAPS_LATEST("disk-error-policy");
1010 DO_TEST_CAPS_VER("disk-cache", "1.5.3");
1011 DO_TEST_CAPS_VER("disk-cache", "2.6.0");
1012 DO_TEST_CAPS_VER("disk-cache", "2.7.0");
1013 DO_TEST_CAPS_VER("disk-cache", "2.12.0");
1014 DO_TEST_CAPS_LATEST("disk-cache");
1015 DO_TEST("disk-network-nbd", NONE);
1016 DO_TEST_CAPS_VER("disk-network-nbd", "2.12.0");
1017 DO_TEST_CAPS_LATEST("disk-network-nbd");
1018 DO_TEST("disk-network-iscsi", QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_BLOCK);
1019 DO_TEST("disk-network-iscsi-modern",
1020 QEMU_CAPS_VIRTIO_SCSI,
1021 QEMU_CAPS_SCSI_BLOCK,
1022 QEMU_CAPS_ISCSI_PASSWORD_SECRET);
1023 DO_TEST_CAPS_VER("disk-network-iscsi", "2.12.0");
1024 DO_TEST_CAPS_LATEST("disk-network-iscsi");
1025 DO_TEST_PARSE_ERROR("disk-network-iscsi-auth-secrettype-invalid", NONE);
1026 DO_TEST_PARSE_ERROR("disk-network-iscsi-auth-wrong-secrettype", NONE);
1027 DO_TEST_PARSE_ERROR("disk-network-source-auth-both", NONE);
1028 DO_TEST("disk-network-gluster",
1029 QEMU_CAPS_GLUSTER_DEBUG_LEVEL);
1030 DO_TEST_CAPS_VER("disk-network-gluster", "2.12.0");
1031 DO_TEST_CAPS_LATEST("disk-network-gluster");
1032 DO_TEST_CAPS_VER("disk-network-rbd", "2.5.0");
1033 DO_TEST_CAPS_VER("disk-network-rbd", "2.12.0");
1034 DO_TEST_CAPS_LATEST("disk-network-rbd");
1035 DO_TEST_FAILURE("disk-network-rbd-no-colon", NONE);
1036 DO_TEST("disk-network-sheepdog", NONE);
1037 DO_TEST_CAPS_VER("disk-network-sheepdog", "2.12.0");
1038 DO_TEST_CAPS_LATEST("disk-network-sheepdog");
1039 DO_TEST("disk-network-source-auth", NONE);
1040 DO_TEST_CAPS_VER("disk-network-source-auth", "2.12.0");
1041 DO_TEST_CAPS_LATEST("disk-network-source-auth");
1042 DO_TEST("disk-network-vxhs", QEMU_CAPS_VXHS);
1043 driver.config->vxhsTLS = 1;
1044 DO_TEST("disk-network-tlsx509", QEMU_CAPS_VXHS,
1045 QEMU_CAPS_OBJECT_TLS_CREDS_X509, QEMU_CAPS_NBD_TLS);
1046 DO_TEST_CAPS_VER("disk-network-tlsx509", "2.12.0");
1047 DO_TEST_CAPS_LATEST("disk-network-tlsx509");
1048 driver.config->vxhsTLS = 0;
1049 VIR_FREE(driver.config->vxhsTLSx509certdir);
1050 DO_TEST("disk-no-boot", NONE);
1051 DO_TEST_PARSE_ERROR("disk-device-lun-type-invalid",
1052 QEMU_CAPS_VIRTIO_SCSI);
1053 DO_TEST_FAILURE("disk-usb-nosupport", NONE);
1054 DO_TEST("disk-usb-device",
1055 QEMU_CAPS_DEVICE_USB_STORAGE);
1056 DO_TEST("disk-usb-device-removable",
1057 QEMU_CAPS_DEVICE_USB_STORAGE,
1058 QEMU_CAPS_USB_STORAGE_REMOVABLE);
1059 DO_TEST_FAILURE("disk-usb-pci",
1060 QEMU_CAPS_DEVICE_USB_STORAGE);
1061 DO_TEST_CAPS_LATEST("disk-scsi");
1062 DO_TEST_CAPS_VER("disk-scsi-device-auto", "1.5.3");
1063 DO_TEST_CAPS_LATEST("disk-scsi-device-auto");
1064 DO_TEST("disk-scsi-disk-split",
1065 QEMU_CAPS_SCSI_LSI, QEMU_CAPS_VIRTIO_SCSI);
1066 DO_TEST("disk-scsi-disk-wwn",
1067 QEMU_CAPS_SCSI_LSI, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_DISK_WWN);
1068 DO_TEST("disk-scsi-disk-vpd",
1069 QEMU_CAPS_SCSI_LSI, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_DISK_WWN);
1070 DO_TEST_FAILURE("disk-scsi-disk-vpd-build-error",
1071 QEMU_CAPS_SCSI_LSI, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_DISK_WWN);
1072 DO_TEST_CAPS_LATEST("controller-virtio-scsi");
1073 DO_TEST("disk-sata-device",
1074 QEMU_CAPS_ICH9_AHCI);
1075 DO_TEST("disk-aio", NONE);
1076 DO_TEST_CAPS_VER("disk-aio", "2.12.0");
1077 DO_TEST_CAPS_LATEST("disk-aio");
1078 DO_TEST("disk-source-pool", NONE);
1079 DO_TEST("disk-source-pool-mode", NONE);
1080 DO_TEST("disk-ioeventfd",
1081 QEMU_CAPS_VIRTIO_IOEVENTFD,
1082 QEMU_CAPS_VIRTIO_TX_ALG,
1083 QEMU_CAPS_VIRTIO_BLK_SCSI);
1084 DO_TEST("disk-copy_on_read",
1085 QEMU_CAPS_VIRTIO_TX_ALG,
1086 QEMU_CAPS_VIRTIO_BLK_SCSI);
1087 DO_TEST_CAPS_VER("disk-copy_on_read", "2.12.0");
1088 DO_TEST_CAPS_LATEST("disk-copy_on_read");
1089 DO_TEST("disk-discard",
1090 QEMU_CAPS_DRIVE_DISCARD);
1091 DO_TEST("disk-detect-zeroes",
1092 QEMU_CAPS_DRIVE_DISCARD,
1093 QEMU_CAPS_DRIVE_DETECT_ZEROES);
1094 DO_TEST_CAPS_VER("disk-detect-zeroes", "2.12.0");
1095 DO_TEST_CAPS_LATEST("disk-detect-zeroes");
1096 DO_TEST("disk-snapshot", NONE);
1097 DO_TEST_PARSE_ERROR("disk-same-targets",
1098 QEMU_CAPS_SCSI_LSI,
1099 QEMU_CAPS_DEVICE_USB_STORAGE);
1100 DO_TEST_PARSE_ERROR("disk-address-conflict",
1101 QEMU_CAPS_ICH9_AHCI);
1102 DO_TEST_PARSE_ERROR("disk-hostdev-scsi-address-conflict",
1103 QEMU_CAPS_VIRTIO_SCSI);
1104 DO_TEST_PARSE_ERROR("hostdevs-drive-address-conflict",
1105 QEMU_CAPS_VIRTIO_SCSI);
1106 DO_TEST("event_idx",
1107 QEMU_CAPS_VIRTIO_BLK_EVENT_IDX,
1108 QEMU_CAPS_VIRTIO_NET_EVENT_IDX,
1109 QEMU_CAPS_VIRTIO_BLK_SCSI);
1110 DO_TEST("virtio-lun",
1111 QEMU_CAPS_VIRTIO_BLK_SCSI);
1112 DO_TEST("disk-scsi-lun-passthrough",
1113 QEMU_CAPS_SCSI_BLOCK,
1114 QEMU_CAPS_SCSI_LSI, QEMU_CAPS_VIRTIO_SCSI);
1115 DO_TEST("disk-serial",
1116 QEMU_CAPS_KVM);
1117 DO_TEST_PARSE_ERROR("disk-fdc-incompatible-address",
1118 NONE);
1119 DO_TEST_PARSE_ERROR("disk-ide-incompatible-address",
1120 NONE);
1121 DO_TEST_PARSE_ERROR("disk-sata-incompatible-address",
1122 QEMU_CAPS_ICH9_AHCI);
1123 DO_TEST_PARSE_ERROR("disk-scsi-incompatible-address",
1124 QEMU_CAPS_VIRTIO_SCSI);
1125 DO_TEST_CAPS_VER("disk-backing-chains-index", "2.12.0");
1126 DO_TEST_CAPS_LATEST("disk-backing-chains-index");
1127 DO_TEST_CAPS_VER("disk-backing-chains-noindex", "2.12.0");
1128 DO_TEST_CAPS_LATEST("disk-backing-chains-noindex");
1130 DO_TEST("graphics-egl-headless",
1131 QEMU_CAPS_EGL_HEADLESS,
1132 QEMU_CAPS_DEVICE_CIRRUS_VGA);
1133 DO_TEST_CAPS_LATEST("graphics-egl-headless");
1134 DO_TEST_CAPS_LATEST("graphics-egl-headless-rendernode");
1136 DO_TEST("graphics-vnc", QEMU_CAPS_VNC, QEMU_CAPS_DEVICE_CIRRUS_VGA);
1137 DO_TEST("graphics-vnc-socket", QEMU_CAPS_VNC, QEMU_CAPS_DEVICE_CIRRUS_VGA);
1138 DO_TEST("graphics-vnc-websocket",
1139 QEMU_CAPS_VNC,
1140 QEMU_CAPS_DEVICE_CIRRUS_VGA);
1141 DO_TEST("graphics-vnc-policy", QEMU_CAPS_VNC,
1142 QEMU_CAPS_DEVICE_CIRRUS_VGA);
1143 DO_TEST("graphics-vnc-no-listen-attr", QEMU_CAPS_VNC,
1144 QEMU_CAPS_DEVICE_CIRRUS_VGA);
1145 DO_TEST("graphics-vnc-remove-generated-socket", QEMU_CAPS_VNC,
1146 QEMU_CAPS_DEVICE_CIRRUS_VGA);
1147 driver.config->vncAutoUnixSocket = true;
1148 DO_TEST("graphics-vnc-auto-socket-cfg", QEMU_CAPS_VNC,
1149 QEMU_CAPS_DEVICE_CIRRUS_VGA);
1150 driver.config->vncAutoUnixSocket = false;
1151 DO_TEST("graphics-vnc-socket", QEMU_CAPS_VNC, QEMU_CAPS_DEVICE_CIRRUS_VGA);
1152 DO_TEST("graphics-vnc-auto-socket", QEMU_CAPS_VNC,
1153 QEMU_CAPS_DEVICE_CIRRUS_VGA);
1154 DO_TEST("graphics-vnc-none", QEMU_CAPS_VNC, QEMU_CAPS_DEVICE_CIRRUS_VGA);
1155 DO_TEST("graphics-vnc-socket-new-cmdline", QEMU_CAPS_VNC,
1156 QEMU_CAPS_DEVICE_CIRRUS_VGA, QEMU_CAPS_VNC_MULTI_SERVERS);
1158 driver.config->vncSASL = 1;
1159 VIR_FREE(driver.config->vncSASLdir);
1160 ignore_value(VIR_STRDUP(driver.config->vncSASLdir, "/root/.sasl2"));
1161 DO_TEST("graphics-vnc-sasl", QEMU_CAPS_VNC, QEMU_CAPS_DEVICE_CIRRUS_VGA);
1162 driver.config->vncTLS = 1;
1163 driver.config->vncTLSx509verify = 1;
1164 DO_TEST("graphics-vnc-tls", QEMU_CAPS_VNC, QEMU_CAPS_DEVICE_CIRRUS_VGA);
1165 DO_TEST_CAPS_VER("graphics-vnc-tls", "2.4.0");
1166 DO_TEST_CAPS_LATEST("graphics-vnc-tls");
1167 if (VIR_STRDUP_QUIET(driver.config->vncTLSx509secretUUID,
1168 "6fd3f62d-9fe7-4a4e-a869-7acd6376d8ea") < 0)
1169 return EXIT_FAILURE;
1170 DO_TEST_CAPS_LATEST("graphics-vnc-tls-secret");
1171 VIR_FREE(driver.config->vncTLSx509secretUUID);
1172 driver.config->vncSASL = driver.config->vncTLSx509verify = driver.config->vncTLS = 0;
1173 VIR_FREE(driver.config->vncSASLdir);
1174 VIR_FREE(driver.config->vncTLSx509certdir);
1175 DO_TEST("graphics-vnc-egl-headless",
1176 QEMU_CAPS_VNC,
1177 QEMU_CAPS_EGL_HEADLESS,
1178 QEMU_CAPS_DEVICE_CIRRUS_VGA);
1180 DO_TEST("graphics-sdl",
1181 QEMU_CAPS_DEVICE_VGA);
1182 DO_TEST_CAPS_LATEST_PARSE_ERROR("graphics-sdl-egl-headless");
1183 DO_TEST("graphics-sdl-fullscreen",
1184 QEMU_CAPS_DEVICE_CIRRUS_VGA);
1185 DO_TEST("graphics-spice",
1186 QEMU_CAPS_SPICE,
1187 QEMU_CAPS_DEVICE_QXL,
1188 QEMU_CAPS_SPICE_FILE_XFER_DISABLE);
1189 DO_TEST("graphics-spice-no-args",
1190 QEMU_CAPS_SPICE, QEMU_CAPS_DEVICE_CIRRUS_VGA);
1191 driver.config->spiceSASL = 1;
1192 ignore_value(VIR_STRDUP(driver.config->spiceSASLdir, "/root/.sasl2"));
1193 DO_TEST("graphics-spice-sasl",
1194 QEMU_CAPS_SPICE,
1195 QEMU_CAPS_DEVICE_QXL);
1196 VIR_FREE(driver.config->spiceSASLdir);
1197 driver.config->spiceSASL = 0;
1198 DO_TEST("graphics-spice-agentmouse",
1199 QEMU_CAPS_DEVICE_QXL,
1200 QEMU_CAPS_SPICE,
1201 QEMU_CAPS_DEVICE_CIRRUS_VGA);
1202 DO_TEST("graphics-spice-compression",
1203 QEMU_CAPS_SPICE,
1204 QEMU_CAPS_DEVICE_QXL);
1205 DO_TEST("graphics-spice-timeout",
1206 QEMU_CAPS_KVM,
1207 QEMU_CAPS_SPICE,
1208 QEMU_CAPS_DEVICE_QXL,
1209 QEMU_CAPS_DEVICE_VGA);
1210 DO_TEST("graphics-spice-qxl-vga",
1211 QEMU_CAPS_SPICE,
1212 QEMU_CAPS_DEVICE_QXL);
1213 DO_TEST("graphics-spice-usb-redir",
1214 QEMU_CAPS_SPICE,
1215 QEMU_CAPS_USB_HUB,
1216 QEMU_CAPS_ICH9_USB_EHCI1,
1217 QEMU_CAPS_USB_REDIR,
1218 QEMU_CAPS_DEVICE_CIRRUS_VGA);
1219 DO_TEST("graphics-spice-agent-file-xfer",
1220 QEMU_CAPS_SPICE,
1221 QEMU_CAPS_DEVICE_QXL,
1222 QEMU_CAPS_SPICE_FILE_XFER_DISABLE);
1223 DO_TEST("graphics-spice-socket",
1224 QEMU_CAPS_SPICE,
1225 QEMU_CAPS_SPICE_UNIX,
1226 QEMU_CAPS_DEVICE_CIRRUS_VGA);
1227 DO_TEST("graphics-spice-auto-socket",
1228 QEMU_CAPS_SPICE,
1229 QEMU_CAPS_SPICE_UNIX,
1230 QEMU_CAPS_DEVICE_CIRRUS_VGA);
1231 driver.config->spiceAutoUnixSocket = true;
1232 DO_TEST("graphics-spice-auto-socket-cfg",
1233 QEMU_CAPS_SPICE,
1234 QEMU_CAPS_SPICE_UNIX,
1235 QEMU_CAPS_DEVICE_CIRRUS_VGA);
1236 driver.config->spiceAutoUnixSocket = false;
1237 DO_TEST("graphics-spice-egl-headless",
1238 QEMU_CAPS_SPICE,
1239 QEMU_CAPS_EGL_HEADLESS,
1240 QEMU_CAPS_DEVICE_QXL);
1241 DO_TEST_CAPS_LATEST_PARSE_ERROR("graphics-spice-invalid-egl-headless");
1242 DO_TEST_CAPS_LATEST("graphics-spice-gl-auto-rendernode");
1244 DO_TEST("input-usbmouse", NONE);
1245 DO_TEST("input-usbtablet", NONE);
1246 DO_TEST("misc-acpi", NONE);
1247 DO_TEST("misc-disable-s3", QEMU_CAPS_PIIX_DISABLE_S3);
1248 DO_TEST("misc-disable-suspends", QEMU_CAPS_PIIX_DISABLE_S3, QEMU_CAPS_PIIX_DISABLE_S4);
1249 DO_TEST("misc-enable-s4", QEMU_CAPS_PIIX_DISABLE_S4);
1250 DO_TEST_FAILURE("misc-enable-s4", NONE);
1251 DO_TEST("misc-no-reboot", NONE);
1252 DO_TEST("misc-uuid", NONE);
1253 DO_TEST_PARSE_ERROR("vhost_queues-invalid", NONE);
1254 DO_TEST("net-vhostuser", QEMU_CAPS_CHARDEV_FD_PASS);
1255 DO_TEST_CAPS_VER("net-vhostuser", "2.5.0");
1256 DO_TEST_CAPS_LATEST("net-vhostuser");
1257 DO_TEST("net-vhostuser-multiq",
1258 QEMU_CAPS_VHOSTUSER_MULTIQUEUE);
1259 DO_TEST_FAILURE("net-vhostuser-multiq", NONE);
1260 DO_TEST_FAILURE("net-vhostuser-fail",
1261 QEMU_CAPS_VHOSTUSER_MULTIQUEUE);
1262 DO_TEST("net-user", NONE);
1263 DO_TEST("net-user-addr", NONE);
1264 DO_TEST("net-virtio", NONE);
1265 DO_TEST("net-virtio-device",
1266 QEMU_CAPS_VIRTIO_TX_ALG);
1267 DO_TEST("net-virtio-disable-offloads", NONE);
1268 DO_TEST("net-virtio-netdev", NONE);
1269 DO_TEST("net-virtio-s390",
1270 QEMU_CAPS_VIRTIO_S390);
1271 DO_TEST("net-virtio-ccw",
1272 QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
1273 DO_TEST("net-virtio-rxtxqueuesize",
1274 QEMU_CAPS_VIRTIO_NET_RX_QUEUE_SIZE,
1275 QEMU_CAPS_VIRTIO_NET_TX_QUEUE_SIZE);
1276 DO_TEST_PARSE_ERROR("net-virtio-rxqueuesize-invalid-size", NONE);
1277 DO_TEST("net-eth", NONE);
1278 DO_TEST("net-eth-ifname", NONE);
1279 DO_TEST("net-eth-names", NONE);
1280 DO_TEST("net-eth-hostip", NONE);
1281 DO_TEST("net-client", NONE);
1282 DO_TEST("net-server", NONE);
1283 DO_TEST("net-many-models", NONE);
1284 DO_TEST("net-mcast", NONE);
1285 DO_TEST("net-udp", NONE);
1286 DO_TEST("net-hostdev", NONE);
1287 DO_TEST("net-hostdev-bootorder", NONE);
1288 DO_TEST("net-hostdev-multidomain", NONE);
1289 DO_TEST("net-hostdev-vfio",
1290 QEMU_CAPS_DEVICE_VFIO_PCI);
1291 DO_TEST("net-hostdev-vfio-multidomain",
1292 QEMU_CAPS_DEVICE_VFIO_PCI);
1293 DO_TEST_FAILURE("net-hostdev-fail",
1294 QEMU_CAPS_DEVICE_VFIO_PCI);
1297 DO_TEST("serial-file-log",
1298 QEMU_CAPS_CHARDEV_FILE_APPEND,
1299 QEMU_CAPS_DEVICE_ISA_SERIAL,
1300 QEMU_CAPS_CHARDEV_LOGFILE);
1301 DO_TEST("serial-spiceport",
1302 QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
1303 QEMU_CAPS_DEVICE_QXL,
1304 QEMU_CAPS_SPICE,
1305 QEMU_CAPS_DEVICE_ISA_SERIAL);
1306 DO_TEST("serial-spiceport-nospice", NONE);
1308 DO_TEST("console-compat",
1309 QEMU_CAPS_DEVICE_ISA_SERIAL);
1310 DO_TEST("console-compat-auto",
1311 QEMU_CAPS_DEVICE_ISA_SERIAL);
1313 DO_TEST("serial-vc-chardev",
1314 QEMU_CAPS_DEVICE_ISA_SERIAL);
1315 DO_TEST("serial-pty-chardev",
1316 QEMU_CAPS_DEVICE_ISA_SERIAL);
1317 DO_TEST("serial-dev-chardev",
1318 QEMU_CAPS_DEVICE_ISA_SERIAL);
1319 DO_TEST("serial-dev-chardev-iobase",
1320 QEMU_CAPS_DEVICE_ISA_SERIAL);
1321 DO_TEST("serial-file-chardev",
1322 QEMU_CAPS_DEVICE_ISA_SERIAL,
1323 QEMU_CAPS_CHARDEV_FILE_APPEND);
1324 DO_TEST("serial-unix-chardev",
1325 QEMU_CAPS_DEVICE_ISA_SERIAL);
1326 DO_TEST_CAPS_LATEST("serial-unix-chardev");
1327 DO_TEST_PARSE_ERROR("serial-unix-missing-source", NONE);
1328 DO_TEST("serial-tcp-chardev",
1329 QEMU_CAPS_DEVICE_ISA_SERIAL);
1330 DO_TEST("serial-udp-chardev",
1331 QEMU_CAPS_DEVICE_ISA_SERIAL);
1332 DO_TEST("serial-tcp-telnet-chardev",
1333 QEMU_CAPS_DEVICE_ISA_SERIAL);
1334 driver.config->chardevTLS = 1;
1335 DO_TEST("serial-tcp-tlsx509-chardev",
1336 QEMU_CAPS_DEVICE_ISA_SERIAL,
1337 QEMU_CAPS_OBJECT_TLS_CREDS_X509);
1338 driver.config->chardevTLSx509verify = 1;
1339 DO_TEST("serial-tcp-tlsx509-chardev-verify",
1340 QEMU_CAPS_DEVICE_ISA_SERIAL,
1341 QEMU_CAPS_OBJECT_TLS_CREDS_X509);
1342 driver.config->chardevTLSx509verify = 0;
1343 DO_TEST("serial-tcp-tlsx509-chardev-notls",
1344 QEMU_CAPS_DEVICE_ISA_SERIAL,
1345 QEMU_CAPS_OBJECT_TLS_CREDS_X509);
1346 VIR_FREE(driver.config->chardevTLSx509certdir);
1347 if (VIR_STRDUP_QUIET(driver.config->chardevTLSx509certdir, "/etc/pki/libvirt-chardev") < 0)
1348 return EXIT_FAILURE;
1349 if (VIR_STRDUP_QUIET(driver.config->chardevTLSx509secretUUID,
1350 "6fd3f62d-9fe7-4a4e-a869-7acd6376d8ea") < 0)
1351 return EXIT_FAILURE;
1352 DO_TEST("serial-tcp-tlsx509-secret-chardev",
1353 QEMU_CAPS_OBJECT_SECRET,
1354 QEMU_CAPS_DEVICE_ISA_SERIAL,
1355 QEMU_CAPS_OBJECT_TLS_CREDS_X509);
1356 driver.config->chardevTLS = 0;
1357 VIR_FREE(driver.config->chardevTLSx509certdir);
1358 DO_TEST("serial-many-chardev",
1359 QEMU_CAPS_DEVICE_ISA_SERIAL);
1360 DO_TEST("parallel-tcp-chardev", NONE);
1361 DO_TEST("parallel-parport-chardev", NONE);
1362 DO_TEST_CAPS_VER("parallel-unix-chardev", "2.5.0");
1363 DO_TEST_CAPS_LATEST("parallel-unix-chardev");
1364 DO_TEST("console-compat-chardev",
1365 QEMU_CAPS_DEVICE_ISA_SERIAL);
1366 DO_TEST("pci-serial-dev-chardev",
1367 QEMU_CAPS_DEVICE_PCI_SERIAL);
1369 DO_TEST("channel-guestfwd", NONE);
1370 DO_TEST_CAPS_VER("channel-unix-guestfwd", "2.5.0");
1371 DO_TEST_CAPS_LATEST("channel-unix-guestfwd");
1372 DO_TEST("channel-virtio", NONE);
1373 DO_TEST("channel-virtio-state", NONE);
1374 DO_TEST("channel-virtio-auto", NONE);
1375 DO_TEST("channel-virtio-autoassign", NONE);
1376 DO_TEST("channel-virtio-autoadd", NONE);
1377 DO_TEST("console-virtio", NONE);
1378 DO_TEST("console-virtio-many",
1379 QEMU_CAPS_DEVICE_ISA_SERIAL);
1380 DO_TEST("console-virtio-s390",
1381 QEMU_CAPS_VIRTIO_S390);
1382 DO_TEST("console-virtio-ccw",
1383 QEMU_CAPS_CCW,
1384 QEMU_CAPS_VIRTIO_S390);
1385 DO_TEST_CAPS_VER("console-virtio-unix", "2.5.0");
1386 DO_TEST_CAPS_LATEST("console-virtio-unix");
1387 DO_TEST("console-sclp",
1388 QEMU_CAPS_VIRTIO_S390,
1389 QEMU_CAPS_DEVICE_SCLPCONSOLE);
1390 DO_TEST("channel-spicevmc",
1391 QEMU_CAPS_SPICE,
1392 QEMU_CAPS_DEVICE_CIRRUS_VGA);
1393 DO_TEST("channel-virtio-default",
1394 QEMU_CAPS_SPICE);
1395 DO_TEST("channel-virtio-unix", NONE);
1397 DO_TEST("smartcard-host",
1398 QEMU_CAPS_CCID_EMULATED);
1399 DO_TEST("smartcard-host-certificates",
1400 QEMU_CAPS_CCID_EMULATED);
1401 DO_TEST("smartcard-host-certificates-database",
1402 QEMU_CAPS_CCID_EMULATED);
1403 DO_TEST("smartcard-passthrough-tcp",
1404 QEMU_CAPS_CCID_PASSTHRU);
1405 DO_TEST("smartcard-passthrough-spicevmc",
1406 QEMU_CAPS_CCID_PASSTHRU);
1407 DO_TEST("smartcard-controller",
1408 QEMU_CAPS_CCID_EMULATED);
1409 DO_TEST_CAPS_VER("smartcard-passthrough-unix", "2.5.0");
1410 DO_TEST_CAPS_LATEST("smartcard-passthrough-unix");
1412 DO_TEST("chardev-reconnect",
1413 QEMU_CAPS_CHARDEV_RECONNECT,
1414 QEMU_CAPS_USB_REDIR,
1415 QEMU_CAPS_DEVICE_VIRTIO_RNG,
1416 QEMU_CAPS_OBJECT_RNG_EGD,
1417 QEMU_CAPS_CCID_PASSTHRU);
1418 DO_TEST_PARSE_ERROR("chardev-reconnect-invalid-timeout",
1419 QEMU_CAPS_CHARDEV_RECONNECT);
1420 DO_TEST_PARSE_ERROR("chardev-reconnect-generated-path",
1421 QEMU_CAPS_CHARDEV_RECONNECT);
1423 DO_TEST("usb-controller", NONE);
1424 DO_TEST("usb-piix3-controller",
1425 QEMU_CAPS_PIIX3_USB_UHCI);
1426 DO_TEST("usb-ich9-ehci-addr",
1427 QEMU_CAPS_ICH9_USB_EHCI1);
1428 DO_TEST("input-usbmouse-addr", NONE);
1429 DO_TEST("usb-ich9-companion",
1430 QEMU_CAPS_ICH9_USB_EHCI1);
1431 DO_TEST_PARSE_ERROR("usb-ich9-no-companion",
1432 QEMU_CAPS_ICH9_USB_EHCI1);
1433 DO_TEST("usb-ich9-autoassign",
1434 QEMU_CAPS_ICH9_USB_EHCI1,
1435 QEMU_CAPS_USB_HUB);
1436 DO_TEST("usb-hub",
1437 QEMU_CAPS_USB_HUB);
1438 DO_TEST("usb-hub-autoadd",
1439 QEMU_CAPS_USB_HUB);
1440 DO_TEST("usb-hub-autoadd-deluxe",
1441 QEMU_CAPS_USB_HUB);
1442 DO_TEST_PARSE_ERROR("usb-hub-conflict",
1443 QEMU_CAPS_USB_HUB);
1444 DO_TEST_PARSE_ERROR("usb-hub-nonexistent",
1445 QEMU_CAPS_USB_HUB);
1446 DO_TEST("usb-port-missing",
1447 QEMU_CAPS_USB_HUB);
1448 DO_TEST_FAILURE("usb-bus-missing",
1449 QEMU_CAPS_USB_HUB);
1450 DO_TEST("usb-ports",
1451 QEMU_CAPS_USB_HUB);
1452 DO_TEST_PARSE_ERROR("usb-ports-out-of-range",
1453 QEMU_CAPS_USB_HUB);
1454 DO_TEST("usb-port-autoassign",
1455 QEMU_CAPS_USB_HUB);
1456 DO_TEST("usb-redir",
1457 QEMU_CAPS_USB_HUB,
1458 QEMU_CAPS_ICH9_USB_EHCI1,
1459 QEMU_CAPS_USB_REDIR,
1460 QEMU_CAPS_SPICE);
1461 DO_TEST("usb-redir-boot",
1462 QEMU_CAPS_USB_HUB,
1463 QEMU_CAPS_ICH9_USB_EHCI1,
1464 QEMU_CAPS_USB_REDIR,
1465 QEMU_CAPS_SPICE);
1466 DO_TEST("usb-redir-filter",
1467 QEMU_CAPS_USB_HUB,
1468 QEMU_CAPS_ICH9_USB_EHCI1,
1469 QEMU_CAPS_USB_REDIR,
1470 QEMU_CAPS_SPICE,
1471 QEMU_CAPS_USB_REDIR_FILTER);
1472 DO_TEST("usb-redir-filter-version",
1473 QEMU_CAPS_USB_REDIR,
1474 QEMU_CAPS_SPICE,
1475 QEMU_CAPS_USB_REDIR_FILTER);
1476 DO_TEST_CAPS_VER("usb-redir-unix", "2.5.0");
1477 DO_TEST_CAPS_LATEST("usb-redir-unix");
1478 DO_TEST("usb1-usb2",
1479 QEMU_CAPS_PIIX3_USB_UHCI,
1480 QEMU_CAPS_USB_HUB,
1481 QEMU_CAPS_ICH9_USB_EHCI1);
1482 DO_TEST("usb-none", NONE);
1483 DO_TEST_PARSE_ERROR("usb-none-other", NONE);
1484 DO_TEST_PARSE_ERROR("usb-none-hub",
1485 QEMU_CAPS_USB_HUB);
1486 DO_TEST_PARSE_ERROR("usb-none-usbtablet", NONE);
1487 DO_TEST("usb-controller-default-q35",
1488 QEMU_CAPS_DEVICE_IOH3420,
1489 QEMU_CAPS_PCI_OHCI,
1490 QEMU_CAPS_PIIX3_USB_UHCI,
1491 QEMU_CAPS_NEC_USB_XHCI);
1492 DO_TEST_FAILURE("usb-controller-default-unavailable-q35",
1493 QEMU_CAPS_DEVICE_IOH3420,
1494 QEMU_CAPS_PCI_OHCI,
1495 QEMU_CAPS_NEC_USB_XHCI);
1496 DO_TEST("usb-controller-explicit-q35",
1497 QEMU_CAPS_DEVICE_IOH3420,
1498 QEMU_CAPS_PCI_OHCI,
1499 QEMU_CAPS_PIIX3_USB_UHCI,
1500 QEMU_CAPS_NEC_USB_XHCI);
1501 DO_TEST_FAILURE("usb-controller-explicit-unavailable-q35",
1502 QEMU_CAPS_DEVICE_IOH3420,
1503 QEMU_CAPS_PCI_OHCI,
1504 QEMU_CAPS_PIIX3_USB_UHCI);
1505 DO_TEST("usb-controller-xhci",
1506 QEMU_CAPS_PIIX3_USB_UHCI,
1507 QEMU_CAPS_NEC_USB_XHCI,
1508 QEMU_CAPS_NEC_USB_XHCI_PORTS);
1509 DO_TEST("usb-xhci-autoassign",
1510 QEMU_CAPS_PIIX3_USB_UHCI,
1511 QEMU_CAPS_NEC_USB_XHCI,
1512 QEMU_CAPS_NEC_USB_XHCI_PORTS,
1513 QEMU_CAPS_USB_HUB);
1514 DO_TEST_PARSE_ERROR("usb-controller-xhci-limit",
1515 QEMU_CAPS_PIIX3_USB_UHCI,
1516 QEMU_CAPS_NEC_USB_XHCI,
1517 QEMU_CAPS_NEC_USB_XHCI_PORTS);
1518 DO_TEST("usb-controller-qemu-xhci", QEMU_CAPS_DEVICE_QEMU_XHCI);
1519 DO_TEST_FAILURE("usb-controller-qemu-xhci-unavailable", NONE);
1520 DO_TEST_PARSE_ERROR("usb-controller-qemu-xhci-limit",
1521 QEMU_CAPS_DEVICE_QEMU_XHCI);
1523 DO_TEST("smbios", NONE);
1524 DO_TEST_PARSE_ERROR("smbios-date", NONE);
1525 DO_TEST_PARSE_ERROR("smbios-uuid-match", NONE);
1527 DO_TEST("watchdog", NONE);
1528 DO_TEST("watchdog-device", NONE);
1529 DO_TEST("watchdog-dump", NONE);
1530 DO_TEST("watchdog-injectnmi", NONE);
1531 DO_TEST("watchdog-diag288", QEMU_CAPS_VIRTIO_S390);
1532 DO_TEST("balloon-device", NONE);
1533 DO_TEST("balloon-device-deflate",
1534 QEMU_CAPS_VIRTIO_BALLOON_AUTODEFLATE);
1535 DO_TEST("balloon-ccw-deflate",
1536 QEMU_CAPS_VIRTIO_BALLOON_AUTODEFLATE);
1537 DO_TEST("balloon-mmio-deflate",
1538 QEMU_CAPS_DEVICE_VIRTIO_MMIO,
1539 QEMU_CAPS_VIRTIO_BALLOON_AUTODEFLATE);
1540 DO_TEST("balloon-device-deflate-off",
1541 QEMU_CAPS_VIRTIO_BALLOON_AUTODEFLATE);
1542 DO_TEST("balloon-device-auto", NONE);
1543 DO_TEST("balloon-device-period", NONE);
1544 DO_TEST("sound", NONE);
1545 DO_TEST("sound-device",
1546 QEMU_CAPS_HDA_DUPLEX, QEMU_CAPS_HDA_MICRO,
1547 QEMU_CAPS_HDA_OUTPUT,
1548 QEMU_CAPS_DEVICE_ICH9_INTEL_HDA,
1549 QEMU_CAPS_OBJECT_USB_AUDIO);
1550 DO_TEST("fs9p", NONE);
1551 DO_TEST("fs9p-ccw",
1552 QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
1554 DO_TEST("hostdev-usb-address", NONE);
1555 DO_TEST("hostdev-usb-address-device", NONE);
1556 DO_TEST("hostdev-usb-address-device-boot", NONE);
1557 DO_TEST("hostdev-pci-address", NONE);
1558 DO_TEST("hostdev-pci-address-device", NONE);
1559 DO_TEST("hostdev-vfio",
1560 QEMU_CAPS_DEVICE_VFIO_PCI);
1561 DO_TEST("hostdev-vfio-multidomain",
1562 QEMU_CAPS_DEVICE_VFIO_PCI);
1563 DO_TEST("hostdev-mdev-precreated",
1564 QEMU_CAPS_DEVICE_VFIO_PCI);
1565 DO_TEST_PARSE_ERROR("hostdev-mdev-src-address-invalid",
1566 QEMU_CAPS_DEVICE_VFIO_PCI);
1567 DO_TEST_PARSE_ERROR("hostdev-mdev-invalid-target-address",
1568 QEMU_CAPS_DEVICE_VFIO_PCI);
1569 DO_TEST_CAPS_LATEST("hostdev-mdev-display-spice-opengl");
1570 DO_TEST_CAPS_LATEST("hostdev-mdev-display-spice-egl-headless");
1571 DO_TEST_CAPS_LATEST("hostdev-mdev-display-vnc");
1572 DO_TEST_CAPS_LATEST("hostdev-mdev-display-vnc-egl-headless");
1573 DO_TEST_PARSE_ERROR("hostdev-mdev-display-missing-graphics",
1574 QEMU_CAPS_DEVICE_VFIO_PCI,
1575 QEMU_CAPS_VFIO_PCI_DISPLAY);
1576 DO_TEST_PARSE_ERROR("hostdev-vfio-zpci-wrong-arch",
1577 QEMU_CAPS_DEVICE_VFIO_PCI);
1578 DO_TEST("hostdev-vfio-zpci",
1579 QEMU_CAPS_DEVICE_VFIO_PCI,
1580 QEMU_CAPS_DEVICE_ZPCI);
1581 DO_TEST("hostdev-vfio-zpci-multidomain-many",
1582 QEMU_CAPS_DEVICE_VFIO_PCI,
1583 QEMU_CAPS_DEVICE_PCI_BRIDGE,
1584 QEMU_CAPS_DEVICE_ZPCI);
1585 DO_TEST("hostdev-vfio-zpci-autogenerate",
1586 QEMU_CAPS_DEVICE_VFIO_PCI,
1587 QEMU_CAPS_DEVICE_ZPCI);
1588 DO_TEST("hostdev-vfio-zpci-boundaries",
1589 QEMU_CAPS_DEVICE_VFIO_PCI,
1590 QEMU_CAPS_DEVICE_PCI_BRIDGE,
1591 QEMU_CAPS_DEVICE_ZPCI);
1592 DO_TEST_PARSE_ERROR("hostdev-vfio-zpci",
1593 QEMU_CAPS_DEVICE_VFIO_PCI);
1594 DO_TEST("pci-rom", NONE);
1595 DO_TEST("pci-rom-disabled", NONE);
1596 DO_TEST("pci-rom-disabled-invalid", NONE);
1598 DO_TEST("hostdev-subsys-mdev-vfio-ccw",
1599 QEMU_CAPS_CCW,
1600 QEMU_CAPS_CCW_CSSID_UNRESTRICTED,
1601 QEMU_CAPS_DEVICE_VFIO_CCW);
1602 DO_TEST_FAILURE("hostdev-subsys-mdev-vfio-ccw",
1603 QEMU_CAPS_CCW,
1604 QEMU_CAPS_CCW_CSSID_UNRESTRICTED);
1605 DO_TEST_PARSE_ERROR("hostdev-subsys-mdev-vfio-ccw-duplicate-address",
1606 QEMU_CAPS_CCW,
1607 QEMU_CAPS_CCW_CSSID_UNRESTRICTED,
1608 QEMU_CAPS_DEVICE_VFIO_CCW);
1609 DO_TEST_PARSE_ERROR("hostdev-subsys-mdev-vfio-ccw-invalid-address",
1610 QEMU_CAPS_CCW,
1611 QEMU_CAPS_CCW_CSSID_UNRESTRICTED,
1612 QEMU_CAPS_DEVICE_VFIO_CCW);
1614 DO_TEST_FULL("restore-v2",
1615 ARG_MIGRATE_FROM, "exec:cat",
1616 ARG_MIGRATE_FD, 7,
1617 ARG_QEMU_CAPS, NONE);
1618 DO_TEST_FULL("restore-v2-fd",
1619 ARG_MIGRATE_FROM, "stdio",
1620 ARG_MIGRATE_FD, 7,
1621 ARG_QEMU_CAPS, NONE);
1622 DO_TEST_FULL("restore-v2-fd",
1623 ARG_MIGRATE_FROM, "fd:7",
1624 ARG_MIGRATE_FD, 7,
1625 ARG_QEMU_CAPS, NONE);
1626 DO_TEST_FULL("migrate",
1627 ARG_MIGRATE_FROM, "tcp:10.0.0.1:5000",
1628 ARG_QEMU_CAPS, NONE);
1630 DO_TEST_FULL("migrate-numa-unaligned",
1631 ARG_MIGRATE_FROM, "stdio",
1632 ARG_MIGRATE_FD, 7,
1633 ARG_QEMU_CAPS,
1634 QEMU_CAPS_NUMA,
1635 QEMU_CAPS_OBJECT_MEMORY_RAM);
1637 DO_TEST_CAPS_VER("qemu-ns", "4.0.0");
1638 DO_TEST_CAPS_LATEST("qemu-ns");
1639 DO_TEST("qemu-ns-no-env", NONE);
1640 DO_TEST("qemu-ns-alt", NONE);
1642 DO_TEST("smp", NONE);
1644 DO_TEST("iothreads", QEMU_CAPS_OBJECT_IOTHREAD);
1645 DO_TEST("iothreads-ids", QEMU_CAPS_OBJECT_IOTHREAD);
1646 DO_TEST("iothreads-ids-partial", QEMU_CAPS_OBJECT_IOTHREAD);
1647 DO_TEST_FAILURE("iothreads-nocap", NONE);
1648 DO_TEST("iothreads-disk", QEMU_CAPS_OBJECT_IOTHREAD);
1649 DO_TEST("iothreads-disk-virtio-ccw", QEMU_CAPS_OBJECT_IOTHREAD,
1650 QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
1651 DO_TEST_CAPS_LATEST("iothreads-virtio-scsi-pci");
1652 DO_TEST_CAPS_ARCH_LATEST("iothreads-virtio-scsi-ccw", "s390x");
1654 DO_TEST("cpu-topology1", NONE);
1655 DO_TEST("cpu-topology2", NONE);
1656 DO_TEST("cpu-topology3", NONE);
1657 DO_TEST("cpu-minimum1", QEMU_CAPS_KVM);
1658 DO_TEST("cpu-minimum2", QEMU_CAPS_KVM);
1659 DO_TEST("cpu-exact1", QEMU_CAPS_KVM);
1660 DO_TEST("cpu-exact2", QEMU_CAPS_KVM);
1661 DO_TEST("cpu-exact2-nofallback", QEMU_CAPS_KVM);
1662 DO_TEST("cpu-fallback", QEMU_CAPS_KVM);
1663 DO_TEST_FAILURE("cpu-nofallback", QEMU_CAPS_KVM);
1664 DO_TEST("cpu-strict1", QEMU_CAPS_KVM);
1665 DO_TEST("cpu-no-removed-features", QEMU_CAPS_KVM);
1666 DO_TEST("cpu-numa1", NONE);
1667 DO_TEST("cpu-numa2", NONE);
1668 DO_TEST("cpu-numa-no-memory-element", NONE);
1669 DO_TEST_PARSE_ERROR("cpu-numa3", NONE);
1670 DO_TEST_FAILURE("cpu-numa-disjoint", NONE);
1671 DO_TEST("cpu-numa-disjoint", QEMU_CAPS_NUMA);
1672 DO_TEST_FAILURE("cpu-numa-memshared", QEMU_CAPS_OBJECT_MEMORY_RAM);
1673 DO_TEST_FAILURE("cpu-numa-memshared", NONE);
1674 DO_TEST("cpu-numa-memshared", QEMU_CAPS_OBJECT_MEMORY_FILE);
1675 DO_TEST("cpu-host-model", NONE);
1676 DO_TEST("cpu-host-model-vendor", NONE);
1677 DO_TEST_FULL("cpu-host-model-fallback",
1678 ARG_FLAGS, FLAG_SKIP_LEGACY_CPUS,
1679 ARG_QEMU_CAPS, NONE);
1680 DO_TEST_FULL("cpu-host-model-nofallback",
1681 ARG_FLAGS, FLAG_SKIP_LEGACY_CPUS | FLAG_EXPECT_FAILURE,
1682 ARG_QEMU_CAPS, NONE);
1683 DO_TEST("cpu-host-passthrough", QEMU_CAPS_KVM);
1684 DO_TEST_FAILURE("cpu-qemu-host-passthrough", QEMU_CAPS_KVM);
1686 qemuTestSetHostArch(driver.caps, VIR_ARCH_S390X);
1687 DO_TEST("cpu-s390-zEC12", QEMU_CAPS_KVM, QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
1688 DO_TEST("cpu-s390-features", QEMU_CAPS_KVM, QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION);
1689 DO_TEST_FAILURE("cpu-s390-features", QEMU_CAPS_KVM);
1690 qemuTestSetHostArch(driver.caps, VIR_ARCH_NONE);
1692 qemuTestSetHostCPU(driver.caps, cpuHaswell);
1693 DO_TEST("cpu-Haswell", QEMU_CAPS_KVM);
1694 DO_TEST("cpu-Haswell2", QEMU_CAPS_KVM);
1695 DO_TEST("cpu-Haswell3", QEMU_CAPS_KVM);
1696 DO_TEST("cpu-Haswell-noTSX", QEMU_CAPS_KVM);
1697 DO_TEST("cpu-host-model-cmt", NONE);
1698 DO_TEST("cpu-tsc-frequency", QEMU_CAPS_KVM);
1699 DO_TEST_CAPS_VER("cpu-translation", "4.0.0");
1700 DO_TEST_CAPS_LATEST("cpu-translation");
1701 qemuTestSetHostCPU(driver.caps, NULL);
1703 DO_TEST("encrypted-disk", QEMU_CAPS_QCOW2_LUKS, QEMU_CAPS_OBJECT_SECRET);
1704 DO_TEST("encrypted-disk-usage", QEMU_CAPS_QCOW2_LUKS, QEMU_CAPS_OBJECT_SECRET);
1705 DO_TEST("luks-disks", QEMU_CAPS_OBJECT_SECRET);
1706 DO_TEST("luks-disks-source", QEMU_CAPS_OBJECT_SECRET);
1707 DO_TEST_PARSE_ERROR("luks-disks-source-qcow2", QEMU_CAPS_OBJECT_SECRET);
1708 DO_TEST("luks-disks-source-qcow2", QEMU_CAPS_OBJECT_SECRET, QEMU_CAPS_QCOW2_LUKS);
1709 DO_TEST_PARSE_ERROR("luks-disk-invalid", NONE);
1710 DO_TEST_PARSE_ERROR("luks-disks-source-both", QEMU_CAPS_OBJECT_SECRET);
1712 DO_TEST("memtune", NONE);
1713 DO_TEST("memtune-unlimited", NONE);
1714 DO_TEST("blkiotune", NONE);
1715 DO_TEST("blkiotune-device", NONE);
1716 DO_TEST("cputune", NONE);
1717 DO_TEST("cputune-zero-shares", NONE);
1718 DO_TEST_PARSE_ERROR("cputune-iothreadsched-toomuch", NONE);
1719 DO_TEST_PARSE_ERROR("cputune-vcpusched-overlap", NONE);
1720 DO_TEST("cputune-numatune",
1721 QEMU_CAPS_KVM,
1722 QEMU_CAPS_OBJECT_IOTHREAD,
1723 QEMU_CAPS_OBJECT_MEMORY_RAM,
1724 QEMU_CAPS_OBJECT_MEMORY_FILE);
1725 DO_TEST("vcpu-placement-static",
1726 QEMU_CAPS_KVM,
1727 QEMU_CAPS_OBJECT_IOTHREAD);
1729 DO_TEST("numatune-memory", NONE);
1730 DO_TEST_PARSE_ERROR("numatune-memory-invalid-nodeset", NONE);
1731 DO_TEST("numatune-memnode",
1732 QEMU_CAPS_NUMA,
1733 QEMU_CAPS_OBJECT_MEMORY_RAM);
1734 DO_TEST_FAILURE("numatune-memnode", NONE);
1736 DO_TEST("numatune-memnode-no-memory",
1737 QEMU_CAPS_NUMA,
1738 QEMU_CAPS_OBJECT_MEMORY_RAM);
1739 DO_TEST_FAILURE("numatune-memnode-no-memory", NONE);
1741 DO_TEST("numatune-distances", QEMU_CAPS_NUMA, QEMU_CAPS_NUMA_DIST);
1743 DO_TEST("numatune-auto-nodeset-invalid", NONE);
1744 DO_TEST("numatune-auto-prefer", QEMU_CAPS_OBJECT_MEMORY_RAM,
1745 QEMU_CAPS_OBJECT_MEMORY_FILE);
1746 DO_TEST_FAILURE("numatune-static-nodeset-exceed-hostnode",
1747 QEMU_CAPS_OBJECT_MEMORY_RAM);
1748 DO_TEST_PARSE_ERROR("numatune-memnode-nocpu", NONE);
1749 DO_TEST_PARSE_ERROR("numatune-memnodes-problematic", NONE);
1750 DO_TEST("numad", NONE);
1751 DO_TEST("numad-auto-vcpu-static-numatune", NONE);
1752 DO_TEST_PARSE_ERROR("numad-auto-vcpu-static-numatune-no-nodeset", NONE);
1753 DO_TEST("numad-auto-memory-vcpu-cpuset", NONE);
1754 DO_TEST("numad-auto-memory-vcpu-no-cpuset-and-placement", NONE);
1755 DO_TEST("numad-static-memory-auto-vcpu", NONE);
1756 DO_TEST("blkdeviotune-max",
1757 QEMU_CAPS_DRIVE_IOTUNE_MAX);
1758 DO_TEST("blkdeviotune-group-num",
1759 QEMU_CAPS_DRIVE_IOTUNE_MAX,
1760 QEMU_CAPS_DRIVE_IOTUNE_GROUP);
1761 DO_TEST("blkdeviotune-max-length",
1762 QEMU_CAPS_DRIVE_IOTUNE_MAX,
1763 QEMU_CAPS_DRIVE_IOTUNE_MAX_LENGTH);
1765 DO_TEST("multifunction-pci-device",
1766 QEMU_CAPS_SCSI_LSI);
1768 DO_TEST("monitor-json", NONE);
1770 DO_TEST("seclabel-dynamic", NONE);
1771 DO_TEST("seclabel-dynamic-baselabel", NONE);
1772 DO_TEST("seclabel-dynamic-override", NONE);
1773 DO_TEST("seclabel-dynamic-labelskip", NONE);
1774 DO_TEST("seclabel-dynamic-relabel", NONE);
1775 DO_TEST("seclabel-static", NONE);
1776 DO_TEST("seclabel-static-relabel", NONE);
1777 DO_TEST("seclabel-static-labelskip", NONE);
1778 DO_TEST("seclabel-none", NONE);
1779 DO_TEST("seclabel-dac-none", NONE);
1780 DO_TEST_PARSE_ERROR("seclabel-multiple", NONE);
1781 DO_TEST_PARSE_ERROR("seclabel-device-duplicates", NONE);
1783 DO_TEST("pseries-basic",
1784 QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1785 QEMU_CAPS_DEVICE_SPAPR_VTY);
1786 DO_TEST("pseries-vio",
1787 QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1788 QEMU_CAPS_DEVICE_SPAPR_VTY);
1789 DO_TEST("pseries-usb-default",
1790 QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1791 QEMU_CAPS_DEVICE_SPAPR_VTY,
1792 QEMU_CAPS_PIIX3_USB_UHCI,
1793 QEMU_CAPS_PCI_OHCI);
1794 DO_TEST("pseries-usb-multi",
1795 QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1796 QEMU_CAPS_DEVICE_SPAPR_VTY,
1797 QEMU_CAPS_PIIX3_USB_UHCI,
1798 QEMU_CAPS_PCI_OHCI);
1799 DO_TEST("pseries-vio-user-assigned",
1800 QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1801 QEMU_CAPS_DEVICE_SPAPR_VTY);
1802 DO_TEST_PARSE_ERROR("pseries-vio-address-clash", NONE);
1803 DO_TEST("pseries-nvram",
1804 QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1805 QEMU_CAPS_DEVICE_NVRAM);
1806 DO_TEST("pseries-usb-kbd", QEMU_CAPS_PCI_OHCI,
1807 QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1808 QEMU_CAPS_DEVICE_USB_KBD,
1809 QEMU_CAPS_DEVICE_SPAPR_VTY);
1810 DO_TEST("pseries-cpu-exact",
1811 QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1812 QEMU_CAPS_DEVICE_SPAPR_VTY);
1813 DO_TEST_PARSE_ERROR("pseries-no-parallel", NONE);
1815 qemuTestSetHostArch(driver.caps, VIR_ARCH_PPC64);
1816 DO_TEST("pseries-cpu-compat", QEMU_CAPS_KVM,
1817 QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1818 QEMU_CAPS_DEVICE_SPAPR_VTY);
1819 DO_TEST("pseries-machine-max-cpu-compat",
1820 QEMU_CAPS_KVM,
1821 QEMU_CAPS_MACHINE_PSERIES_MAX_CPU_COMPAT,
1822 QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE);
1823 DO_TEST("pseries-cpu-le", QEMU_CAPS_KVM,
1824 QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1825 QEMU_CAPS_DEVICE_SPAPR_VTY);
1826 DO_TEST_FAILURE("pseries-cpu-compat-power9",
1827 QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1828 QEMU_CAPS_KVM);
1830 qemuTestSetHostCPU(driver.caps, cpuPower9);
1831 DO_TEST("pseries-cpu-compat-power9",
1832 QEMU_CAPS_KVM,
1833 QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1834 QEMU_CAPS_DEVICE_SPAPR_VTY);
1835 qemuTestSetHostCPU(driver.caps, NULL);
1837 qemuTestSetHostArch(driver.caps, VIR_ARCH_NONE);
1839 DO_TEST("pseries-panic-missing",
1840 QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1841 QEMU_CAPS_DEVICE_SPAPR_VTY);
1842 DO_TEST("pseries-panic-no-address",
1843 QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1844 QEMU_CAPS_DEVICE_SPAPR_VTY);
1845 DO_TEST_FAILURE("pseries-panic-address",
1846 QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE);
1848 DO_TEST("pseries-phb-simple",
1849 QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE);
1850 DO_TEST("pseries-phb-default-missing",
1851 QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE);
1852 DO_TEST("pseries-phb-numa-node",
1853 QEMU_CAPS_NUMA,
1854 QEMU_CAPS_OBJECT_MEMORY_RAM,
1855 QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1856 QEMU_CAPS_SPAPR_PCI_HOST_BRIDGE_NUMA_NODE);
1857 DO_TEST_PARSE_ERROR("pseries-default-phb-numa-node", NONE);
1858 DO_TEST_PARSE_ERROR("pseries-phb-invalid-target-index-1", NONE);
1859 DO_TEST_PARSE_ERROR("pseries-phb-invalid-target-index-2", NONE);
1860 DO_TEST_PARSE_ERROR("pseries-phb-invalid-target-index-3", NONE);
1862 DO_TEST("pseries-many-devices",
1863 QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1864 QEMU_CAPS_VIRTIO_SCSI);
1865 DO_TEST("pseries-many-buses-1",
1866 QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1867 QEMU_CAPS_VIRTIO_SCSI);
1868 DO_TEST("pseries-many-buses-2",
1869 QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1870 QEMU_CAPS_VIRTIO_SCSI);
1871 DO_TEST("pseries-hostdevs-1",
1872 QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1873 QEMU_CAPS_VIRTIO_SCSI,
1874 QEMU_CAPS_DEVICE_VFIO_PCI);
1875 DO_TEST("pseries-hostdevs-2",
1876 QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1877 QEMU_CAPS_VIRTIO_SCSI,
1878 QEMU_CAPS_DEVICE_VFIO_PCI);
1879 DO_TEST("pseries-hostdevs-3",
1880 QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1881 QEMU_CAPS_VIRTIO_SCSI,
1882 QEMU_CAPS_DEVICE_VFIO_PCI);
1884 DO_TEST("pseries-features",
1885 QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1886 QEMU_CAPS_MACHINE_PSERIES_CAP_HPT_MAX_PAGE_SIZE,
1887 QEMU_CAPS_MACHINE_PSERIES_CAP_HTM,
1888 QEMU_CAPS_MACHINE_PSERIES_CAP_NESTED_HV,
1889 QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT);
1890 DO_TEST_FAILURE("pseries-features",
1891 QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE);
1892 DO_TEST_PARSE_ERROR("pseries-features-invalid-machine", NONE);
1894 DO_TEST("pseries-serial-native",
1895 QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1896 QEMU_CAPS_DEVICE_SPAPR_VTY);
1897 DO_TEST("pseries-serial+console-native",
1898 QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1899 QEMU_CAPS_DEVICE_SPAPR_VTY);
1900 DO_TEST("pseries-serial-compat",
1901 QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1902 QEMU_CAPS_DEVICE_SPAPR_VTY);
1903 DO_TEST("pseries-serial-pci",
1904 QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1905 QEMU_CAPS_DEVICE_PCI_SERIAL);
1906 DO_TEST("pseries-serial-usb",
1907 QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1908 QEMU_CAPS_DEVICE_QEMU_XHCI,
1909 QEMU_CAPS_DEVICE_USB_SERIAL);
1910 DO_TEST("pseries-console-native",
1911 QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1912 QEMU_CAPS_DEVICE_SPAPR_VTY);
1913 DO_TEST("pseries-console-virtio",
1914 QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE);
1915 DO_TEST_PARSE_ERROR("pseries-serial-invalid-machine", NONE);
1916 DO_TEST_PARSE_ERROR("pseries-spaprvio-invalid", "ppc64");
1918 DO_TEST("mach-virt-serial-native",
1919 QEMU_CAPS_DEVICE_PL011);
1920 DO_TEST("mach-virt-serial+console-native",
1921 QEMU_CAPS_DEVICE_PL011);
1922 DO_TEST("mach-virt-serial-compat",
1923 QEMU_CAPS_DEVICE_PL011);
1924 DO_TEST("mach-virt-serial-pci",
1925 QEMU_CAPS_OBJECT_GPEX,
1926 QEMU_CAPS_DEVICE_PCIE_ROOT_PORT,
1927 QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
1928 QEMU_CAPS_DEVICE_PCI_BRIDGE,
1929 QEMU_CAPS_DEVICE_PCI_SERIAL);
1930 DO_TEST("mach-virt-serial-usb",
1931 QEMU_CAPS_OBJECT_GPEX,
1932 QEMU_CAPS_DEVICE_PCIE_ROOT_PORT,
1933 QEMU_CAPS_DEVICE_QEMU_XHCI,
1934 QEMU_CAPS_DEVICE_USB_SERIAL);
1935 DO_TEST("mach-virt-console-native",
1936 QEMU_CAPS_DEVICE_PL011);
1937 DO_TEST("mach-virt-console-virtio",
1938 QEMU_CAPS_DEVICE_VIRTIO_MMIO);
1939 DO_TEST_PARSE_ERROR("mach-virt-serial-invalid-machine", NONE);
1941 DO_TEST("disk-ide-split", NONE);
1942 DO_TEST("disk-ide-wwn", QEMU_CAPS_IDE_DRIVE_WWN);
1944 DO_TEST("disk-geometry", NONE);
1945 DO_TEST("disk-blockio", QEMU_CAPS_BLOCKIO);
1947 DO_TEST("video-device-pciaddr-default",
1948 QEMU_CAPS_KVM,
1949 QEMU_CAPS_VNC,
1950 QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
1951 QEMU_CAPS_DEVICE_QXL);
1952 DO_TEST("video-vga-nodevice", QEMU_CAPS_DEVICE_VGA);
1953 DO_TEST("video-vga-device", QEMU_CAPS_DEVICE_VGA,
1954 QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
1955 DO_TEST("video-vga-device-vgamem", QEMU_CAPS_DEVICE_VGA,
1956 QEMU_CAPS_DEVICE_VIDEO_PRIMARY, QEMU_CAPS_VGA_VGAMEM);
1957 DO_TEST("video-qxl-nodevice", QEMU_CAPS_DEVICE_QXL);
1958 DO_TEST("video-qxl-device",
1959 QEMU_CAPS_DEVICE_QXL,
1960 QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
1961 DO_TEST("video-qxl-device-vgamem",
1962 QEMU_CAPS_DEVICE_QXL,
1963 QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
1964 QEMU_CAPS_QXL_VGAMEM);
1965 DO_TEST_CAPS_LATEST("video-qxl-device-vram64");
1966 DO_TEST("video-qxl-sec-device",
1967 QEMU_CAPS_DEVICE_QXL, QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
1968 DO_TEST("video-qxl-sec-device-vgamem",
1969 QEMU_CAPS_DEVICE_QXL,
1970 QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
1971 QEMU_CAPS_QXL_VGAMEM);
1972 DO_TEST_CAPS_LATEST("video-qxl-sec-device-vram64");
1973 DO_TEST("video-qxl-heads",
1974 QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
1975 QEMU_CAPS_DEVICE_QXL,
1976 QEMU_CAPS_QXL_MAX_OUTPUTS);
1977 DO_TEST("video-vga-qxl-heads",
1978 QEMU_CAPS_DEVICE_QXL,
1979 QEMU_CAPS_QXL_MAX_OUTPUTS);
1980 DO_TEST("video-qxl-noheads",
1981 QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
1982 QEMU_CAPS_DEVICE_QXL,
1983 QEMU_CAPS_QXL_MAX_OUTPUTS);
1984 DO_TEST("video-virtio-gpu-device",
1985 QEMU_CAPS_DEVICE_VIRTIO_GPU,
1986 QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
1987 DO_TEST("video-virtio-gpu-virgl",
1988 QEMU_CAPS_DEVICE_VIRTIO_GPU,
1989 QEMU_CAPS_VIRTIO_GPU_VIRGL,
1990 QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
1991 DO_TEST("video-virtio-gpu-spice-gl",
1992 QEMU_CAPS_DEVICE_VIRTIO_GPU,
1993 QEMU_CAPS_VIRTIO_GPU_VIRGL,
1994 QEMU_CAPS_SPICE,
1995 QEMU_CAPS_SPICE_GL,
1996 QEMU_CAPS_SPICE_RENDERNODE,
1997 QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
1998 DO_TEST("video-virtio-gpu-sdl-gl",
1999 QEMU_CAPS_DEVICE_VIRTIO_GPU,
2000 QEMU_CAPS_VIRTIO_GPU_VIRGL,
2001 QEMU_CAPS_SDL_GL,
2002 QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
2003 DO_TEST("video-virtio-gpu-secondary",
2004 QEMU_CAPS_DEVICE_VIRTIO_GPU,
2005 QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
2006 DO_TEST("video-virtio-vga",
2007 QEMU_CAPS_DEVICE_VIRTIO_GPU,
2008 QEMU_CAPS_DEVICE_VIRTIO_VGA,
2009 QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2010 QEMU_CAPS_VIRTIO_GPU_MAX_OUTPUTS);
2011 DO_TEST("video-none-device",
2012 QEMU_CAPS_VNC);
2013 DO_TEST_PARSE_ERROR("video-invalid-multiple-devices", NONE);
2015 DO_TEST("virtio-rng-default",
2016 QEMU_CAPS_DEVICE_VIRTIO_RNG,
2017 QEMU_CAPS_OBJECT_RNG_RANDOM);
2018 DO_TEST("virtio-rng-random",
2019 QEMU_CAPS_DEVICE_VIRTIO_RNG,
2020 QEMU_CAPS_OBJECT_RNG_RANDOM);
2021 DO_TEST("virtio-rng-egd",
2022 QEMU_CAPS_DEVICE_VIRTIO_RNG,
2023 QEMU_CAPS_OBJECT_RNG_EGD);
2024 DO_TEST_CAPS_VER("virtio-rng-egd-unix", "2.5.0");
2025 DO_TEST_CAPS_LATEST("virtio-rng-egd-unix");
2026 DO_TEST("virtio-rng-multiple",
2027 QEMU_CAPS_DEVICE_VIRTIO_RNG,
2028 QEMU_CAPS_OBJECT_RNG_EGD,
2029 QEMU_CAPS_OBJECT_RNG_RANDOM);
2030 DO_TEST_PARSE_ERROR("virtio-rng-egd-crash",
2031 QEMU_CAPS_DEVICE_VIRTIO_RNG,
2032 QEMU_CAPS_OBJECT_RNG_EGD);
2033 DO_TEST("virtio-rng-ccw",
2034 QEMU_CAPS_CCW,
2035 QEMU_CAPS_VIRTIO_S390,
2036 QEMU_CAPS_DEVICE_VIRTIO_RNG,
2037 QEMU_CAPS_OBJECT_RNG_RANDOM);
2039 DO_TEST("s390-allow-bogus-usb-none",
2040 QEMU_CAPS_VIRTIO_S390,
2041 QEMU_CAPS_DEVICE_VIRTIO_RNG,
2042 QEMU_CAPS_OBJECT_RNG_RANDOM);
2043 DO_TEST("s390-allow-bogus-usb-controller",
2044 QEMU_CAPS_VIRTIO_S390,
2045 QEMU_CAPS_DEVICE_VIRTIO_RNG,
2046 QEMU_CAPS_OBJECT_RNG_RANDOM);
2048 DO_TEST("s390-panic-no-address",
2049 QEMU_CAPS_CCW,
2050 QEMU_CAPS_VIRTIO_S390);
2051 DO_TEST_FAILURE("s390-panic-address",
2052 QEMU_CAPS_CCW,
2053 QEMU_CAPS_VIRTIO_S390);
2054 DO_TEST("s390-panic-missing",
2055 QEMU_CAPS_CCW,
2056 QEMU_CAPS_VIRTIO_S390);
2057 DO_TEST_PARSE_ERROR("s390-no-parallel",
2058 QEMU_CAPS_CCW,
2059 QEMU_CAPS_VIRTIO_S390);
2060 DO_TEST("s390-serial",
2061 QEMU_CAPS_CCW,
2062 QEMU_CAPS_VIRTIO_S390,
2063 QEMU_CAPS_DEVICE_SCLPCONSOLE);
2064 DO_TEST("s390-serial-2",
2065 QEMU_CAPS_CCW,
2066 QEMU_CAPS_VIRTIO_S390,
2067 QEMU_CAPS_DEVICE_SCLPCONSOLE,
2068 QEMU_CAPS_DEVICE_SCLPLMCONSOLE);
2069 DO_TEST("s390-serial-console",
2070 QEMU_CAPS_CCW,
2071 QEMU_CAPS_VIRTIO_S390,
2072 QEMU_CAPS_DEVICE_SCLPCONSOLE);
2074 DO_TEST("ppc-dtb",
2075 QEMU_CAPS_KVM);
2076 DO_TEST("ppce500-serial",
2077 QEMU_CAPS_KVM);
2079 DO_TEST("tpm-passthrough",
2080 QEMU_CAPS_DEVICE_TPM_PASSTHROUGH, QEMU_CAPS_DEVICE_TPM_TIS);
2081 DO_TEST("tpm-passthrough-crb",
2082 QEMU_CAPS_DEVICE_TPM_PASSTHROUGH, QEMU_CAPS_DEVICE_TPM_CRB);
2083 DO_TEST_PARSE_ERROR("tpm-no-backend-invalid",
2084 QEMU_CAPS_DEVICE_TPM_PASSTHROUGH, QEMU_CAPS_DEVICE_TPM_TIS);
2085 DO_TEST_CAPS_LATEST("tpm-emulator");
2086 DO_TEST_CAPS_LATEST("tpm-emulator-tpm2");
2088 DO_TEST_PARSE_ERROR("pci-domain-invalid", NONE);
2089 DO_TEST_PARSE_ERROR("pci-bus-invalid", NONE);
2090 DO_TEST_PARSE_ERROR("pci-slot-invalid", NONE);
2091 DO_TEST_PARSE_ERROR("pci-function-invalid", NONE);
2093 DO_TEST("pci-bridge",
2094 QEMU_CAPS_DEVICE_PCI_BRIDGE,
2095 QEMU_CAPS_VNC,
2096 QEMU_CAPS_DEVICE_CIRRUS_VGA);
2097 DO_TEST("pci-autoadd-addr",
2098 QEMU_CAPS_DEVICE_PCI_BRIDGE,
2099 QEMU_CAPS_DEVICE_CIRRUS_VGA);
2100 DO_TEST("pci-autoadd-idx",
2101 QEMU_CAPS_DEVICE_PCI_BRIDGE,
2102 QEMU_CAPS_DEVICE_CIRRUS_VGA);
2103 DO_TEST("pci-autofill-addr", QEMU_CAPS_DEVICE_CIRRUS_VGA);
2104 DO_TEST("pci-many",
2105 QEMU_CAPS_DEVICE_CIRRUS_VGA);
2106 DO_TEST("pci-bridge-many-disks",
2107 QEMU_CAPS_DEVICE_PCI_BRIDGE);
2108 DO_TEST("pcie-root",
2109 QEMU_CAPS_DEVICE_IOH3420,
2110 QEMU_CAPS_ICH9_AHCI,
2111 QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2112 QEMU_CAPS_DEVICE_QXL);
2113 DO_TEST("q35",
2114 QEMU_CAPS_DEVICE_PCI_BRIDGE,
2115 QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
2116 QEMU_CAPS_DEVICE_IOH3420,
2117 QEMU_CAPS_ICH9_AHCI,
2118 QEMU_CAPS_ICH9_USB_EHCI1,
2119 QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2120 QEMU_CAPS_DEVICE_QXL);
2121 DO_TEST_PARSE_ERROR("q35-dmi-bad-address1",
2122 QEMU_CAPS_DEVICE_PCI_BRIDGE,
2123 QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
2124 QEMU_CAPS_DEVICE_IOH3420);
2125 DO_TEST_PARSE_ERROR("q35-dmi-bad-address2",
2126 QEMU_CAPS_DEVICE_PCI_BRIDGE,
2127 QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
2128 QEMU_CAPS_DEVICE_IOH3420);
2129 DO_TEST("q35-pm-disable",
2130 QEMU_CAPS_DEVICE_PCI_BRIDGE,
2131 QEMU_CAPS_DEVICE_IOH3420,
2132 QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, QEMU_CAPS_ICH9_AHCI,
2133 QEMU_CAPS_PIIX_DISABLE_S3, QEMU_CAPS_PIIX_DISABLE_S4,
2134 QEMU_CAPS_ICH9_DISABLE_S3, QEMU_CAPS_ICH9_DISABLE_S4);
2135 DO_TEST("q35-pm-disable-fallback",
2136 QEMU_CAPS_DEVICE_PCI_BRIDGE,
2137 QEMU_CAPS_DEVICE_IOH3420,
2138 QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, QEMU_CAPS_ICH9_AHCI,
2139 QEMU_CAPS_PIIX_DISABLE_S3, QEMU_CAPS_PIIX_DISABLE_S4);
2140 DO_TEST("q35-usb2",
2141 QEMU_CAPS_DEVICE_PCI_BRIDGE,
2142 QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
2143 QEMU_CAPS_DEVICE_IOH3420,
2144 QEMU_CAPS_ICH9_AHCI,
2145 QEMU_CAPS_ICH9_USB_EHCI1,
2146 QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2147 QEMU_CAPS_DEVICE_QXL);
2148 DO_TEST("q35-usb2-multi",
2149 QEMU_CAPS_DEVICE_PCI_BRIDGE,
2150 QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
2151 QEMU_CAPS_DEVICE_IOH3420,
2152 QEMU_CAPS_ICH9_AHCI,
2153 QEMU_CAPS_ICH9_USB_EHCI1,
2154 QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2155 QEMU_CAPS_DEVICE_QXL);
2156 DO_TEST("q35-usb2-reorder",
2157 QEMU_CAPS_DEVICE_PCI_BRIDGE,
2158 QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
2159 QEMU_CAPS_DEVICE_IOH3420,
2160 QEMU_CAPS_ICH9_AHCI,
2161 QEMU_CAPS_ICH9_USB_EHCI1,
2162 QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2163 QEMU_CAPS_DEVICE_QXL);
2164 /* verify that devices with pcie capability are assigned to a pcie slot */
2165 DO_TEST("q35-pcie",
2166 QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY,
2167 QEMU_CAPS_DEVICE_VIRTIO_RNG,
2168 QEMU_CAPS_OBJECT_RNG_RANDOM,
2169 QEMU_CAPS_DEVICE_VIRTIO_NET,
2170 QEMU_CAPS_DEVICE_VIRTIO_GPU,
2171 QEMU_CAPS_VIRTIO_GPU_VIRGL,
2172 QEMU_CAPS_VIRTIO_KEYBOARD,
2173 QEMU_CAPS_VIRTIO_MOUSE,
2174 QEMU_CAPS_VIRTIO_TABLET,
2175 QEMU_CAPS_VIRTIO_INPUT_HOST,
2176 QEMU_CAPS_VIRTIO_SCSI,
2177 QEMU_CAPS_DEVICE_PCI_BRIDGE,
2178 QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
2179 QEMU_CAPS_DEVICE_IOH3420,
2180 QEMU_CAPS_ICH9_AHCI,
2181 QEMU_CAPS_ICH9_USB_EHCI1,
2182 QEMU_CAPS_NEC_USB_XHCI,
2183 QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
2184 /* same XML as q35-pcie, but don't set
2185 * QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY, so virtio devices should
2186 * be assigned to legacy pci slots
2188 DO_TEST("q35-virtio-pci",
2189 QEMU_CAPS_DEVICE_VIRTIO_RNG,
2190 QEMU_CAPS_OBJECT_RNG_RANDOM,
2191 QEMU_CAPS_DEVICE_VIRTIO_NET,
2192 QEMU_CAPS_DEVICE_VIRTIO_GPU,
2193 QEMU_CAPS_VIRTIO_GPU_VIRGL,
2194 QEMU_CAPS_VIRTIO_KEYBOARD,
2195 QEMU_CAPS_VIRTIO_MOUSE,
2196 QEMU_CAPS_VIRTIO_TABLET,
2197 QEMU_CAPS_VIRTIO_INPUT_HOST,
2198 QEMU_CAPS_VIRTIO_SCSI,
2199 QEMU_CAPS_DEVICE_PCI_BRIDGE,
2200 QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
2201 QEMU_CAPS_DEVICE_IOH3420,
2202 QEMU_CAPS_ICH9_AHCI,
2203 QEMU_CAPS_ICH9_USB_EHCI1,
2204 QEMU_CAPS_NEC_USB_XHCI,
2205 QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
2206 /* same as q35-pcie, but all PCI controllers are added automatically */
2207 DO_TEST("q35-pcie-autoadd",
2208 QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY,
2209 QEMU_CAPS_DEVICE_VIRTIO_RNG,
2210 QEMU_CAPS_OBJECT_RNG_RANDOM,
2211 QEMU_CAPS_DEVICE_VIRTIO_NET,
2212 QEMU_CAPS_DEVICE_VIRTIO_GPU,
2213 QEMU_CAPS_VIRTIO_GPU_VIRGL,
2214 QEMU_CAPS_VIRTIO_KEYBOARD,
2215 QEMU_CAPS_VIRTIO_MOUSE,
2216 QEMU_CAPS_VIRTIO_TABLET,
2217 QEMU_CAPS_VIRTIO_INPUT_HOST,
2218 QEMU_CAPS_VIRTIO_SCSI,
2219 QEMU_CAPS_DEVICE_PCI_BRIDGE,
2220 QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
2221 QEMU_CAPS_DEVICE_IOH3420,
2222 QEMU_CAPS_ICH9_AHCI,
2223 QEMU_CAPS_ICH9_USB_EHCI1,
2224 QEMU_CAPS_NEC_USB_XHCI,
2225 QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
2226 DO_TEST("q35-default-devices-only",
2227 QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY,
2228 QEMU_CAPS_DEVICE_VIRTIO_RNG,
2229 QEMU_CAPS_OBJECT_RNG_RANDOM,
2230 QEMU_CAPS_DEVICE_VIRTIO_NET,
2231 QEMU_CAPS_DEVICE_VIRTIO_GPU,
2232 QEMU_CAPS_VIRTIO_GPU_VIRGL,
2233 QEMU_CAPS_VIRTIO_KEYBOARD,
2234 QEMU_CAPS_VIRTIO_MOUSE,
2235 QEMU_CAPS_VIRTIO_TABLET,
2236 QEMU_CAPS_VIRTIO_INPUT_HOST,
2237 QEMU_CAPS_VIRTIO_SCSI,
2238 QEMU_CAPS_DEVICE_PCI_BRIDGE,
2239 QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
2240 QEMU_CAPS_DEVICE_IOH3420,
2241 QEMU_CAPS_ICH9_AHCI,
2242 QEMU_CAPS_ICH9_USB_EHCI1,
2243 QEMU_CAPS_NEC_USB_XHCI,
2244 QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
2245 DO_TEST("q35-multifunction",
2246 QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY,
2247 QEMU_CAPS_DEVICE_VIRTIO_RNG,
2248 QEMU_CAPS_OBJECT_RNG_RANDOM,
2249 QEMU_CAPS_DEVICE_VIRTIO_NET,
2250 QEMU_CAPS_DEVICE_VIRTIO_GPU,
2251 QEMU_CAPS_VIRTIO_GPU_VIRGL,
2252 QEMU_CAPS_VIRTIO_KEYBOARD,
2253 QEMU_CAPS_VIRTIO_MOUSE,
2254 QEMU_CAPS_VIRTIO_TABLET,
2255 QEMU_CAPS_VIRTIO_INPUT_HOST,
2256 QEMU_CAPS_VIRTIO_SCSI,
2257 QEMU_CAPS_DEVICE_PCI_BRIDGE,
2258 QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
2259 QEMU_CAPS_DEVICE_IOH3420,
2260 QEMU_CAPS_ICH9_AHCI,
2261 QEMU_CAPS_ICH9_USB_EHCI1,
2262 QEMU_CAPS_NEC_USB_XHCI,
2263 QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
2264 DO_TEST("q35-virt-manager-basic",
2265 QEMU_CAPS_KVM,
2266 QEMU_CAPS_MACHINE_VMPORT_OPT,
2267 QEMU_CAPS_ICH9_DISABLE_S3,
2268 QEMU_CAPS_ICH9_DISABLE_S4,
2269 QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY,
2270 QEMU_CAPS_DEVICE_VIRTIO_RNG,
2271 QEMU_CAPS_OBJECT_RNG_RANDOM,
2272 QEMU_CAPS_DEVICE_VIRTIO_NET,
2273 QEMU_CAPS_DEVICE_VIRTIO_GPU,
2274 QEMU_CAPS_VIRTIO_GPU_VIRGL,
2275 QEMU_CAPS_VIRTIO_KEYBOARD,
2276 QEMU_CAPS_VIRTIO_MOUSE,
2277 QEMU_CAPS_VIRTIO_TABLET,
2278 QEMU_CAPS_VIRTIO_INPUT_HOST,
2279 QEMU_CAPS_VIRTIO_SCSI,
2280 QEMU_CAPS_DEVICE_PCI_BRIDGE,
2281 QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
2282 QEMU_CAPS_DEVICE_IOH3420,
2283 QEMU_CAPS_ICH9_AHCI,
2284 QEMU_CAPS_ICH9_USB_EHCI1,
2285 QEMU_CAPS_NEC_USB_XHCI,
2286 QEMU_CAPS_DEVICE_ICH9_INTEL_HDA,
2287 QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2288 QEMU_CAPS_SPICE,
2289 QEMU_CAPS_DEVICE_QXL,
2290 QEMU_CAPS_HDA_DUPLEX,
2291 QEMU_CAPS_DEVICE_ISA_SERIAL,
2292 QEMU_CAPS_USB_REDIR);
2294 /* Test automatic and manual setting of pcie-root-port attributes */
2295 DO_TEST("pcie-root-port",
2296 QEMU_CAPS_DEVICE_IOH3420,
2297 QEMU_CAPS_ICH9_AHCI,
2298 QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2299 QEMU_CAPS_DEVICE_QXL);
2301 /* Make sure the default model for PCIe Root Ports is picked correctly
2302 * based on QEMU binary capabilities. We use x86/q35 for the test, but
2303 * any PCIe machine type (such as aarch64/virt) will behave the same */
2304 DO_TEST("pcie-root-port-model-generic",
2305 QEMU_CAPS_DEVICE_PCIE_ROOT_PORT,
2306 QEMU_CAPS_DEVICE_IOH3420);
2307 DO_TEST("pcie-root-port-model-ioh3420",
2308 QEMU_CAPS_DEVICE_IOH3420);
2310 DO_TEST("autoindex",
2311 QEMU_CAPS_DEVICE_PCI_BRIDGE,
2312 QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
2313 QEMU_CAPS_DEVICE_IOH3420,
2314 QEMU_CAPS_DEVICE_X3130_UPSTREAM,
2315 QEMU_CAPS_DEVICE_XIO3130_DOWNSTREAM,
2316 QEMU_CAPS_ICH9_AHCI,
2317 QEMU_CAPS_ICH9_USB_EHCI1,
2318 QEMU_CAPS_NEC_USB_XHCI);
2319 /* Make sure the user can always override libvirt's default device
2320 * placement policy by providing an explicit PCI address */
2321 DO_TEST("q35-pci-force-address",
2322 QEMU_CAPS_DEVICE_PCI_BRIDGE,
2323 QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
2324 QEMU_CAPS_DEVICE_IOH3420,
2325 QEMU_CAPS_HDA_DUPLEX);
2327 DO_TEST_PARSE_ERROR("q35-wrong-root",
2328 QEMU_CAPS_DEVICE_IOH3420,
2329 QEMU_CAPS_ICH9_AHCI,
2330 QEMU_CAPS_ICH9_USB_EHCI1,
2331 QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2332 QEMU_CAPS_DEVICE_QXL);
2333 DO_TEST_PARSE_ERROR("440fx-wrong-root", NONE);
2334 DO_TEST_PARSE_ERROR("440fx-ide-address-conflict", NONE);
2336 DO_TEST_PARSE_ERROR("pcie-root-port-too-many",
2337 QEMU_CAPS_DEVICE_IOH3420,
2338 QEMU_CAPS_ICH9_AHCI,
2339 QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2340 QEMU_CAPS_DEVICE_QXL);
2342 DO_TEST("pcie-switch-upstream-port",
2343 QEMU_CAPS_DEVICE_IOH3420,
2344 QEMU_CAPS_DEVICE_X3130_UPSTREAM,
2345 QEMU_CAPS_ICH9_AHCI,
2346 QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2347 QEMU_CAPS_DEVICE_QXL);
2348 DO_TEST("pcie-switch-downstream-port",
2349 QEMU_CAPS_DEVICE_IOH3420,
2350 QEMU_CAPS_DEVICE_X3130_UPSTREAM,
2351 QEMU_CAPS_DEVICE_XIO3130_DOWNSTREAM,
2352 QEMU_CAPS_ICH9_AHCI,
2353 QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2354 QEMU_CAPS_DEVICE_QXL);
2356 DO_TEST("pci-expander-bus",
2357 QEMU_CAPS_DEVICE_PXB);
2358 DO_TEST_PARSE_ERROR("pci-expander-bus-bad-node",
2359 QEMU_CAPS_DEVICE_PXB);
2360 DO_TEST_PARSE_ERROR("pci-expander-bus-bad-machine",
2361 QEMU_CAPS_DEVICE_PXB);
2362 DO_TEST_PARSE_ERROR("pci-expander-bus-bad-bus",
2363 QEMU_CAPS_DEVICE_PXB);
2365 DO_TEST("pcie-expander-bus",
2366 QEMU_CAPS_DEVICE_IOH3420,
2367 QEMU_CAPS_DEVICE_X3130_UPSTREAM,
2368 QEMU_CAPS_DEVICE_XIO3130_DOWNSTREAM,
2369 QEMU_CAPS_DEVICE_PXB_PCIE);
2370 DO_TEST_PARSE_ERROR("pcie-expander-bus-bad-machine",
2371 QEMU_CAPS_DEVICE_IOH3420,
2372 QEMU_CAPS_DEVICE_X3130_UPSTREAM,
2373 QEMU_CAPS_DEVICE_XIO3130_DOWNSTREAM,
2374 QEMU_CAPS_DEVICE_PXB_PCIE);
2375 DO_TEST_PARSE_ERROR("pcie-expander-bus-bad-bus",
2376 QEMU_CAPS_DEVICE_IOH3420,
2377 QEMU_CAPS_DEVICE_PXB_PCIE);
2379 DO_TEST("hostdev-scsi-lsi",
2380 QEMU_CAPS_VIRTIO_SCSI,
2381 QEMU_CAPS_SCSI_LSI);
2382 DO_TEST("hostdev-scsi-virtio-scsi",
2383 QEMU_CAPS_VIRTIO_SCSI,
2384 QEMU_CAPS_SCSI_LSI);
2385 DO_TEST("hostdev-scsi-readonly",
2386 QEMU_CAPS_VIRTIO_SCSI,
2387 QEMU_CAPS_SCSI_LSI);
2388 DO_TEST("hostdev-scsi-virtio-scsi",
2389 QEMU_CAPS_VIRTIO_SCSI,
2390 QEMU_CAPS_SCSI_LSI);
2391 DO_TEST("hostdev-scsi-lsi-iscsi",
2392 QEMU_CAPS_VIRTIO_SCSI,
2393 QEMU_CAPS_SCSI_LSI);
2394 DO_TEST("hostdev-scsi-lsi-iscsi-auth",
2395 QEMU_CAPS_VIRTIO_SCSI,
2396 QEMU_CAPS_SCSI_LSI);
2397 DO_TEST("hostdev-scsi-virtio-iscsi",
2398 QEMU_CAPS_VIRTIO_SCSI,
2399 QEMU_CAPS_SCSI_LSI);
2400 DO_TEST("hostdev-scsi-virtio-iscsi-auth",
2401 QEMU_CAPS_VIRTIO_SCSI,
2402 QEMU_CAPS_SCSI_LSI);
2403 DO_TEST("disk-hostdev-scsi-virtio-iscsi-auth-AES",
2404 QEMU_CAPS_VIRTIO_SCSI,
2405 QEMU_CAPS_SCSI_LSI,
2406 QEMU_CAPS_OBJECT_SECRET,
2407 QEMU_CAPS_ISCSI_PASSWORD_SECRET);
2408 DO_TEST("hostdev-scsi-vhost-scsi-ccw",
2409 QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE_VHOST_SCSI,
2410 QEMU_CAPS_CCW);
2411 DO_TEST("hostdev-scsi-vhost-scsi-pci",
2412 QEMU_CAPS_VIRTIO_SCSI,
2413 QEMU_CAPS_DEVICE_VHOST_SCSI);
2414 DO_TEST("hostdev-scsi-vhost-scsi-pcie",
2415 QEMU_CAPS_KVM,
2416 QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE_VHOST_SCSI,
2417 QEMU_CAPS_DEVICE_PCIE_ROOT_PORT,
2418 QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY);
2420 DO_TEST_CAPS_VER("mlock-on", "3.0.0");
2421 DO_TEST_CAPS_VER("mlock-off", "3.0.0");
2422 DO_TEST_CAPS_LATEST("mlock-on");
2423 DO_TEST_CAPS_LATEST("mlock-off");
2425 DO_TEST_PARSE_ERROR("pci-bridge-negative-index-invalid", NONE);
2426 DO_TEST_PARSE_ERROR("pci-bridge-duplicate-index", NONE);
2427 DO_TEST_PARSE_ERROR("pci-root-nonzero-index", NONE);
2428 DO_TEST_PARSE_ERROR("pci-root-address", NONE);
2430 DO_TEST("hotplug-base",
2431 QEMU_CAPS_KVM, QEMU_CAPS_VIRTIO_SCSI);
2433 DO_TEST("pcihole64", QEMU_CAPS_I440FX_PCI_HOLE64_SIZE);
2434 DO_TEST_FAILURE("pcihole64-none", NONE);
2435 DO_TEST("pcihole64-q35",
2436 QEMU_CAPS_DEVICE_IOH3420,
2437 QEMU_CAPS_ICH9_AHCI,
2438 QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2439 QEMU_CAPS_DEVICE_QXL,
2440 QEMU_CAPS_Q35_PCI_HOLE64_SIZE);
2442 DO_TEST("arm-vexpressa9-nodevs", NONE);
2443 DO_TEST("arm-vexpressa9-basic", NONE);
2444 DO_TEST("arm-vexpressa9-virtio",
2445 QEMU_CAPS_DEVICE_VIRTIO_MMIO,
2446 QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM);
2447 DO_TEST("arm-virt-virtio",
2448 QEMU_CAPS_DEVICE_VIRTIO_MMIO,
2449 QEMU_CAPS_DEVICE_PL011,
2450 QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM);
2452 DO_TEST("aarch64-virt-virtio",
2453 QEMU_CAPS_DEVICE_VIRTIO_MMIO,
2454 QEMU_CAPS_DEVICE_PL011,
2455 QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM);
2457 /* Demonstrates the virtio-pci default... namely that there isn't any!
2458 q35 style PCI controllers will be added if the binary supports it,
2459 but virtio-mmio is always used unless PCI addresses are manually
2460 specified. */
2461 DO_TEST("aarch64-virtio-pci-default",
2462 QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY,
2463 QEMU_CAPS_DEVICE_VIRTIO_MMIO,
2464 QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM,
2465 QEMU_CAPS_OBJECT_GPEX, QEMU_CAPS_DEVICE_PCI_BRIDGE,
2466 QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
2467 QEMU_CAPS_DEVICE_IOH3420,
2468 QEMU_CAPS_DEVICE_PL011,
2469 QEMU_CAPS_VIRTIO_SCSI);
2470 DO_TEST("aarch64-virt-2.6-virtio-pci-default",
2471 QEMU_CAPS_DEVICE_VIRTIO_MMIO,
2472 QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM,
2473 QEMU_CAPS_OBJECT_GPEX, QEMU_CAPS_DEVICE_PCI_BRIDGE,
2474 QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
2475 QEMU_CAPS_DEVICE_PL011,
2476 QEMU_CAPS_DEVICE_IOH3420);
2477 /* Example of using virtio-pci with no explicit PCI controller
2478 but with manual PCI addresses */
2479 DO_TEST("aarch64-virtio-pci-manual-addresses",
2480 QEMU_CAPS_DEVICE_VIRTIO_MMIO,
2481 QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM,
2482 QEMU_CAPS_OBJECT_GPEX, QEMU_CAPS_DEVICE_PCI_BRIDGE,
2483 QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
2484 QEMU_CAPS_DEVICE_IOH3420,
2485 QEMU_CAPS_VIRTIO_SCSI);
2486 DO_TEST("aarch64-video-virtio-gpu-pci",
2487 QEMU_CAPS_OBJECT_GPEX,
2488 QEMU_CAPS_DEVICE_PCI_BRIDGE, QEMU_CAPS_DEVICE_IOH3420,
2489 QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2490 QEMU_CAPS_DEVICE_VIRTIO_GPU);
2491 DO_TEST("aarch64-video-default",
2492 QEMU_CAPS_OBJECT_GPEX,
2493 QEMU_CAPS_DEVICE_PCI_BRIDGE, QEMU_CAPS_DEVICE_IOH3420,
2494 QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2495 QEMU_CAPS_DEVICE_VIRTIO_GPU, QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
2496 QEMU_CAPS_VNC);
2497 DO_TEST("aarch64-aavmf-virtio-mmio",
2498 QEMU_CAPS_DEVICE_VIRTIO_MMIO,
2499 QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM);
2500 DO_TEST("aarch64-virt-default-nic",
2501 QEMU_CAPS_DEVICE_VIRTIO_MMIO);
2502 qemuTestSetHostArch(driver.caps, VIR_ARCH_AARCH64);
2503 DO_TEST("aarch64-cpu-passthrough",
2504 QEMU_CAPS_DEVICE_VIRTIO_MMIO,
2505 QEMU_CAPS_KVM);
2506 DO_TEST_GIC("aarch64-gic-none", GIC_NONE,
2507 QEMU_CAPS_KVM,
2508 QEMU_CAPS_MACH_VIRT_GIC_VERSION);
2509 DO_TEST_GIC("aarch64-gic-none-v2", GIC_V2,
2510 QEMU_CAPS_KVM,
2511 QEMU_CAPS_MACH_VIRT_GIC_VERSION);
2512 DO_TEST_GIC("aarch64-gic-none-v3", GIC_V3,
2513 QEMU_CAPS_KVM,
2514 QEMU_CAPS_MACH_VIRT_GIC_VERSION);
2515 DO_TEST_GIC("aarch64-gic-none-both", GIC_BOTH,
2516 QEMU_CAPS_KVM,
2517 QEMU_CAPS_MACH_VIRT_GIC_VERSION);
2518 DO_TEST_GIC("aarch64-gic-none-tcg", GIC_BOTH,
2519 QEMU_CAPS_MACH_VIRT_GIC_VERSION);
2520 DO_TEST_GIC("aarch64-gic-default", GIC_NONE,
2521 QEMU_CAPS_KVM,
2522 QEMU_CAPS_MACH_VIRT_GIC_VERSION);
2523 DO_TEST_GIC("aarch64-gic-default-v2", GIC_V2,
2524 QEMU_CAPS_KVM,
2525 QEMU_CAPS_MACH_VIRT_GIC_VERSION);
2526 DO_TEST_GIC("aarch64-gic-default-v3", GIC_V3,
2527 QEMU_CAPS_KVM,
2528 QEMU_CAPS_MACH_VIRT_GIC_VERSION);
2529 DO_TEST_GIC("aarch64-gic-default-both", GIC_BOTH,
2530 QEMU_CAPS_KVM,
2531 QEMU_CAPS_MACH_VIRT_GIC_VERSION);
2532 DO_TEST_GIC("aarch64-gic-v2", GIC_NONE,
2533 QEMU_CAPS_KVM,
2534 QEMU_CAPS_MACH_VIRT_GIC_VERSION);
2535 DO_TEST_GIC("aarch64-gic-v2", GIC_V2,
2536 QEMU_CAPS_KVM,
2537 QEMU_CAPS_MACH_VIRT_GIC_VERSION);
2538 DO_TEST_GIC("aarch64-gic-v2", GIC_V3,
2539 QEMU_CAPS_KVM,
2540 QEMU_CAPS_MACH_VIRT_GIC_VERSION);
2541 DO_TEST_GIC("aarch64-gic-v2", GIC_BOTH,
2542 QEMU_CAPS_KVM,
2543 QEMU_CAPS_MACH_VIRT_GIC_VERSION);
2544 DO_TEST_FAILURE("aarch64-gic-v3",
2545 QEMU_CAPS_KVM, NONE);
2546 DO_TEST_GIC("aarch64-gic-v3", GIC_NONE,
2547 QEMU_CAPS_KVM,
2548 QEMU_CAPS_MACH_VIRT_GIC_VERSION);
2549 DO_TEST_GIC("aarch64-gic-v3", GIC_V2,
2550 QEMU_CAPS_KVM,
2551 QEMU_CAPS_MACH_VIRT_GIC_VERSION);
2552 DO_TEST_GIC("aarch64-gic-v3", GIC_V3,
2553 QEMU_CAPS_KVM,
2554 QEMU_CAPS_MACH_VIRT_GIC_VERSION);
2555 DO_TEST_GIC("aarch64-gic-v3", GIC_BOTH,
2556 QEMU_CAPS_KVM,
2557 QEMU_CAPS_MACH_VIRT_GIC_VERSION);
2558 DO_TEST_FAILURE("aarch64-gic-host",
2559 QEMU_CAPS_KVM, NONE);
2560 DO_TEST_GIC("aarch64-gic-host", GIC_NONE,
2561 QEMU_CAPS_KVM,
2562 QEMU_CAPS_MACH_VIRT_GIC_VERSION);
2563 DO_TEST_GIC("aarch64-gic-host", GIC_V2,
2564 QEMU_CAPS_KVM,
2565 QEMU_CAPS_MACH_VIRT_GIC_VERSION);
2566 DO_TEST_GIC("aarch64-gic-host", GIC_V3,
2567 QEMU_CAPS_KVM,
2568 QEMU_CAPS_MACH_VIRT_GIC_VERSION);
2569 DO_TEST_GIC("aarch64-gic-host", GIC_BOTH,
2570 QEMU_CAPS_KVM,
2571 QEMU_CAPS_MACH_VIRT_GIC_VERSION);
2572 DO_TEST_PARSE_ERROR("aarch64-gic-invalid",
2573 QEMU_CAPS_KVM,
2574 QEMU_CAPS_MACH_VIRT_GIC_VERSION);
2575 DO_TEST_PARSE_ERROR("aarch64-gic-not-virt",
2576 QEMU_CAPS_KVM,
2577 QEMU_CAPS_MACH_VIRT_GIC_VERSION);
2578 DO_TEST_PARSE_ERROR("aarch64-gic-not-arm",
2579 QEMU_CAPS_KVM,
2580 QEMU_CAPS_MACH_VIRT_GIC_VERSION);
2581 DO_TEST("aarch64-kvm-32-on-64",
2582 QEMU_CAPS_DEVICE_VIRTIO_MMIO,
2583 QEMU_CAPS_DEVICE_PL011,
2584 QEMU_CAPS_KVM, QEMU_CAPS_CPU_AARCH64_OFF);
2585 DO_TEST_FAILURE("aarch64-kvm-32-on-64",
2586 QEMU_CAPS_DEVICE_VIRTIO_MMIO,
2587 QEMU_CAPS_KVM);
2588 DO_TEST("aarch64-pci-serial",
2589 QEMU_CAPS_DEVICE_PCI_SERIAL,
2590 QEMU_CAPS_CHARDEV_LOGFILE,
2591 QEMU_CAPS_OBJECT_GPEX,
2592 QEMU_CAPS_DEVICE_PCI_BRIDGE,
2593 QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
2594 QEMU_CAPS_DEVICE_PCIE_ROOT_PORT);
2595 DO_TEST("aarch64-traditional-pci",
2596 QEMU_CAPS_OBJECT_GPEX,
2597 QEMU_CAPS_DEVICE_PCIE_ROOT_PORT,
2598 QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
2599 QEMU_CAPS_DEVICE_PCIE_PCI_BRIDGE,
2600 QEMU_CAPS_DEVICE_PCI_BRIDGE,
2601 QEMU_CAPS_DEVICE_PCI_SERIAL);
2603 /* Make sure all combinations of ACPI and UEFI behave as expected */
2604 DO_TEST("aarch64-acpi-uefi", NONE);
2605 DO_TEST("aarch64-noacpi-uefi", NONE);
2606 DO_TEST("aarch64-noacpi-nouefi", NONE);
2607 DO_TEST_PARSE_ERROR("aarch64-acpi-nouefi", NONE);
2609 qemuTestSetHostArch(driver.caps, VIR_ARCH_NONE);
2611 DO_TEST("kvm-pit-delay", QEMU_CAPS_KVM_PIT_TICK_POLICY);
2612 DO_TEST("kvm-pit-discard", QEMU_CAPS_KVM_PIT_TICK_POLICY);
2614 DO_TEST("panic",
2615 QEMU_CAPS_DEVICE_PANIC);
2616 DO_TEST("panic-double",
2617 QEMU_CAPS_DEVICE_PANIC);
2619 DO_TEST("panic-no-address",
2620 QEMU_CAPS_DEVICE_PANIC);
2622 DO_TEST("fips-enabled", QEMU_CAPS_ENABLE_FIPS);
2624 DO_TEST("shmem", QEMU_CAPS_DEVICE_IVSHMEM);
2625 DO_TEST("shmem-plain-doorbell", QEMU_CAPS_DEVICE_IVSHMEM,
2626 QEMU_CAPS_DEVICE_IVSHMEM_PLAIN,
2627 QEMU_CAPS_DEVICE_IVSHMEM_DOORBELL);
2628 DO_TEST_FAILURE("shmem", NONE);
2629 DO_TEST_FAILURE("shmem-invalid-size",
2630 QEMU_CAPS_DEVICE_IVSHMEM);
2631 DO_TEST_FAILURE("shmem-invalid-address",
2632 QEMU_CAPS_DEVICE_IVSHMEM);
2633 DO_TEST_FAILURE("shmem-small-size",
2634 QEMU_CAPS_DEVICE_IVSHMEM);
2635 DO_TEST_PARSE_ERROR("shmem-msi-only", NONE);
2636 DO_TEST("cpu-host-passthrough-features", QEMU_CAPS_KVM);
2638 DO_TEST_FAILURE("memory-align-fail", NONE);
2639 DO_TEST_FAILURE("memory-hotplug-nonuma", QEMU_CAPS_DEVICE_PC_DIMM);
2640 DO_TEST("memory-hotplug", NONE);
2641 DO_TEST("memory-hotplug", QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_NUMA);
2642 DO_TEST("memory-hotplug-dimm", QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_NUMA,
2643 QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_OBJECT_MEMORY_FILE);
2644 DO_TEST("memory-hotplug-dimm-addr", QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_NUMA,
2645 QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_OBJECT_MEMORY_FILE);
2646 DO_TEST("memory-hotplug-ppc64-nonuma", QEMU_CAPS_KVM, QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_NUMA,
2647 QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
2648 QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_OBJECT_MEMORY_FILE);
2649 DO_TEST_CAPS_LATEST("memory-hotplug-nvdimm");
2650 DO_TEST_CAPS_LATEST("memory-hotplug-nvdimm-access");
2651 DO_TEST_CAPS_LATEST("memory-hotplug-nvdimm-label");
2652 DO_TEST_CAPS_LATEST("memory-hotplug-nvdimm-align");
2653 DO_TEST_CAPS_LATEST("memory-hotplug-nvdimm-pmem");
2654 DO_TEST_CAPS_LATEST("memory-hotplug-nvdimm-readonly");
2656 DO_TEST("machine-aeskeywrap-on-caps",
2657 QEMU_CAPS_AES_KEY_WRAP,
2658 QEMU_CAPS_DEA_KEY_WRAP,
2659 QEMU_CAPS_VIRTIO_SCSI,
2660 QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
2661 DO_TEST_FAILURE("machine-aeskeywrap-on-caps",
2662 QEMU_CAPS_VIRTIO_SCSI,
2663 QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
2664 DO_TEST_FAILURE("machine-aeskeywrap-on-caps", NONE);
2666 DO_TEST("machine-aeskeywrap-on-cap",
2667 QEMU_CAPS_AES_KEY_WRAP,
2668 QEMU_CAPS_VIRTIO_SCSI,
2669 QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
2670 DO_TEST_FAILURE("machine-aeskeywrap-on-cap",
2671 QEMU_CAPS_VIRTIO_SCSI,
2672 QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
2673 DO_TEST_FAILURE("machine-aeskeywrap-on-cap", NONE);
2675 DO_TEST("machine-aeskeywrap-off-caps",
2676 QEMU_CAPS_AES_KEY_WRAP, QEMU_CAPS_DEA_KEY_WRAP,
2677 QEMU_CAPS_VIRTIO_SCSI,
2678 QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
2679 DO_TEST_FAILURE("machine-aeskeywrap-off-caps",
2680 QEMU_CAPS_VIRTIO_SCSI,
2681 QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
2682 DO_TEST_FAILURE("machine-aeskeywrap-off-caps", NONE);
2684 DO_TEST("machine-aeskeywrap-off-cap",
2685 QEMU_CAPS_AES_KEY_WRAP,
2686 QEMU_CAPS_VIRTIO_SCSI,
2687 QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
2688 DO_TEST_FAILURE("machine-aeskeywrap-off-cap",
2689 QEMU_CAPS_VIRTIO_SCSI,
2690 QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
2691 DO_TEST_FAILURE("machine-aeskeywrap-off-cap", NONE);
2693 DO_TEST("machine-deakeywrap-on-caps",
2694 QEMU_CAPS_AES_KEY_WRAP, QEMU_CAPS_DEA_KEY_WRAP,
2695 QEMU_CAPS_VIRTIO_SCSI,
2696 QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
2697 DO_TEST_FAILURE("machine-deakeywrap-on-caps",
2698 QEMU_CAPS_VIRTIO_SCSI,
2699 QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
2700 DO_TEST_FAILURE("machine-deakeywrap-on-caps", NONE);
2702 DO_TEST("machine-deakeywrap-on-cap",
2703 QEMU_CAPS_DEA_KEY_WRAP,
2704 QEMU_CAPS_VIRTIO_SCSI,
2705 QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
2706 DO_TEST_FAILURE("machine-deakeywrap-on-cap",
2707 QEMU_CAPS_VIRTIO_SCSI,
2708 QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
2709 DO_TEST_FAILURE("machine-deakeywrap-on-cap", NONE);
2711 DO_TEST("machine-deakeywrap-off-caps",
2712 QEMU_CAPS_AES_KEY_WRAP, QEMU_CAPS_DEA_KEY_WRAP,
2713 QEMU_CAPS_VIRTIO_SCSI,
2714 QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
2715 DO_TEST_FAILURE("machine-deakeywrap-off-caps",
2716 QEMU_CAPS_VIRTIO_SCSI,
2717 QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
2718 DO_TEST_FAILURE("machine-deakeywrap-off-caps", NONE);
2720 DO_TEST("machine-deakeywrap-off-cap",
2721 QEMU_CAPS_DEA_KEY_WRAP,
2722 QEMU_CAPS_VIRTIO_SCSI,
2723 QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
2724 DO_TEST_FAILURE("machine-deakeywrap-off-cap",
2725 QEMU_CAPS_VIRTIO_SCSI,
2726 QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
2727 DO_TEST_FAILURE("machine-deakeywrap-off-cap", NONE);
2729 DO_TEST("machine-keywrap-none-caps",
2730 QEMU_CAPS_AES_KEY_WRAP, QEMU_CAPS_DEA_KEY_WRAP,
2731 QEMU_CAPS_VIRTIO_SCSI,
2732 QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
2733 DO_TEST("machine-keywrap-none",
2734 QEMU_CAPS_VIRTIO_SCSI,
2735 QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
2737 DO_TEST("machine-loadparm-s390",
2738 QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390,
2739 QEMU_CAPS_LOADPARM);
2740 DO_TEST("machine-loadparm-net-s390",
2741 QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390,
2742 QEMU_CAPS_LOADPARM);
2743 DO_TEST("machine-loadparm-multiple-disks-nets-s390",
2744 QEMU_CAPS_CCW,
2745 QEMU_CAPS_VIRTIO_S390,
2746 QEMU_CAPS_LOADPARM);
2747 DO_TEST_PARSE_ERROR("machine-loadparm-s390-char-invalid",
2748 QEMU_CAPS_CCW,
2749 QEMU_CAPS_VIRTIO_S390,
2750 QEMU_CAPS_LOADPARM);
2751 DO_TEST_PARSE_ERROR("machine-loadparm-s390-len-invalid",
2752 QEMU_CAPS_CCW,
2753 QEMU_CAPS_VIRTIO_S390,
2754 QEMU_CAPS_LOADPARM);
2756 DO_TEST("qemu-ns-domain-ns0", NONE);
2757 DO_TEST("qemu-ns-domain-commandline", NONE);
2758 DO_TEST("qemu-ns-domain-commandline-ns0", NONE);
2759 DO_TEST("qemu-ns-commandline", NONE);
2760 DO_TEST("qemu-ns-commandline-ns0", NONE);
2761 DO_TEST("qemu-ns-commandline-ns1", NONE);
2763 DO_TEST("virtio-input", QEMU_CAPS_VIRTIO_KEYBOARD,
2764 QEMU_CAPS_VIRTIO_MOUSE, QEMU_CAPS_VIRTIO_TABLET);
2765 DO_TEST("virtio-input-passthrough", QEMU_CAPS_VIRTIO_INPUT_HOST);
2767 DO_TEST("ppc64-usb-controller",
2768 QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
2769 QEMU_CAPS_PCI_OHCI);
2770 DO_TEST("ppc64-usb-controller-legacy",
2771 QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
2772 QEMU_CAPS_PIIX3_USB_UHCI);
2773 DO_TEST_FULL("ppc64-usb-controller-qemu-xhci",
2774 ARG_PARSEFLAGS, VIR_DOMAIN_DEF_PARSE_ABI_UPDATE,
2775 ARG_QEMU_CAPS,
2776 QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
2777 QEMU_CAPS_NEC_USB_XHCI,
2778 QEMU_CAPS_DEVICE_QEMU_XHCI);
2780 DO_TEST("aarch64-usb-controller-qemu-xhci",
2781 QEMU_CAPS_OBJECT_GPEX,
2782 QEMU_CAPS_NEC_USB_XHCI,
2783 QEMU_CAPS_DEVICE_QEMU_XHCI);
2785 DO_TEST("aarch64-usb-controller-nec-xhci",
2786 QEMU_CAPS_OBJECT_GPEX,
2787 QEMU_CAPS_NEC_USB_XHCI);
2789 /* VM XML has invalid arch/ostype/virttype combo, but the SKIP flag
2790 * will avoid the error. Still, we expect qemu driver to complain about
2791 * missing machine error, and not crash */
2792 DO_TEST_FULL("missing-machine",
2793 ARG_FLAGS, FLAG_EXPECT_PARSE_ERROR | FLAG_EXPECT_FAILURE,
2794 ARG_PARSEFLAGS, VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE,
2795 ARG_QEMU_CAPS, NONE);
2797 DO_TEST("name-escape",
2798 QEMU_CAPS_NAME_DEBUG_THREADS,
2799 QEMU_CAPS_OBJECT_SECRET,
2800 QEMU_CAPS_DRIVE_IOTUNE_MAX,
2801 QEMU_CAPS_DRIVE_IOTUNE_GROUP,
2802 QEMU_CAPS_VNC,
2803 QEMU_CAPS_NAME_GUEST,
2804 QEMU_CAPS_DEVICE_CIRRUS_VGA,
2805 QEMU_CAPS_SPICE,
2806 QEMU_CAPS_SPICE_UNIX,
2807 QEMU_CAPS_DEVICE_VIRTIO_GPU,
2808 QEMU_CAPS_VIRTIO_GPU_VIRGL,
2809 QEMU_CAPS_SPICE_GL,
2810 QEMU_CAPS_SPICE_RENDERNODE,
2811 QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2812 QEMU_CAPS_DEVICE_ISA_SERIAL,
2813 QEMU_CAPS_CHARDEV_FILE_APPEND,
2814 QEMU_CAPS_CCID_EMULATED,
2815 QEMU_CAPS_VIRTIO_SCSI);
2816 DO_TEST("debug-threads", QEMU_CAPS_NAME_DEBUG_THREADS);
2818 DO_TEST("master-key", QEMU_CAPS_OBJECT_SECRET);
2819 DO_TEST("usb-long-port-path",
2820 QEMU_CAPS_USB_HUB);
2821 DO_TEST_PARSE_ERROR("usb-too-long-port-path-invalid",
2822 QEMU_CAPS_USB_HUB);
2824 DO_TEST("acpi-table", NONE);
2826 DO_TEST_CAPS_LATEST("intel-iommu");
2827 DO_TEST_CAPS_VER("intel-iommu", "2.6.0");
2828 DO_TEST_CAPS_LATEST("intel-iommu-caching-mode");
2829 DO_TEST_CAPS_LATEST("intel-iommu-eim");
2830 DO_TEST_CAPS_LATEST("intel-iommu-device-iotlb");
2831 DO_TEST_PARSE_ERROR("intel-iommu-wrong-machine", NONE);
2832 DO_TEST_CAPS_ARCH_LATEST("iommu-smmuv3", "aarch64");
2834 DO_TEST("cpu-hotplug-startup", QEMU_CAPS_QUERY_HOTPLUGGABLE_CPUS);
2835 DO_TEST_PARSE_ERROR("cpu-hotplug-granularity",
2836 QEMU_CAPS_QUERY_HOTPLUGGABLE_CPUS);
2838 DO_TEST("virtio-options", QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_VIRTIO_KEYBOARD,
2839 QEMU_CAPS_VIRTIO_MOUSE, QEMU_CAPS_VIRTIO_TABLET,
2840 QEMU_CAPS_VIRTIO_INPUT_HOST,
2841 QEMU_CAPS_DEVICE_VIRTIO_GPU,
2842 QEMU_CAPS_VIRTIO_GPU_VIRGL,
2843 QEMU_CAPS_DEVICE_VIRTIO_RNG,
2844 QEMU_CAPS_OBJECT_RNG_RANDOM,
2845 QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2846 QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM,
2847 QEMU_CAPS_VIRTIO_PCI_ATS);
2849 DO_TEST("fd-memory-numa-topology", QEMU_CAPS_OBJECT_MEMORY_FILE,
2850 QEMU_CAPS_KVM);
2851 DO_TEST("fd-memory-numa-topology2", QEMU_CAPS_OBJECT_MEMORY_FILE,
2852 QEMU_CAPS_KVM);
2853 DO_TEST("fd-memory-numa-topology3", QEMU_CAPS_OBJECT_MEMORY_FILE,
2854 QEMU_CAPS_KVM);
2856 DO_TEST("fd-memory-no-numa-topology", QEMU_CAPS_OBJECT_MEMORY_FILE,
2857 QEMU_CAPS_KVM);
2859 DO_TEST_CAPS_LATEST("memfd-memory-numa");
2860 DO_TEST_CAPS_LATEST("memfd-memory-default-hugepage");
2862 DO_TEST("cpu-check-none", QEMU_CAPS_KVM);
2863 DO_TEST("cpu-check-partial", QEMU_CAPS_KVM);
2864 DO_TEST("cpu-check-full", QEMU_CAPS_KVM);
2865 DO_TEST("cpu-check-default-none", QEMU_CAPS_KVM);
2866 DO_TEST("cpu-check-default-none2", NONE);
2867 DO_TEST("cpu-check-default-partial", QEMU_CAPS_KVM);
2868 DO_TEST("cpu-check-default-partial2", QEMU_CAPS_KVM);
2870 DO_TEST("cpu-cache-disable", QEMU_CAPS_KVM, QEMU_CAPS_CPU_CACHE);
2871 DO_TEST("cpu-cache-disable2", QEMU_CAPS_KVM);
2872 DO_TEST("cpu-cache-disable3", QEMU_CAPS_KVM, QEMU_CAPS_CPU_CACHE);
2873 DO_TEST("cpu-cache-passthrough", QEMU_CAPS_KVM, QEMU_CAPS_CPU_CACHE);
2874 DO_TEST("cpu-cache-passthrough2", QEMU_CAPS_KVM);
2875 DO_TEST("cpu-cache-emulate-l3", QEMU_CAPS_KVM, QEMU_CAPS_CPU_CACHE);
2876 DO_TEST_PARSE_ERROR("cpu-cache-emulate-l2", QEMU_CAPS_KVM);
2877 DO_TEST_PARSE_ERROR("cpu-cache-passthrough3", QEMU_CAPS_KVM);
2878 DO_TEST_PARSE_ERROR("cpu-cache-passthrough-l3", QEMU_CAPS_KVM);
2879 DO_TEST("vmcoreinfo", QEMU_CAPS_DEVICE_VMCOREINFO);
2881 DO_TEST("user-aliases", QEMU_CAPS_KVM, QEMU_CAPS_DEVICE_CIRRUS_VGA,
2882 QEMU_CAPS_OBJECT_MEMORY_FILE, QEMU_CAPS_PIIX_DISABLE_S3,
2883 QEMU_CAPS_PIIX_DISABLE_S4, QEMU_CAPS_VNC,
2884 QEMU_CAPS_DEVICE_ISA_SERIAL,
2885 QEMU_CAPS_HDA_DUPLEX,
2886 QEMU_CAPS_CCID_EMULATED,
2887 QEMU_CAPS_QCOW2_LUKS, QEMU_CAPS_OBJECT_SECRET);
2888 DO_TEST("user-aliases2", QEMU_CAPS_DEVICE_IOH3420, QEMU_CAPS_ICH9_AHCI);
2889 DO_TEST("user-aliases-usb", QEMU_CAPS_KVM,
2890 QEMU_CAPS_PIIX_DISABLE_S3, QEMU_CAPS_PIIX_DISABLE_S4,
2891 QEMU_CAPS_ICH9_USB_EHCI1);
2893 DO_TEST_CAPS_VER("disk-virtio-scsi-reservations", "2.12.0");
2894 DO_TEST_CAPS_LATEST("disk-virtio-scsi-reservations");
2896 DO_TEST_CAPS_LATEST("tseg-explicit-size");
2897 DO_TEST_PARSE_ERROR("tseg-i440fx",
2898 QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
2899 QEMU_CAPS_DEVICE_PCI_BRIDGE,
2900 QEMU_CAPS_DEVICE_IOH3420,
2901 QEMU_CAPS_ICH9_AHCI,
2902 QEMU_CAPS_MACHINE_SMM_OPT,
2903 QEMU_CAPS_VIRTIO_SCSI,
2904 QEMU_CAPS_MCH_EXTENDED_TSEG_MBYTES);
2905 DO_TEST_PARSE_ERROR("tseg-explicit-size",
2906 QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
2907 QEMU_CAPS_DEVICE_PCI_BRIDGE,
2908 QEMU_CAPS_DEVICE_IOH3420,
2909 QEMU_CAPS_ICH9_AHCI,
2910 QEMU_CAPS_MACHINE_SMM_OPT,
2911 QEMU_CAPS_VIRTIO_SCSI);
2912 DO_TEST_PARSE_ERROR("tseg-invalid-size",
2913 QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
2914 QEMU_CAPS_DEVICE_PCI_BRIDGE,
2915 QEMU_CAPS_DEVICE_IOH3420,
2916 QEMU_CAPS_ICH9_AHCI,
2917 QEMU_CAPS_MACHINE_SMM_OPT,
2918 QEMU_CAPS_VIRTIO_SCSI,
2919 QEMU_CAPS_MCH_EXTENDED_TSEG_MBYTES);
2921 DO_TEST("video-virtio-gpu-ccw", QEMU_CAPS_CCW,
2922 QEMU_CAPS_DEVICE_VIRTIO_GPU,
2923 QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2924 QEMU_CAPS_VIRTIO_GPU_MAX_OUTPUTS,
2925 QEMU_CAPS_VNC,
2926 QEMU_CAPS_DEVICE_VIRTIO_GPU_CCW);
2928 DO_TEST("input-virtio-ccw", QEMU_CAPS_CCW,
2929 QEMU_CAPS_VIRTIO_KEYBOARD,
2930 QEMU_CAPS_VIRTIO_MOUSE,
2931 QEMU_CAPS_VIRTIO_TABLET,
2932 QEMU_CAPS_DEVICE_VIRTIO_KEYBOARD_CCW,
2933 QEMU_CAPS_DEVICE_VIRTIO_MOUSE_CCW,
2934 QEMU_CAPS_DEVICE_VIRTIO_TABLET_CCW);
2936 DO_TEST_CAPS_LATEST("vhost-vsock");
2937 DO_TEST_CAPS_LATEST("vhost-vsock-auto");
2938 DO_TEST_CAPS_ARCH_LATEST("vhost-vsock-ccw", "s390x");
2939 DO_TEST_CAPS_ARCH_LATEST("vhost-vsock-ccw-auto", "s390x");
2941 DO_TEST_CAPS_VER("launch-security-sev", "2.12.0");
2943 DO_TEST("riscv64-virt",
2944 QEMU_CAPS_DEVICE_VIRTIO_MMIO);
2945 DO_TEST("riscv64-virt-pci",
2946 QEMU_CAPS_OBJECT_GPEX);
2948 /* Older version checks disable-legacy usage */
2949 DO_TEST_CAPS_VER("virtio-transitional", "3.1.0");
2950 DO_TEST_CAPS_VER("virtio-non-transitional", "3.1.0");
2951 DO_TEST_CAPS_LATEST("virtio-transitional");
2952 DO_TEST_CAPS_LATEST("virtio-non-transitional");
2953 DO_TEST_PARSE_ERROR("virtio-transitional-not-supported",
2954 QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
2955 QEMU_CAPS_DEVICE_PCI_BRIDGE,
2956 QEMU_CAPS_DEVICE_IOH3420);
2958 /* Simple headless guests for various architectures */
2959 DO_TEST_CAPS_ARCH_LATEST("aarch64-virt-headless", "aarch64");
2960 DO_TEST_CAPS_ARCH_LATEST("ppc64-pseries-headless", "ppc64");
2961 DO_TEST_CAPS_ARCH_LATEST("riscv64-virt-headless", "riscv64");
2962 DO_TEST_CAPS_ARCH_LATEST("s390x-ccw-headless", "s390x");
2963 DO_TEST_CAPS_ARCH_LATEST("x86_64-pc-headless", "x86_64");
2964 DO_TEST_CAPS_ARCH_LATEST("x86_64-q35-headless", "x86_64");
2966 /* Simple guests with graphics for various architectures */
2967 DO_TEST_CAPS_ARCH_LATEST("aarch64-virt-graphics", "aarch64");
2968 DO_TEST_CAPS_ARCH_LATEST("ppc64-pseries-graphics", "ppc64");
2969 DO_TEST_CAPS_ARCH_LATEST("riscv64-virt-graphics", "riscv64");
2970 DO_TEST_CAPS_ARCH_LATEST("s390x-ccw-graphics", "s390x");
2971 DO_TEST_CAPS_ARCH_LATEST("x86_64-pc-graphics", "x86_64");
2972 DO_TEST_CAPS_ARCH_LATEST("x86_64-q35-graphics", "x86_64");
2974 DO_TEST_CAPS_LATEST("os-firmware-bios");
2975 DO_TEST_CAPS_LATEST("os-firmware-efi");
2976 DO_TEST_CAPS_LATEST("os-firmware-efi-secboot");
2977 DO_TEST_CAPS_ARCH_LATEST("aarch64-os-firmware-efi", "aarch64");
2979 if (getenv("LIBVIRT_SKIP_CLEANUP") == NULL)
2980 virFileDeleteTree(fakerootdir);
2982 VIR_FREE(driver.config->nbdTLSx509certdir);
2983 qemuTestDriverFree(&driver);
2984 VIR_FREE(fakerootdir);
2985 virHashFree(capslatest);
2986 virFileWrapperClearPrefixes();
2988 return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
2991 VIR_TEST_MAIN_PRELOAD(mymain,
2992 abs_builddir "/.libs/qemuxml2argvmock.so",
2993 abs_builddir "/.libs/virrandommock.so",
2994 abs_builddir "/.libs/qemucpumock.so",
2995 abs_builddir "/.libs/virpcimock.so")
2997 #else
2999 int main(void)
3001 return EXIT_AM_SKIP;
3004 #endif /* WITH_QEMU */