qemuxml2argvtest.c 118.4 KB
Newer Older
1
#include <config.h>
2 3

#include <unistd.h>
4 5 6 7

#include <sys/types.h>
#include <fcntl.h>

8 9
#include "testutils.h"

10 11
#ifdef WITH_QEMU

12
# include "internal.h"
13
# include "viralloc.h"
14
# include "qemu/qemu_alias.h"
15 16
# include "qemu/qemu_capabilities.h"
# include "qemu/qemu_command.h"
M
Matthias Bolte 已提交
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 27
# include "virfilewrapper.h"
# include "configmake.h"
28

29
# define LIBVIRT_QEMU_CAPSPRIV_H_ALLOW
30 31
# include "qemu/qemu_capspriv.h"

32
# include "testutilsqemu.h"
33

34 35
# define VIR_FROM_THIS VIR_FROM_QEMU

36
static virQEMUDriver driver;
37

38 39 40 41 42 43
static unsigned char *
fakeSecretGetValue(virSecretPtr obj ATTRIBUTE_UNUSED,
                   size_t *value_size,
                   unsigned int fakeflags ATTRIBUTE_UNUSED,
                   unsigned int internalFlags ATTRIBUTE_UNUSED)
{
44 45
    char *secret;
    if (VIR_STRDUP(secret, "AQCVn5hO6HzFAhAAq0NCv8jtJcIcE+HOBlMQ1A") < 0)
46
        return NULL;
47 48 49 50 51 52
    *value_size = strlen(secret);
    return (unsigned char *) secret;
}

static virSecretPtr
fakeSecretLookupByUsage(virConnectPtr conn,
53
                        int usageType,
54 55
                        const char *usageID)
{
56
    unsigned char uuid[VIR_UUID_BUFLEN];
57 58 59 60 61 62 63 64 65 66
    if (usageType == VIR_SECRET_USAGE_TYPE_VOLUME) {
        if (!STRPREFIX(usageID, "/storage/guest_disks/")) {
            virReportError(VIR_ERR_INTERNAL_ERROR,
                           "test provided invalid volume storage prefix '%s'",
                           usageID);
            return NULL;
        }
    } else if (STRNEQ(usageID, "mycluster_myname")) {
        virReportError(VIR_ERR_INTERNAL_ERROR,
                       "test provided incorrect usage '%s'", usageID);
67
        return NULL;
68
    }
69

70 71 72
    if (virUUIDGenerate(uuid) < 0)
        return NULL;

73
    return virGetSecret(conn, uuid, usageType, usageID);
74 75
}

76 77 78 79
static virSecretPtr
fakeSecretLookupByUUID(virConnectPtr conn,
                       const unsigned char *uuid)
{
80 81 82
    /* NB: This mocked value could be "tls" or "volume" depending on
     * which test is being run, we'll leave at NONE (or 0) */
    return virGetSecret(conn, uuid, VIR_SECRET_USAGE_TYPE_NONE, "");
83 84
}

85
static virSecretDriver fakeSecretDriver = {
86 87
    .connectNumOfSecrets = NULL,
    .connectListSecrets = NULL,
88
    .secretLookupByUUID = fakeSecretLookupByUUID,
89 90 91 92 93 94
    .secretLookupByUsage = fakeSecretLookupByUsage,
    .secretDefineXML = NULL,
    .secretGetXMLDesc = NULL,
    .secretSetValue = NULL,
    .secretGetValue = fakeSecretGetValue,
    .secretUndefine = NULL,
95 96
};

97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123

# define STORAGE_POOL_XML_PATH "storagepoolxml2xmlout/"
static const unsigned char fakeUUID[VIR_UUID_BUFLEN] = "fakeuuid";

static virStoragePoolPtr
fakeStoragePoolLookupByName(virConnectPtr conn,
                            const char *name)
{
    char *xmlpath = NULL;
    virStoragePoolPtr ret = NULL;

    if (STRNEQ(name, "inactive")) {
        if (virAsprintf(&xmlpath, "%s/%s%s.xml",
                        abs_srcdir,
                        STORAGE_POOL_XML_PATH,
                        name) < 0)
            return NULL;

        if (!virFileExists(xmlpath)) {
            virReportError(VIR_ERR_NO_STORAGE_POOL,
                           "File '%s' not found", xmlpath);
            goto cleanup;
        }
    }

    ret = virGetStoragePool(conn, name, fakeUUID, NULL, NULL);

124
 cleanup:
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
    VIR_FREE(xmlpath);
    return ret;
}


static virStorageVolPtr
fakeStorageVolLookupByName(virStoragePoolPtr pool,
                           const char *name)
{
    char **volinfo = NULL;
    virStorageVolPtr ret = NULL;

    if (STREQ(pool->name, "inactive")) {
        virReportError(VIR_ERR_OPERATION_INVALID,
                       "storage pool '%s' is not active", pool->name);
        return NULL;
    }

    if (STREQ(name, "nonexistent")) {
        virReportError(VIR_ERR_NO_STORAGE_VOL,
                       "no storage vol with matching name '%s'", name);
        return NULL;
    }

    if (!strchr(name, '+'))
        goto fallback;

    if (!(volinfo = virStringSplit(name, "+", 2)))
        return NULL;

    if (!volinfo[1])
        goto fallback;

    ret = virGetStorageVol(pool->conn, pool->name, volinfo[1], volinfo[0],
                           NULL, NULL);

161
 cleanup:
162
    virStringListFree(volinfo);
163 164
    return ret;

165
 fallback:
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216
    ret = virGetStorageVol(pool->conn, pool->name, name, "block", NULL, NULL);
    goto cleanup;
}

static int
fakeStorageVolGetInfo(virStorageVolPtr vol,
                      virStorageVolInfoPtr info)
{
    memset(info, 0, sizeof(*info));

    info->type = virStorageVolTypeFromString(vol->key);

    if (info->type < 0) {
        virReportError(VIR_ERR_INTERNAL_ERROR,
                       "Invalid volume type '%s'", vol->key);
        return -1;
    }

    return 0;
}


static char *
fakeStorageVolGetPath(virStorageVolPtr vol)
{
    char *ret = NULL;

    ignore_value(virAsprintf(&ret, "/some/%s/device/%s", vol->key, vol->name));

    return ret;
}


static char *
fakeStoragePoolGetXMLDesc(virStoragePoolPtr pool,
                          unsigned int flags_unused ATTRIBUTE_UNUSED)
{
    char *xmlpath = NULL;
    char *xmlbuf = NULL;

    if (STREQ(pool->name, "inactive")) {
        virReportError(VIR_ERR_NO_STORAGE_POOL, NULL);
        return NULL;
    }

    if (virAsprintf(&xmlpath, "%s/%s%s.xml",
                    abs_srcdir,
                    STORAGE_POOL_XML_PATH,
                    pool->name) < 0)
        return NULL;

217
    if (virTestLoadFile(xmlpath, &xmlbuf) < 0) {
218 219 220 221 222 223
        virReportError(VIR_ERR_INTERNAL_ERROR,
                       "failed to load XML file '%s'",
                       xmlpath);
        goto cleanup;
    }

224
 cleanup:
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241
    VIR_FREE(xmlpath);

    return xmlbuf;
}

static int
fakeStoragePoolIsActive(virStoragePoolPtr pool)
{
    if (STREQ(pool->name, "inactive"))
        return 0;

    return 1;
}

/* Test storage pool implementation
 *
 * These functions aid testing of storage pool related stuff when creating a
242
 * qemu command line.
243 244 245
 *
 * There are a few "magic" values to pass to these functions:
 *
246 247
 * 1) "inactive" as a pool name to create an inactive pool. All other names are
 * interpreted as file names in storagepoolxml2xmlout/ and are used as the
248 249 250
 * definition for the pool. If the file doesn't exist the pool doesn't exist.
 *
 * 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 253 254 255 256 257 258 259 260 261 262 263
 * This creates a fake path for this volume. If the '+' sign is omitted, block
 * type is assumed.
 */
static virStorageDriver fakeStorageDriver = {
    .storagePoolLookupByName = fakeStoragePoolLookupByName,
    .storageVolLookupByName = fakeStorageVolLookupByName,
    .storagePoolGetXMLDesc = fakeStoragePoolGetXMLDesc,
    .storageVolGetPath = fakeStorageVolGetPath,
    .storageVolGetInfo = fakeStorageVolGetInfo,
    .storagePoolIsActive = fakeStoragePoolIsActive,
};

264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290

/* virNetDevOpenvswitchGetVhostuserIfname mocks a portdev name - handle that */
static virNWFilterBindingPtr
fakeNWFilterBindingLookupByPortDev(virConnectPtr conn,
                                   const char *portdev)
{
    if (STREQ(portdev, "vhost-user0"))
        return virGetNWFilterBinding(conn, "fake_vnet0", "fakeFilterName");

    virReportError(VIR_ERR_NO_NWFILTER_BINDING,
                   "no nwfilter binding for port dev '%s'", portdev);
    return NULL;
}


static int
fakeNWFilterBindingDelete(virNWFilterBindingPtr binding ATTRIBUTE_UNUSED)
{
    return 0;
}


static virNWFilterDriver fakeNWFilterDriver = {
    .nwfilterBindingLookupByPortDev = fakeNWFilterBindingLookupByPortDev,
    .nwfilterBindingDelete = fakeNWFilterBindingDelete,
};

291
typedef enum {
292 293
    FLAG_EXPECT_FAILURE     = 1 << 0,
    FLAG_EXPECT_PARSE_ERROR = 1 << 1,
294
    FLAG_FIPS               = 1 << 2,
295 296
    FLAG_REAL_CAPS          = 1 << 3,
    FLAG_SKIP_LEGACY_CPUS   = 1 << 4,
297 298
} virQemuXML2ArgvTestFlags;

299 300
struct testInfo {
    const char *name;
301
    const char *suffix;
302 303 304 305 306 307 308
    virQEMUCapsPtr qemuCaps;
    const char *migrateFrom;
    int migrateFd;
    unsigned int flags;
    unsigned int parseFlags;
};

309 310 311 312

static int
testAddCPUModels(virQEMUCapsPtr caps, bool skipLegacy)
{
313 314
    virArch arch = virQEMUCapsGetArch(caps);
    const char *x86Models[] = {
315 316 317 318
        "Opteron_G3", "Opteron_G2", "Opteron_G1",
        "Nehalem", "Penryn", "Conroe",
        "Haswell-noTSX", "Haswell",
    };
319
    const char *x86LegacyModels[] = {
320 321 322 323
        "n270", "athlon", "pentium3", "pentium2", "pentium",
        "486", "coreduo", "kvm32", "qemu32", "kvm64",
        "core2duo", "phenom", "qemu64",
    };
324 325 326 327 328 329
    const char *armModels[] = {
        "cortex-a9", "cortex-a8", "cortex-a57", "cortex-a53",
    };
    const char *ppc64Models[] = {
        "POWER8", "POWER7",
    };
330 331 332
    const char *s390xModels[] = {
        "z990", "zEC12", "z13",
    };
333

334
    if (ARCH_IS_X86(arch)) {
335
        if (virQEMUCapsAddCPUDefinitions(caps, VIR_DOMAIN_VIRT_KVM, x86Models,
336 337
                                         ARRAY_CARDINALITY(x86Models),
                                         VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0 ||
338
            virQEMUCapsAddCPUDefinitions(caps, VIR_DOMAIN_VIRT_QEMU, x86Models,
339 340
                                         ARRAY_CARDINALITY(x86Models),
                                         VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0)
341 342
            return -1;

343 344 345
        if (!skipLegacy) {
            if (virQEMUCapsAddCPUDefinitions(caps, VIR_DOMAIN_VIRT_KVM,
                                             x86LegacyModels,
346 347
                                             ARRAY_CARDINALITY(x86LegacyModels),
                                             VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0 ||
348 349
                virQEMUCapsAddCPUDefinitions(caps, VIR_DOMAIN_VIRT_QEMU,
                                             x86LegacyModels,
350 351
                                             ARRAY_CARDINALITY(x86LegacyModels),
                                             VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0)
352 353
                return -1;
        }
354
    } else if (ARCH_IS_ARM(arch)) {
355
        if (virQEMUCapsAddCPUDefinitions(caps, VIR_DOMAIN_VIRT_KVM, armModels,
356 357
                                         ARRAY_CARDINALITY(armModels),
                                         VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0 ||
358
            virQEMUCapsAddCPUDefinitions(caps, VIR_DOMAIN_VIRT_QEMU, armModels,
359 360
                                         ARRAY_CARDINALITY(armModels),
                                         VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0)
361 362
            return -1;
    } else if (ARCH_IS_PPC64(arch)) {
363
        if (virQEMUCapsAddCPUDefinitions(caps, VIR_DOMAIN_VIRT_KVM, ppc64Models,
364 365
                                         ARRAY_CARDINALITY(ppc64Models),
                                         VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0 ||
366
            virQEMUCapsAddCPUDefinitions(caps, VIR_DOMAIN_VIRT_QEMU, ppc64Models,
367 368
                                         ARRAY_CARDINALITY(ppc64Models),
                                         VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0)
369
            return -1;
370 371 372 373 374
    } else if (ARCH_IS_S390(arch)) {
        if (virQEMUCapsAddCPUDefinitions(caps, VIR_DOMAIN_VIRT_KVM, s390xModels,
                                         ARRAY_CARDINALITY(s390xModels),
                                         VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0)
            return -1;
375
    }
376 377 378 379 380

    return 0;
}


381 382
static int
testUpdateQEMUCaps(const struct testInfo *info,
383 384
                   virDomainObjPtr vm,
                   virCapsPtr caps)
385 386 387
{
    int ret = -1;

388 389 390
    if (!caps)
        goto cleanup;

391 392
    virQEMUCapsSetArch(info->qemuCaps, vm->def->os.arch);

393 394
    virQEMUCapsInitQMPBasicArch(info->qemuCaps);

395 396
    if (testAddCPUModels(info->qemuCaps,
                         !!(info->flags & FLAG_SKIP_LEGACY_CPUS)) < 0)
397 398
        goto cleanup;

399 400 401 402
    virQEMUCapsInitHostCPUModel(info->qemuCaps, caps->host.arch,
                                VIR_DOMAIN_VIRT_KVM);
    virQEMUCapsInitHostCPUModel(info->qemuCaps, caps->host.arch,
                                VIR_DOMAIN_VIRT_QEMU);
403

404 405 406 407 408 409 410
    ret = 0;

 cleanup:
    return ret;
}


411 412 413 414 415 416
static int
testCheckExclusiveFlags(int flags)
{
    virCheckFlags(FLAG_EXPECT_FAILURE |
                  FLAG_EXPECT_PARSE_ERROR |
                  FLAG_FIPS |
417
                  FLAG_REAL_CAPS |
418
                  FLAG_SKIP_LEGACY_CPUS |
419 420
                  0, -1);

421
    VIR_EXCLUSIVE_FLAGS_RET(FLAG_REAL_CAPS, FLAG_SKIP_LEGACY_CPUS, -1);
422 423 424 425
    return 0;
}


426 427 428 429
static int
testCompareXMLToArgv(const void *data)
{
    struct testInfo *info = (void *) data;
430 431 432
    char *xml = NULL;
    char *args = NULL;
    char *migrateURI = NULL;
433
    char *actualargv = NULL;
434
    const char *suffix = info->suffix;
435 436
    unsigned int flags = info->flags;
    unsigned int parseFlags = info->parseFlags;
E
Eric Blake 已提交
437
    int ret = -1;
438
    virDomainObjPtr vm = NULL;
439
    virDomainChrSourceDef monitor_chr;
440
    virConnectPtr conn;
J
Jiri Denemark 已提交
441
    char *log = NULL;
E
Eric Blake 已提交
442
    virCommandPtr cmd = NULL;
443
    size_t i;
444
    qemuDomainObjPrivatePtr priv = NULL;
445

446 447
    memset(&monitor_chr, 0, sizeof(monitor_chr));

448
    if (!(conn = virGetConnect()))
449
        goto cleanup;
450

451 452 453
    if (!suffix)
        suffix = "";

454
    conn->secretDriver = &fakeSecretDriver;
455
    conn->storageDriver = &fakeStorageDriver;
456
    conn->nwfilterDriver = &fakeNWFilterDriver;
457

458 459 460 461
    virSetConnectInterface(conn);
    virSetConnectNetwork(conn);
    virSetConnectNWFilter(conn);
    virSetConnectNodeDev(conn);
462 463 464
    virSetConnectSecret(conn);
    virSetConnectStorage(conn);

465 466 467
    if (virQEMUCapsGet(info->qemuCaps, QEMU_CAPS_ENABLE_FIPS))
        flags |= FLAG_FIPS;

468 469 470
    if (testCheckExclusiveFlags(info->flags) < 0)
        goto cleanup;

471
    if (qemuTestCapsCacheInsert(driver.qemuCapsCache, info->qemuCaps) < 0)
472 473
        goto cleanup;

474
    if (virAsprintf(&xml, "%s/qemuxml2argvdata/%s.xml",
475
                    abs_srcdir, info->name) < 0 ||
476 477
        virAsprintf(&args, "%s/qemuxml2argvdata/%s%s.args",
                    abs_srcdir, info->name, suffix) < 0)
478 479 480
        goto cleanup;

    if (info->migrateFrom &&
481 482
        !(migrateURI = qemuMigrationDstGetURI(info->migrateFrom,
                                              info->migrateFd)))
483 484
        goto cleanup;

485
    if (!(vm = virDomainObjNew(driver.xmlopt)))
486
        goto cleanup;
487

488
    parseFlags |= VIR_DOMAIN_DEF_PARSE_INACTIVE;
489
    if (!(vm->def = virDomainDefParseFile(xml, driver.caps, driver.xmlopt,
490
                                          NULL, parseFlags))) {
P
Pavel Hrdina 已提交
491
        if (flags & FLAG_EXPECT_PARSE_ERROR)
492
            goto ok;
493
        goto cleanup;
494
    }
495 496 497 498
    if (flags & FLAG_EXPECT_PARSE_ERROR) {
        VIR_TEST_DEBUG("passed instead of expected parse error");
        goto cleanup;
    }
499
    priv = vm->privateData;
500

501
    if (virBitmapParse("0-3", &priv->autoNodeset, 4) < 0)
502
        goto cleanup;
P
Pavel Hrdina 已提交
503

504
    if (!virDomainDefCheckABIStability(vm->def, vm->def, driver.xmlopt)) {
505
        VIR_TEST_DEBUG("ABI stability check failed on %s", xml);
506
        goto cleanup;
507 508
    }

509
    vm->def->id = -1;
510

511
    if (qemuProcessPrepareMonitorChr(&monitor_chr, priv->libDir) < 0)
512
        goto cleanup;
513

514 515
    if (!(info->flags & FLAG_REAL_CAPS) &&
        testUpdateQEMUCaps(info, vm, driver.caps) < 0)
516
        goto cleanup;
517

518
    log = virTestLogContentAndReset();
519
    VIR_FREE(log);
520
    virResetLastError();
J
Jiri Denemark 已提交
521

522 523
    for (i = 0; i < vm->def->nhostdevs; i++) {
        virDomainHostdevDefPtr hostdev = vm->def->hostdevs[i];
524 525 526 527 528 529 530 531

        if (hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
            hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI &&
            hostdev->source.subsys.u.pci.backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT) {
            hostdev->source.subsys.u.pci.backend = VIR_DOMAIN_HOSTDEV_PCI_BACKEND_KVM;
        }
    }

532 533 534 535 536 537 538 539 540 541 542
    if (vm->def->vsock) {
        virDomainVsockDefPtr vsock = vm->def->vsock;
        qemuDomainVsockPrivatePtr vsockPriv =
            (qemuDomainVsockPrivatePtr)vsock->privateData;

        if (vsock->auto_cid == VIR_TRISTATE_BOOL_YES)
            vsock->guest_cid = 42;

        vsockPriv->vhostfd = 6789;
    }

543 544 545
    if (vm->def->tpm) {
        switch (vm->def->tpm->type) {
        case VIR_DOMAIN_TPM_TYPE_EMULATOR:
546
            VIR_FREE(vm->def->tpm->data.emulator.source.data.file.path);
547 548 549
            if (VIR_STRDUP(vm->def->tpm->data.emulator.source.data.file.path,
                           "/dev/test") < 0)
                goto cleanup;
550
            vm->def->tpm->data.emulator.source.type = VIR_DOMAIN_CHR_TYPE_FILE;
551 552 553 554 555 556 557
            break;
        case VIR_DOMAIN_TPM_TYPE_PASSTHROUGH:
        case VIR_DOMAIN_TPM_TYPE_LAST:
            break;
       }
    }

558
    if (!(cmd = qemuProcessCreatePretendCmd(&driver, vm, migrateURI,
P
Pavel Hrdina 已提交
559 560
                                            (flags & FLAG_FIPS), false,
                                            VIR_QEMU_PROCESS_START_COLD))) {
P
Pavel Hrdina 已提交
561 562
        if (flags & FLAG_EXPECT_FAILURE)
            goto ok;
563
        goto cleanup;
J
Jiri Denemark 已提交
564
    }
565 566 567 568
    if (flags & FLAG_EXPECT_FAILURE) {
        VIR_TEST_DEBUG("passed instead of expected failure");
        goto cleanup;
    }
J
Jiri Denemark 已提交
569

570
    if (!(actualargv = virCommandToString(cmd, false)))
571
        goto cleanup;
E
Eric Blake 已提交
572

573
    if (virTestCompareToFile(actualargv, args) < 0)
574
        goto cleanup;
575

P
Pavel Hrdina 已提交
576 577
    ret = 0;

578
 ok:
579
    if (ret == 0 && flags & FLAG_EXPECT_FAILURE) {
P
Pavel Hrdina 已提交
580 581
        ret = -1;
        VIR_TEST_DEBUG("Error expected but there wasn't any.\n");
582
        goto cleanup;
P
Pavel Hrdina 已提交
583
    }
584
    if (!virTestOOMActive()) {
585
        if (flags & FLAG_EXPECT_FAILURE) {
586
            if ((log = virTestLogContentAndReset()))
P
Pavel Hrdina 已提交
587 588
                VIR_TEST_DEBUG("Got expected error: \n%s", log);
        }
589
        virResetLastError();
P
Pavel Hrdina 已提交
590
        ret = 0;
591 592
    }

593
 cleanup:
594 595
    VIR_FREE(log);
    VIR_FREE(actualargv);
596
    virDomainChrSourceDefClear(&monitor_chr);
E
Eric Blake 已提交
597
    virCommandFree(cmd);
598
    virObjectUnref(vm);
599 600
    virSetConnectSecret(NULL);
    virSetConnectStorage(NULL);
601
    virObjectUnref(conn);
602
    VIR_FREE(migrateURI);
603 604
    VIR_FREE(xml);
    VIR_FREE(args);
605
    return ret;
606 607
}

608 609
# define TEST_CAPS_PATH abs_srcdir "/qemucapabilitiesdata"

610 611
typedef enum {
    ARG_QEMU_CAPS,
612
    ARG_GIC,
613 614
    ARG_MIGRATE_FROM,
    ARG_MIGRATE_FD,
615
    ARG_FLAGS,
616
    ARG_PARSEFLAGS,
617 618
    ARG_CAPS_ARCH,
    ARG_CAPS_VER,
619 620 621 622 623 624 625 626 627 628 629 630 631 632 633

    /* ARG_END is our va_args sentinel. The value QEMU_CAPS_LATEST is
     * necessary to handle the DO_TEST(..., NONE) case, which through macro
     * magic will give the va_args list:
     *
     *   ARG_QEMU_CAPS, NONE, QEMU_CAPS_LAST, ARG_END
     *
     * SetArgs consumes the first item, hands off control to virQEMUCapsX
     * virQEMUCapsX sees NONE aka QEMU_CAPS_LAST, returns to SetArgs.
     * SetArgs sees QEMU_CAPS_LAST aka ARG_END, and exits the parse loop.
     * If ARG_END != QEMU_CAPS_LAST, this last step would generate an error.
     */
    ARG_END = QEMU_CAPS_LAST,
} testInfoArgName;

634
static int
635 636
testInfoSetArgs(struct testInfo *info,
                virHashTablePtr capslatest, ...)
637 638
{
    va_list argptr;
639
    testInfoArgName argname;
640 641
    virQEMUCapsPtr qemuCaps = NULL;
    int gic = GIC_NONE;
642 643 644
    char *capsarch = NULL;
    char *capsver = NULL;
    VIR_AUTOFREE(char *) capsfile = NULL;
645
    int ret = -1;
646

647
    va_start(argptr, capslatest);
648 649 650
    while ((argname = va_arg(argptr, testInfoArgName)) < ARG_END) {
        switch (argname) {
        case ARG_QEMU_CAPS:
651 652 653
            if (qemuCaps || !(qemuCaps = virQEMUCapsNew()))
                goto cleanup;
            virQEMUCapsSetVAList(qemuCaps, argptr);
654 655
            break;

656
        case ARG_GIC:
657
            gic = va_arg(argptr, int);
658 659
            break;

660 661 662 663 664 665 666 667
        case ARG_MIGRATE_FROM:
            info->migrateFrom = va_arg(argptr, char *);
            break;

        case ARG_MIGRATE_FD:
            info->migrateFd = va_arg(argptr, int);
            break;

668 669 670 671
        case ARG_FLAGS:
            info->flags = va_arg(argptr, int);
            break;

672 673 674 675
        case ARG_PARSEFLAGS:
            info->parseFlags = va_arg(argptr, int);
            break;

676 677 678 679 680 681 682 683
        case ARG_CAPS_ARCH:
            capsarch = va_arg(argptr, char *);
            break;

        case ARG_CAPS_VER:
            capsver = va_arg(argptr, char *);
            break;

684 685 686 687 688 689 690
        case ARG_END:
        default:
            fprintf(stderr, "Unexpected test info argument");
            goto cleanup;
        }
    }

691 692 693 694 695 696 697 698 699 700 701 702
    if (!!capsarch ^ !!capsver) {
        fprintf(stderr, "ARG_CAPS_ARCH and ARG_CAPS_VER "
                        "must be specified together.\n");
        goto cleanup;
    }

    if (qemuCaps && (capsarch || capsver)) {
        fprintf(stderr, "ARG_QEMU_CAPS can not be combined with ARG_CAPS_ARCH "
                        "or ARG_CAPS_VER\n");
        goto cleanup;
    }

703 704 705 706 707 708 709 710 711 712 713 714 715 716
    if (!qemuCaps && capsarch && capsver) {
        bool stripmachinealiases = false;

        if (STREQ(capsver, "latest")) {
            if (VIR_STRDUP(capsfile, virHashLookup(capslatest, capsarch)) < 0)
                goto cleanup;
            stripmachinealiases = true;
        } else if (virAsprintf(&capsfile, "%s/caps_%s.%s.xml",
                               TEST_CAPS_PATH, capsver, capsarch) < 0) {
            goto cleanup;
        }

        if (!(qemuCaps = qemuTestParseCapabilitiesArch(virArchFromString(capsarch),
                                                       capsfile))) {
717 718
            goto cleanup;
        }
719 720 721 722

        if (stripmachinealiases)
            virQEMUCapsStripMachineAliases(qemuCaps);
        info->flags |= FLAG_REAL_CAPS;
723 724
    }

725 726 727 728 729 730
    if (!qemuCaps) {
        fprintf(stderr, "No qemuCaps generated\n");
        goto cleanup;
    }
    VIR_STEAL_PTR(info->qemuCaps, qemuCaps);

731 732 733
    if (gic != GIC_NONE && testQemuCapsSetGIC(info->qemuCaps, gic) < 0)
        goto cleanup;

734 735 736
    ret = 0;

 cleanup:
737
    virObjectUnref(qemuCaps);
738 739 740 741 742
    va_end(argptr);

    return ret;
}

743 744 745 746 747 748
static void
testInfoClear(struct testInfo *info)
{
    virObjectUnref(info->qemuCaps);
}

A
Andrea Bolognani 已提交
749
# define FAKEROOTDIRTEMPLATE abs_builddir "/fakerootdir-XXXXXX"
750

751
static int
E
Eric Blake 已提交
752
mymain(void)
753
{
754
    int ret = 0, i;
A
Andrea Bolognani 已提交
755
    char *fakerootdir;
756 757 758 759 760 761 762
    const char *archs[] = {
        "aarch64",
        "ppc64",
        "riscv64",
        "s390x",
        "x86_64",
    };
763
    virHashTablePtr capslatest = NULL;
764

A
Andrea Bolognani 已提交
765 766 767 768 769 770 771 772 773 774 775 776
    if (VIR_STRDUP_QUIET(fakerootdir, FAKEROOTDIRTEMPLATE) < 0) {
        fprintf(stderr, "Out of memory\n");
        abort();
    }

    if (!mkdtemp(fakerootdir)) {
        fprintf(stderr, "Cannot create fakerootdir");
        abort();
    }

    setenv("LIBVIRT_FAKE_ROOT_DIR", fakerootdir, 1);

777 778 779 780 781 782 783 784 785 786
    /* Set the timezone because we are mocking the time() function.
     * If we don't do that, then localtime() may return unpredictable
     * results. In order to detect things that just work by a blind
     * chance, we need to set an virtual timezone that no libvirt
     * developer resides in. */
    if (setenv("TZ", "VIR00:30", 1) < 0) {
        perror("setenv");
        return EXIT_FAILURE;
    }

787
    if (qemuTestDriverInit(&driver) < 0)
788
        return EXIT_FAILURE;
789 790

    driver.privileged = true;
791

792 793 794
    VIR_FREE(driver.config->defaultTLSx509certdir);
    if (VIR_STRDUP_QUIET(driver.config->defaultTLSx509certdir, "/etc/pki/qemu") < 0)
        return EXIT_FAILURE;
795
    VIR_FREE(driver.config->vncTLSx509certdir);
796
    if (VIR_STRDUP_QUIET(driver.config->vncTLSx509certdir, "/etc/pki/libvirt-vnc") < 0)
797 798
        return EXIT_FAILURE;
    VIR_FREE(driver.config->spiceTLSx509certdir);
799
    if (VIR_STRDUP_QUIET(driver.config->spiceTLSx509certdir, "/etc/pki/libvirt-spice") < 0)
800
        return EXIT_FAILURE;
801 802 803
    VIR_FREE(driver.config->chardevTLSx509certdir);
    if (VIR_STRDUP_QUIET(driver.config->chardevTLSx509certdir, "/etc/pki/libvirt-chardev") < 0)
        return EXIT_FAILURE;
804
    VIR_FREE(driver.config->vxhsTLSx509certdir);
805
    if (VIR_STRDUP_QUIET(driver.config->vxhsTLSx509certdir, "/etc/pki/libvirt-vxhs/dummy,path") < 0)
806
        return EXIT_FAILURE;
807 808 809
    VIR_FREE(driver.config->nbdTLSx509certdir);
    if (VIR_STRDUP_QUIET(driver.config->nbdTLSx509certdir, "/etc/pki/libvirt-nbd/dummy,path") < 0)
        return EXIT_FAILURE;
810

811
    VIR_FREE(driver.config->hugetlbfs);
812
    if (VIR_ALLOC_N(driver.config->hugetlbfs, 2) < 0)
813
        return EXIT_FAILURE;
814 815 816
    driver.config->nhugetlbfs = 2;
    if (VIR_STRDUP(driver.config->hugetlbfs[0].mnt_dir, "/dev/hugepages2M") < 0 ||
        VIR_STRDUP(driver.config->hugetlbfs[1].mnt_dir, "/dev/hugepages1G") < 0)
817
        return EXIT_FAILURE;
818 819
    driver.config->hugetlbfs[0].size = 2048;
    driver.config->hugetlbfs[0].deflt = true;
820
    driver.config->hugetlbfs[1].size = 1048576;
821
    driver.config->spiceTLS = 1;
822
    if (VIR_STRDUP_QUIET(driver.config->spicePassword, "123456") < 0)
823
        return EXIT_FAILURE;
824 825 826
    VIR_FREE(driver.config->memoryBackingDir);
    if (VIR_STRDUP_QUIET(driver.config->memoryBackingDir, "/var/lib/libvirt/qemu/ram") < 0)
        return EXIT_FAILURE;
827 828 829
    VIR_FREE(driver.config->nvramDir);
    if (VIR_STRDUP(driver.config->nvramDir, "/var/lib/libvirt/qemu/nvram") < 0)
        return EXIT_FAILURE;
830

831 832
    capslatest = virHashCreate(4, virHashValueFree);
    if (!capslatest)
833 834
        return EXIT_FAILURE;

835
    VIR_TEST_VERBOSE("\n");
836

837 838 839 840 841 842 843 844 845 846 847
    for (i = 0; i < ARRAY_CARDINALITY(archs); ++i) {
        char *cap = testQemuGetLatestCapsForArch(abs_srcdir "/qemucapabilitiesdata",
                                                 archs[i], "xml");

        if (!cap || virHashAddEntry(capslatest, archs[i], cap) < 0)
            return EXIT_FAILURE;

        VIR_TEST_VERBOSE("latest caps for %s: %s\n", archs[i], cap);
    }

    VIR_TEST_VERBOSE("\n");
848

849 850 851 852 853 854 855
    virFileWrapperAddPrefix(SYSCONFDIR "/qemu/firmware",
                            abs_srcdir "/qemufirmwaredata/etc/qemu/firmware");
    virFileWrapperAddPrefix(PREFIX "/share/qemu/firmware",
                            abs_srcdir "/qemufirmwaredata/usr/share/qemu/firmware");
    virFileWrapperAddPrefix("/home/user/.config/qemu/firmware",
                            abs_srcdir "/qemufirmwaredata/home/user/.config/qemu/firmware");

856 857 858 859 860 861 862 863 864 865 866 867 868 869
/**
 * The following set of macros allows testing of XML -> argv conversion with a
 * real set of capabilities gathered from a real qemu copy. It is desired to use
 * these for positive test cases as it provides combinations of flags which
 * can be met in real life.
 *
 * The capabilities are taken from the real capabilities stored in
 * tests/qemucapabilitiesdata.
 *
 * It is suggested to use the DO_TEST_CAPS_LATEST macro which always takes the
 * most recent capability set. In cases when the new code would change behaviour
 * the test cases should be forked using DO_TEST_CAPS_VER with the appropriate
 * version.
 */
870
# define DO_TEST_INTERNAL(_name, _suffix, ...) \
871 872
    do { \
        static struct testInfo info = { \
873
            .name = _name, \
874
            .suffix = _suffix, \
875
        }; \
876
        if (testInfoSetArgs(&info, capslatest, \
877
                            __VA_ARGS__, ARG_END) < 0) \
878
            return EXIT_FAILURE; \
879
        if (virTestRun("QEMU XML-2-ARGV " _name _suffix, \
880 881
                       testCompareXMLToArgv, &info) < 0) \
            ret = -1; \
882
        testInfoClear(&info); \
883 884
    } while (0)

885 886 887 888 889 890
# define DO_TEST_CAPS_INTERNAL(name, arch, ver, ...) \
    DO_TEST_INTERNAL(name, "." arch "-" ver, \
                     ARG_CAPS_ARCH, arch, \
                     ARG_CAPS_VER, ver, \
                     __VA_ARGS__)

891
# define DO_TEST_CAPS_ARCH_VER(name, arch, ver) \
892
    DO_TEST_CAPS_INTERNAL(name, arch, ver, ARG_END)
893 894

# define DO_TEST_CAPS_VER(name, ver) \
895
    DO_TEST_CAPS_ARCH_VER(name, "x86_64", ver)
896

897
# define DO_TEST_CAPS_ARCH_LATEST_FULL(name, arch, ...) \
898
    DO_TEST_CAPS_INTERNAL(name, arch, "latest", __VA_ARGS__)
899

900
# define DO_TEST_CAPS_ARCH_LATEST(name, arch) \
901
    DO_TEST_CAPS_ARCH_LATEST_FULL(name, arch, ARG_END)
902

903
# define DO_TEST_CAPS_LATEST(name) \
904
    DO_TEST_CAPS_ARCH_LATEST(name, "x86_64")
905

906
# define DO_TEST_CAPS_LATEST_FAILURE(name) \
907 908
    DO_TEST_CAPS_ARCH_LATEST_FULL(name, "x86_64", \
                                  ARG_FLAGS, FLAG_EXPECT_FAILURE)
909 910

# define DO_TEST_CAPS_LATEST_PARSE_ERROR(name) \
911 912
    DO_TEST_CAPS_ARCH_LATEST_FULL(name, "x86_64", \
                                  ARG_FLAGS, FLAG_EXPECT_PARSE_ERROR)
913

914

915 916 917
# define DO_TEST_FULL(name, ...) \
    DO_TEST_INTERNAL(name, "", \
                     __VA_ARGS__, QEMU_CAPS_LAST)
918

919 920 921
/* All the following macros require an explicit QEMU_CAPS_* list
 * at the end of the argument list, or the NONE placeholder.
 * */
922
# define DO_TEST(name, ...) \
923
    DO_TEST_FULL(name, \
924
                 ARG_QEMU_CAPS, __VA_ARGS__)
925

926
# define DO_TEST_GIC(name, gic, ...) \
927
    DO_TEST_FULL(name, \
928
                 ARG_GIC, gic, \
929
                 ARG_QEMU_CAPS, __VA_ARGS__)
930

931
# define DO_TEST_FAILURE(name, ...) \
932 933
    DO_TEST_FULL(name, \
                 ARG_FLAGS, FLAG_EXPECT_FAILURE, \
934
                 ARG_QEMU_CAPS, __VA_ARGS__)
935

936
# define DO_TEST_PARSE_ERROR(name, ...) \
937
    DO_TEST_FULL(name, \
938
                 ARG_FLAGS, FLAG_EXPECT_PARSE_ERROR | FLAG_EXPECT_FAILURE, \
939
                 ARG_QEMU_CAPS, __VA_ARGS__)
940

941
# define NONE QEMU_CAPS_LAST
942

943 944 945
    /* Unset or set all envvars here that are copied in qemudBuildCommandLine
     * using ADD_ENV_COPY, otherwise these tests may fail due to unexpected
     * values for these envvars */
946 947 948 949 950 951 952
    setenv("PATH", "/bin", 1);
    setenv("USER", "test", 1);
    setenv("LOGNAME", "test", 1);
    setenv("HOME", "/home/test", 1);
    unsetenv("TMPDIR");
    unsetenv("LD_PRELOAD");
    unsetenv("LD_LIBRARY_PATH");
953 954
    unsetenv("QEMU_AUDIO_DRV");
    unsetenv("SDL_AUDIODRIVER");
955

956
    DO_TEST("minimal", NONE);
957 958
    DO_TEST("minimal-sandbox",
            QEMU_CAPS_SECCOMP_BLACKLIST);
959
    DO_TEST_PARSE_ERROR("minimal-no-memory", NONE);
960
    DO_TEST("minimal-msg-timestamp", QEMU_CAPS_MSG_TIMESTAMP);
961 962 963 964

    DO_TEST_CAPS_LATEST("genid");
    DO_TEST_CAPS_LATEST("genid-auto");

965
    DO_TEST("machine-aliases1", NONE);
966
    DO_TEST("machine-aliases2", QEMU_CAPS_KVM);
967
    DO_TEST("machine-core-on", NONE);
968
    driver.config->dumpGuestCore = true;
969
    DO_TEST("machine-core-off", NONE);
970
    driver.config->dumpGuestCore = false;
M
Michal Privoznik 已提交
971 972 973
    DO_TEST("machine-smm-opt",
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
974
            QEMU_CAPS_DEVICE_IOH3420,
M
Michal Privoznik 已提交
975 976 977
            QEMU_CAPS_ICH9_AHCI,
            QEMU_CAPS_MACHINE_SMM_OPT,
            QEMU_CAPS_VIRTIO_SCSI);
978
    DO_TEST("machine-vmport-opt",
979
            QEMU_CAPS_MACHINE_VMPORT_OPT);
980 981 982
    DO_TEST("default-kvm-host-arch", NONE);
    DO_TEST("default-qemu-host-arch", NONE);
    DO_TEST("x86-kvm-32-on-64", NONE);
983 984 985
    DO_TEST("boot-cdrom", NONE);
    DO_TEST("boot-network", NONE);
    DO_TEST("boot-floppy", NONE);
986
    DO_TEST("boot-floppy-q35",
987
            QEMU_CAPS_DEVICE_IOH3420,
988
            QEMU_CAPS_ICH9_AHCI);
J
Ján Tomko 已提交
989 990
    DO_TEST("boot-multi", NONE);
    DO_TEST("boot-menu-enable", NONE);
991
    DO_TEST("boot-menu-enable-with-timeout",
992
            QEMU_CAPS_SPLASH_TIMEOUT);
J
Ján Tomko 已提交
993
    DO_TEST_FAILURE("boot-menu-enable-with-timeout", NONE);
994
    DO_TEST_PARSE_ERROR("boot-menu-enable-with-timeout-invalid", NONE);
J
Ján Tomko 已提交
995 996
    DO_TEST("boot-menu-disable", NONE);
    DO_TEST("boot-menu-disable-drive", NONE);
997
    DO_TEST_PARSE_ERROR("boot-dev+order",
998
            QEMU_CAPS_VIRTIO_BLK_SCSI);
999
    DO_TEST("boot-order",
1000
            QEMU_CAPS_VIRTIO_BLK_SCSI);
1001
    DO_TEST("boot-complex",
1002
            QEMU_CAPS_VIRTIO_BLK_SCSI);
1003
    DO_TEST("boot-strict",
1004
            QEMU_CAPS_BOOT_STRICT,
1005
            QEMU_CAPS_VIRTIO_BLK_SCSI);
1006 1007 1008 1009 1010

    DO_TEST("reboot-timeout-disabled", QEMU_CAPS_REBOOT_TIMEOUT);
    DO_TEST("reboot-timeout-enabled", QEMU_CAPS_REBOOT_TIMEOUT);
    DO_TEST_FAILURE("reboot-timeout-enabled", NONE);

1011
    DO_TEST("bios",
1012
            QEMU_CAPS_DEVICE_ISA_SERIAL,
1013
            QEMU_CAPS_SGA);
J
Ján Tomko 已提交
1014
    DO_TEST("bios-nvram", NONE);
M
Michal Privoznik 已提交
1015 1016 1017
    DO_TEST("bios-nvram-secure",
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
1018
            QEMU_CAPS_DEVICE_IOH3420,
M
Michal Privoznik 已提交
1019 1020 1021
            QEMU_CAPS_ICH9_AHCI,
            QEMU_CAPS_MACHINE_SMM_OPT,
            QEMU_CAPS_VIRTIO_SCSI);
1022 1023 1024 1025 1026 1027 1028

    /* Make sure all combinations of ACPI and UEFI behave as expected */
    DO_TEST("q35-acpi-uefi", NONE);
    DO_TEST_PARSE_ERROR("q35-noacpi-uefi", NONE);
    DO_TEST("q35-noacpi-nouefi", NONE);
    DO_TEST("q35-acpi-nouefi", NONE);

1029
    DO_TEST("clock-utc", NONE);
1030
    DO_TEST("clock-localtime", NONE);
J
Ján Tomko 已提交
1031 1032 1033 1034
    DO_TEST("clock-localtime-basis-localtime", NONE);
    DO_TEST("clock-variable", NONE);
    DO_TEST("clock-france", NONE);
    DO_TEST("clock-hpet-off", NONE);
J
Ján Tomko 已提交
1035
    DO_TEST("clock-catchup", QEMU_CAPS_KVM_PIT_TICK_POLICY);
1036 1037
    DO_TEST("cpu-kvmclock", NONE);
    DO_TEST("cpu-host-kvmclock", NONE);
1038
    DO_TEST("kvmclock", QEMU_CAPS_KVM);
1039
    DO_TEST("clock-timer-hyperv-rtc", QEMU_CAPS_KVM);
1040

1041 1042
    DO_TEST("cpu-eoi-disabled", NONE);
    DO_TEST("cpu-eoi-enabled", NONE);
J
Ján Tomko 已提交
1043
    DO_TEST("controller-order",
1044 1045 1046 1047 1048 1049
            QEMU_CAPS_KVM,
            QEMU_CAPS_PIIX3_USB_UHCI,
            QEMU_CAPS_CCID_PASSTHRU,
            QEMU_CAPS_SPICE,
            QEMU_CAPS_HDA_DUPLEX,
            QEMU_CAPS_USB_HUB,
1050
            QEMU_CAPS_DEVICE_ISA_SERIAL,
1051
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
1052 1053
    DO_TEST("eoi-disabled", NONE);
    DO_TEST("eoi-enabled", NONE);
1054 1055
    DO_TEST("pv-spinlock-disabled", NONE);
    DO_TEST("pv-spinlock-enabled", NONE);
1056
    DO_TEST("kvmclock+eoi-disabled", NONE);
1057

1058
    DO_TEST("hyperv", NONE);
1059
    DO_TEST("hyperv-off", NONE);
1060
    DO_TEST("hyperv-panic", NONE);
1061

1062 1063 1064
    DO_TEST("kvm-features", NONE);
    DO_TEST("kvm-features-off", NONE);

1065 1066 1067
    DO_TEST("pmu-feature", NONE);
    DO_TEST("pmu-feature-off", NONE);

1068 1069 1070
    DO_TEST("pages-discard",
            QEMU_CAPS_OBJECT_MEMORY_FILE,
            QEMU_CAPS_OBJECT_MEMORY_FILE_DISCARD);
1071 1072 1073 1074
    DO_TEST("pages-discard-hugepages",
            QEMU_CAPS_OBJECT_MEMORY_RAM,
            QEMU_CAPS_OBJECT_MEMORY_FILE,
            QEMU_CAPS_OBJECT_MEMORY_FILE_DISCARD);
1075 1076 1077 1078
    DO_TEST("pages-dimm-discard",
            QEMU_CAPS_DEVICE_PC_DIMM,
            QEMU_CAPS_OBJECT_MEMORY_FILE,
            QEMU_CAPS_OBJECT_MEMORY_FILE_DISCARD);
1079
    DO_TEST("hugepages-default", NONE);
1080
    DO_TEST("hugepages-default-2M", NONE);
1081
    DO_TEST("hugepages-default-system-size", NONE);
1082
    DO_TEST_PARSE_ERROR("hugepages-default-1G-nodeset-2M", NONE);
1083
    DO_TEST("hugepages-nodeset", NONE);
1084 1085 1086 1087
    DO_TEST_PARSE_ERROR("hugepages-nodeset-nonexist",
                        QEMU_CAPS_DEVICE_PC_DIMM,
                        QEMU_CAPS_OBJECT_MEMORY_FILE,
                        QEMU_CAPS_OBJECT_MEMORY_FILE_DISCARD);
1088
    DO_TEST("hugepages-numa-default",
1089
            QEMU_CAPS_OBJECT_MEMORY_FILE);
1090 1091 1092
    DO_TEST("hugepages-numa-default-2M",
            QEMU_CAPS_OBJECT_MEMORY_RAM,
            QEMU_CAPS_OBJECT_MEMORY_FILE);
1093
    DO_TEST("hugepages-numa-default-dimm",
1094
            QEMU_CAPS_DEVICE_PC_DIMM,
J
Ján Tomko 已提交
1095
            QEMU_CAPS_OBJECT_MEMORY_FILE);
1096
    DO_TEST("hugepages-numa-nodeset",
A
Andrea Bolognani 已提交
1097
            QEMU_CAPS_OBJECT_MEMORY_RAM,
1098
            QEMU_CAPS_OBJECT_MEMORY_FILE);
1099 1100
    DO_TEST("hugepages-numa-nodeset-part",
            QEMU_CAPS_OBJECT_MEMORY_RAM,
1101
            QEMU_CAPS_OBJECT_MEMORY_FILE);
1102 1103 1104
    DO_TEST_PARSE_ERROR("hugepages-numa-nodeset-nonexist",
                        QEMU_CAPS_OBJECT_MEMORY_RAM,
                        QEMU_CAPS_OBJECT_MEMORY_FILE);
A
Andrea Bolognani 已提交
1105 1106 1107
    DO_TEST("hugepages-shared",
            QEMU_CAPS_OBJECT_MEMORY_RAM,
            QEMU_CAPS_OBJECT_MEMORY_FILE);
1108
    DO_TEST_PARSE_ERROR("hugepages-memaccess-invalid", NONE);
1109 1110 1111
    DO_TEST("hugepages-memaccess", QEMU_CAPS_OBJECT_MEMORY_FILE,
            QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_DEVICE_PC_DIMM,
            QEMU_CAPS_NUMA);
1112 1113 1114
    DO_TEST("hugepages-memaccess2", QEMU_CAPS_OBJECT_MEMORY_FILE,
            QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_DEVICE_PC_DIMM,
            QEMU_CAPS_NUMA);
1115 1116 1117
    DO_TEST_PARSE_ERROR("hugepages-memaccess3",
                        QEMU_CAPS_OBJECT_MEMORY_RAM,
                        QEMU_CAPS_OBJECT_MEMORY_FILE);
1118
    DO_TEST_CAPS_LATEST("hugepages-nvdimm");
1119
    DO_TEST("nosharepages", QEMU_CAPS_MEM_MERGE);
1120
    DO_TEST("disk-cdrom", NONE);
1121
    DO_TEST_CAPS_VER("disk-cdrom", "2.12.0");
1122
    DO_TEST_CAPS_LATEST("disk-cdrom");
1123
    DO_TEST_CAPS_LATEST("disk-cdrom-bus-other");
1124
    DO_TEST("disk-iscsi", NONE);
1125
    DO_TEST("disk-cdrom-network", QEMU_CAPS_KVM);
1126
    DO_TEST_CAPS_VER("disk-cdrom-network", "2.12.0");
1127
    DO_TEST_CAPS_LATEST("disk-cdrom-network");
1128
    DO_TEST("disk-cdrom-tray",
1129
            QEMU_CAPS_VIRTIO_TX_ALG);
1130
    DO_TEST_CAPS_VER("disk-cdrom-tray", "2.12.0");
1131
    DO_TEST_CAPS_LATEST("disk-cdrom-tray");
1132
    DO_TEST("disk-floppy", NONE);
1133
    DO_TEST_CAPS_VER("disk-floppy", "2.12.0");
1134
    DO_TEST_CAPS_LATEST("disk-floppy");
1135
    DO_TEST_CAPS_VER("disk-floppy-q35-2_9", "2.12.0");
1136
    DO_TEST_CAPS_LATEST("disk-floppy-q35-2_9");
1137
    DO_TEST_CAPS_VER("disk-floppy-q35-2_11", "2.12.0");
1138
    DO_TEST_CAPS_LATEST("disk-floppy-q35-2_11");
1139 1140
    DO_TEST_FAILURE("disk-floppy-pseries",
                    QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE);
1141
    DO_TEST("disk-floppy-tray", NONE);
1142
    DO_TEST("disk-virtio-s390",
1143
            QEMU_CAPS_VIRTIO_S390);
1144
    DO_TEST("disk-virtio", NONE);
1145
    DO_TEST("disk-virtio-ccw",
1146
            QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
1147
    DO_TEST("disk-virtio-ccw-many",
1148
            QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
1149 1150 1151 1152
    DO_TEST("disk-virtio-s390-zpci",
            QEMU_CAPS_DEVICE_ZPCI,
            QEMU_CAPS_CCW,
            QEMU_CAPS_VIRTIO_S390);
1153
    DO_TEST("disk-order", QEMU_CAPS_VIRTIO_BLK_SCSI);
1154
    DO_TEST("disk-virtio-queues",
L
Lin Ma 已提交
1155
            QEMU_CAPS_VIRTIO_BLK_NUM_QUEUES);
1156 1157 1158
    DO_TEST("disk-boot-disk", NONE);
    DO_TEST("disk-boot-cdrom", NONE);
    DO_TEST("floppy-drive-fat", NONE);
1159
    DO_TEST_CAPS_VER("floppy-drive-fat", "2.12.0");
1160
    DO_TEST_CAPS_LATEST("floppy-drive-fat");
1161
    DO_TEST("disk-readonly-disk", NONE);
1162
    DO_TEST_CAPS_VER("disk-readonly-disk", "2.12.0");
1163
    DO_TEST_CAPS_LATEST("disk-readonly-disk");
1164 1165 1166 1167
    DO_TEST("disk-fmt-qcow", NONE);
    DO_TEST_PARSE_ERROR("disk-fmt-cow", NONE);
    DO_TEST_PARSE_ERROR("disk-fmt-dir", NONE);
    DO_TEST_PARSE_ERROR("disk-fmt-iso", NONE);
1168
    DO_TEST_CAPS_VER("disk-shared", "2.12.0");
1169
    DO_TEST_CAPS_LATEST("disk-shared");
1170 1171
    DO_TEST_PARSE_ERROR("disk-shared-qcow", NONE);
    DO_TEST("disk-error-policy", NONE);
1172
    DO_TEST_CAPS_VER("disk-error-policy", "2.12.0");
1173
    DO_TEST_CAPS_LATEST("disk-error-policy");
1174
    DO_TEST_CAPS_VER("disk-cache", "1.5.3");
1175 1176
    DO_TEST_CAPS_VER("disk-cache", "2.6.0");
    DO_TEST_CAPS_VER("disk-cache", "2.7.0");
1177
    DO_TEST_CAPS_VER("disk-cache", "2.12.0");
1178
    DO_TEST_CAPS_LATEST("disk-cache");
1179
    DO_TEST("disk-network-nbd", NONE);
1180
    DO_TEST_CAPS_VER("disk-network-nbd", "2.12.0");
1181
    DO_TEST_CAPS_LATEST("disk-network-nbd");
1182
    DO_TEST("disk-network-iscsi", QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_BLOCK);
1183 1184 1185 1186
    DO_TEST("disk-network-iscsi-modern",
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_SCSI_BLOCK,
            QEMU_CAPS_ISCSI_PASSWORD_SECRET);
1187
    DO_TEST_CAPS_VER("disk-network-iscsi", "2.12.0");
1188
    DO_TEST_CAPS_LATEST("disk-network-iscsi");
1189 1190 1191 1192
    DO_TEST_PARSE_ERROR("disk-network-iscsi-auth-secrettype-invalid", NONE);
    DO_TEST_PARSE_ERROR("disk-network-iscsi-auth-wrong-secrettype", NONE);
    DO_TEST_PARSE_ERROR("disk-network-source-auth-both", NONE);
    DO_TEST("disk-network-gluster",
1193
            QEMU_CAPS_GLUSTER_DEBUG_LEVEL);
1194
    DO_TEST_CAPS_VER("disk-network-gluster", "2.12.0");
1195
    DO_TEST_CAPS_LATEST("disk-network-gluster");
1196
    DO_TEST_CAPS_VER("disk-network-rbd", "2.5.0");
1197
    DO_TEST_CAPS_VER("disk-network-rbd", "2.12.0");
1198 1199
    DO_TEST_CAPS_LATEST("disk-network-rbd");
    DO_TEST_FAILURE("disk-network-rbd-no-colon", NONE);
1200
    DO_TEST("disk-network-sheepdog", NONE);
1201
    DO_TEST_CAPS_VER("disk-network-sheepdog", "2.12.0");
1202
    DO_TEST_CAPS_LATEST("disk-network-sheepdog");
1203
    DO_TEST("disk-network-source-auth", NONE);
1204
    DO_TEST_CAPS_VER("disk-network-source-auth", "2.12.0");
1205
    DO_TEST_CAPS_LATEST("disk-network-source-auth");
1206
    DO_TEST("disk-network-vxhs", QEMU_CAPS_VXHS);
1207
    driver.config->vxhsTLS = 1;
1208
    DO_TEST("disk-network-tlsx509", QEMU_CAPS_VXHS,
1209
            QEMU_CAPS_OBJECT_TLS_CREDS_X509, QEMU_CAPS_NBD_TLS);
1210
    DO_TEST_CAPS_VER("disk-network-tlsx509", "2.12.0");
1211
    DO_TEST_CAPS_LATEST("disk-network-tlsx509");
1212 1213
    driver.config->vxhsTLS = 0;
    VIR_FREE(driver.config->vxhsTLSx509certdir);
1214
    DO_TEST("disk-no-boot", NONE);
1215
    DO_TEST_PARSE_ERROR("disk-device-lun-type-invalid",
1216 1217
                        QEMU_CAPS_VIRTIO_SCSI);
    DO_TEST_FAILURE("disk-usb-nosupport", NONE);
1218
    DO_TEST("disk-usb-device",
1219
            QEMU_CAPS_DEVICE_USB_STORAGE);
1220
    DO_TEST("disk-usb-device-removable",
1221
            QEMU_CAPS_DEVICE_USB_STORAGE,
1222
            QEMU_CAPS_USB_STORAGE_REMOVABLE);
1223
    DO_TEST_FAILURE("disk-usb-pci",
1224
                    QEMU_CAPS_DEVICE_USB_STORAGE);
1225
    DO_TEST_CAPS_LATEST("disk-scsi");
1226 1227
    DO_TEST_CAPS_VER("disk-scsi-device-auto", "1.5.3");
    DO_TEST_CAPS_LATEST("disk-scsi-device-auto");
1228
    DO_TEST("disk-scsi-disk-split",
1229
            QEMU_CAPS_SCSI_LSI, QEMU_CAPS_VIRTIO_SCSI);
1230
    DO_TEST("disk-scsi-disk-wwn",
1231
            QEMU_CAPS_SCSI_LSI, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_DISK_WWN);
1232
    DO_TEST("disk-scsi-disk-vpd",
1233
            QEMU_CAPS_SCSI_LSI, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_DISK_WWN);
1234
    DO_TEST_FAILURE("disk-scsi-disk-vpd-build-error",
1235
            QEMU_CAPS_SCSI_LSI, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_DISK_WWN);
1236
    DO_TEST_CAPS_LATEST("controller-virtio-scsi");
1237
    DO_TEST("disk-sata-device",
1238
            QEMU_CAPS_ICH9_AHCI);
J
Ján Tomko 已提交
1239
    DO_TEST("disk-aio", NONE);
1240
    DO_TEST_CAPS_VER("disk-aio", "2.12.0");
1241
    DO_TEST_CAPS_LATEST("disk-aio");
1242 1243
    DO_TEST("disk-source-pool", NONE);
    DO_TEST("disk-source-pool-mode", NONE);
1244
    DO_TEST("disk-ioeventfd",
1245
            QEMU_CAPS_VIRTIO_IOEVENTFD,
1246
            QEMU_CAPS_VIRTIO_TX_ALG,
1247
            QEMU_CAPS_VIRTIO_BLK_SCSI);
1248
    DO_TEST("disk-copy_on_read",
1249
            QEMU_CAPS_VIRTIO_TX_ALG,
1250
            QEMU_CAPS_VIRTIO_BLK_SCSI);
1251
    DO_TEST_CAPS_VER("disk-copy_on_read", "2.12.0");
1252
    DO_TEST_CAPS_LATEST("disk-copy_on_read");
1253
    DO_TEST("disk-discard",
1254
            QEMU_CAPS_DRIVE_DISCARD);
1255
    DO_TEST("disk-detect-zeroes",
1256 1257
            QEMU_CAPS_DRIVE_DISCARD,
            QEMU_CAPS_DRIVE_DETECT_ZEROES);
1258
    DO_TEST_CAPS_VER("disk-detect-zeroes", "2.12.0");
1259
    DO_TEST_CAPS_LATEST("disk-detect-zeroes");
1260
    DO_TEST("disk-snapshot", NONE);
1261 1262
    DO_TEST_PARSE_ERROR("disk-same-targets",
                        QEMU_CAPS_SCSI_LSI,
1263
                        QEMU_CAPS_DEVICE_USB_STORAGE);
1264
    DO_TEST_PARSE_ERROR("disk-address-conflict",
1265 1266
                        QEMU_CAPS_ICH9_AHCI);
    DO_TEST_PARSE_ERROR("disk-hostdev-scsi-address-conflict",
1267
                        QEMU_CAPS_VIRTIO_SCSI);
1268
    DO_TEST_PARSE_ERROR("hostdevs-drive-address-conflict",
1269
                        QEMU_CAPS_VIRTIO_SCSI);
1270
    DO_TEST("event_idx",
1271 1272
            QEMU_CAPS_VIRTIO_BLK_EVENT_IDX,
            QEMU_CAPS_VIRTIO_NET_EVENT_IDX,
1273
            QEMU_CAPS_VIRTIO_BLK_SCSI);
1274
    DO_TEST("virtio-lun",
1275
            QEMU_CAPS_VIRTIO_BLK_SCSI);
1276
    DO_TEST("disk-scsi-lun-passthrough",
1277
            QEMU_CAPS_SCSI_BLOCK,
1278
            QEMU_CAPS_SCSI_LSI, QEMU_CAPS_VIRTIO_SCSI);
1279
    DO_TEST("disk-serial",
1280
            QEMU_CAPS_KVM);
1281 1282 1283 1284 1285 1286 1287 1288
    DO_TEST_PARSE_ERROR("disk-fdc-incompatible-address",
                        NONE);
    DO_TEST_PARSE_ERROR("disk-ide-incompatible-address",
                        NONE);
    DO_TEST_PARSE_ERROR("disk-sata-incompatible-address",
                        QEMU_CAPS_ICH9_AHCI);
    DO_TEST_PARSE_ERROR("disk-scsi-incompatible-address",
                        QEMU_CAPS_VIRTIO_SCSI);
1289 1290 1291 1292
    DO_TEST_CAPS_VER("disk-backing-chains-index", "2.12.0");
    DO_TEST_CAPS_LATEST("disk-backing-chains-index");
    DO_TEST_CAPS_VER("disk-backing-chains-noindex", "2.12.0");
    DO_TEST_CAPS_LATEST("disk-backing-chains-noindex");
1293

1294 1295 1296
    DO_TEST("graphics-egl-headless",
            QEMU_CAPS_EGL_HEADLESS,
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
1297 1298
    DO_TEST_CAPS_LATEST("graphics-egl-headless");
    DO_TEST_CAPS_LATEST("graphics-egl-headless-rendernode");
1299

1300 1301
    DO_TEST("graphics-vnc", QEMU_CAPS_VNC, QEMU_CAPS_DEVICE_CIRRUS_VGA);
    DO_TEST("graphics-vnc-socket", QEMU_CAPS_VNC, QEMU_CAPS_DEVICE_CIRRUS_VGA);
1302 1303
    DO_TEST("graphics-vnc-websocket",
            QEMU_CAPS_VNC,
1304
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
1305
    DO_TEST("graphics-vnc-policy", QEMU_CAPS_VNC,
1306 1307 1308 1309 1310
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
    DO_TEST("graphics-vnc-no-listen-attr", QEMU_CAPS_VNC,
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
    DO_TEST("graphics-vnc-remove-generated-socket", QEMU_CAPS_VNC,
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
1311
    driver.config->vncAutoUnixSocket = true;
1312 1313
    DO_TEST("graphics-vnc-auto-socket-cfg", QEMU_CAPS_VNC,
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
1314
    driver.config->vncAutoUnixSocket = false;
1315 1316 1317 1318
    DO_TEST("graphics-vnc-socket", QEMU_CAPS_VNC, QEMU_CAPS_DEVICE_CIRRUS_VGA);
    DO_TEST("graphics-vnc-auto-socket", QEMU_CAPS_VNC,
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
    DO_TEST("graphics-vnc-none", QEMU_CAPS_VNC, QEMU_CAPS_DEVICE_CIRRUS_VGA);
1319 1320
    DO_TEST("graphics-vnc-socket-new-cmdline", QEMU_CAPS_VNC,
            QEMU_CAPS_DEVICE_CIRRUS_VGA, QEMU_CAPS_VNC_MULTI_SERVERS);
1321

1322 1323
    driver.config->vncSASL = 1;
    VIR_FREE(driver.config->vncSASLdir);
1324
    ignore_value(VIR_STRDUP(driver.config->vncSASLdir, "/root/.sasl2"));
1325
    DO_TEST("graphics-vnc-sasl", QEMU_CAPS_VNC, QEMU_CAPS_DEVICE_CIRRUS_VGA);
1326 1327
    driver.config->vncTLS = 1;
    driver.config->vncTLSx509verify = 1;
1328
    DO_TEST("graphics-vnc-tls", QEMU_CAPS_VNC, QEMU_CAPS_DEVICE_CIRRUS_VGA);
1329 1330
    DO_TEST_CAPS_VER("graphics-vnc-tls", "2.4.0");
    DO_TEST_CAPS_LATEST("graphics-vnc-tls");
1331 1332 1333 1334 1335
    if (VIR_STRDUP_QUIET(driver.config->vncTLSx509secretUUID,
                         "6fd3f62d-9fe7-4a4e-a869-7acd6376d8ea") < 0)
        return EXIT_FAILURE;
    DO_TEST_CAPS_LATEST("graphics-vnc-tls-secret");
    VIR_FREE(driver.config->vncTLSx509secretUUID);
1336
    driver.config->vncSASL = driver.config->vncTLSx509verify = driver.config->vncTLS = 0;
1337 1338
    VIR_FREE(driver.config->vncSASLdir);
    VIR_FREE(driver.config->vncTLSx509certdir);
1339 1340 1341 1342
    DO_TEST("graphics-vnc-egl-headless",
            QEMU_CAPS_VNC,
            QEMU_CAPS_EGL_HEADLESS,
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
1343

J
Ján Tomko 已提交
1344 1345
    DO_TEST("graphics-sdl",
            QEMU_CAPS_DEVICE_VGA);
1346
    DO_TEST_CAPS_LATEST_PARSE_ERROR("graphics-sdl-egl-headless");
J
Ján Tomko 已提交
1347
    DO_TEST("graphics-sdl-fullscreen",
1348
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
1349
    DO_TEST("graphics-spice",
1350
            QEMU_CAPS_SPICE,
1351 1352
            QEMU_CAPS_DEVICE_QXL,
            QEMU_CAPS_SPICE_FILE_XFER_DISABLE);
1353
    DO_TEST("graphics-spice-no-args",
1354
            QEMU_CAPS_SPICE, QEMU_CAPS_DEVICE_CIRRUS_VGA);
1355 1356 1357
    driver.config->spiceSASL = 1;
    ignore_value(VIR_STRDUP(driver.config->spiceSASLdir, "/root/.sasl2"));
    DO_TEST("graphics-spice-sasl",
1358
            QEMU_CAPS_SPICE,
1359 1360 1361
            QEMU_CAPS_DEVICE_QXL);
    VIR_FREE(driver.config->spiceSASLdir);
    driver.config->spiceSASL = 0;
1362
    DO_TEST("graphics-spice-agentmouse",
1363
            QEMU_CAPS_DEVICE_QXL,
1364
            QEMU_CAPS_SPICE,
1365
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
1366
    DO_TEST("graphics-spice-compression",
1367
            QEMU_CAPS_SPICE,
1368
            QEMU_CAPS_DEVICE_QXL);
1369
    DO_TEST("graphics-spice-timeout",
1370
            QEMU_CAPS_KVM,
1371
            QEMU_CAPS_SPICE,
1372 1373
            QEMU_CAPS_DEVICE_QXL,
            QEMU_CAPS_DEVICE_VGA);
1374
    DO_TEST("graphics-spice-qxl-vga",
1375
            QEMU_CAPS_SPICE,
1376
            QEMU_CAPS_DEVICE_QXL);
1377
    DO_TEST("graphics-spice-usb-redir",
1378
            QEMU_CAPS_SPICE,
1379 1380 1381 1382
            QEMU_CAPS_USB_HUB,
            QEMU_CAPS_ICH9_USB_EHCI1,
            QEMU_CAPS_USB_REDIR,
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
1383
    DO_TEST("graphics-spice-agent-file-xfer",
1384
            QEMU_CAPS_SPICE,
1385 1386
            QEMU_CAPS_DEVICE_QXL,
            QEMU_CAPS_SPICE_FILE_XFER_DISABLE);
1387 1388
    DO_TEST("graphics-spice-socket",
            QEMU_CAPS_SPICE,
1389 1390
            QEMU_CAPS_SPICE_UNIX,
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
1391 1392
    DO_TEST("graphics-spice-auto-socket",
            QEMU_CAPS_SPICE,
1393 1394
            QEMU_CAPS_SPICE_UNIX,
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
1395 1396 1397
    driver.config->spiceAutoUnixSocket = true;
    DO_TEST("graphics-spice-auto-socket-cfg",
            QEMU_CAPS_SPICE,
1398 1399
            QEMU_CAPS_SPICE_UNIX,
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
1400
    driver.config->spiceAutoUnixSocket = false;
1401 1402 1403 1404
    DO_TEST("graphics-spice-egl-headless",
            QEMU_CAPS_SPICE,
            QEMU_CAPS_EGL_HEADLESS,
            QEMU_CAPS_DEVICE_QXL);
1405
    DO_TEST_CAPS_LATEST_PARSE_ERROR("graphics-spice-invalid-egl-headless");
1406
    DO_TEST_CAPS_LATEST("graphics-spice-gl-auto-rendernode");
1407

1408 1409 1410
    DO_TEST("input-usbmouse", NONE);
    DO_TEST("input-usbtablet", NONE);
    DO_TEST("misc-acpi", NONE);
1411 1412 1413
    DO_TEST("misc-disable-s3", QEMU_CAPS_PIIX_DISABLE_S3);
    DO_TEST("misc-disable-suspends", QEMU_CAPS_PIIX_DISABLE_S3, QEMU_CAPS_PIIX_DISABLE_S4);
    DO_TEST("misc-enable-s4", QEMU_CAPS_PIIX_DISABLE_S4);
1414
    DO_TEST_FAILURE("misc-enable-s4", NONE);
1415
    DO_TEST("misc-no-reboot", NONE);
1416
    DO_TEST("misc-uuid", NONE);
1417
    DO_TEST_PARSE_ERROR("vhost_queues-invalid", NONE);
1418
    DO_TEST("net-vhostuser", QEMU_CAPS_CHARDEV_FD_PASS);
1419 1420
    DO_TEST_CAPS_VER("net-vhostuser", "2.5.0");
    DO_TEST_CAPS_LATEST("net-vhostuser");
1421
    DO_TEST("net-vhostuser-multiq",
J
Ján Tomko 已提交
1422 1423
            QEMU_CAPS_VHOSTUSER_MULTIQUEUE);
    DO_TEST_FAILURE("net-vhostuser-multiq", NONE);
1424 1425
    DO_TEST_FAILURE("net-vhostuser-fail",
                    QEMU_CAPS_VHOSTUSER_MULTIQUEUE);
1426
    DO_TEST("net-user", NONE);
J
Ján Tomko 已提交
1427
    DO_TEST("net-user-addr", NONE);
1428 1429
    DO_TEST("net-virtio", NONE);
    DO_TEST("net-virtio-device",
1430 1431 1432
            QEMU_CAPS_VIRTIO_TX_ALG);
    DO_TEST("net-virtio-disable-offloads", NONE);
    DO_TEST("net-virtio-netdev", NONE);
1433
    DO_TEST("net-virtio-s390",
1434
            QEMU_CAPS_VIRTIO_S390);
1435
    DO_TEST("net-virtio-ccw",
1436
            QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
1437 1438 1439
    DO_TEST("net-virtio-rxtxqueuesize",
            QEMU_CAPS_VIRTIO_NET_RX_QUEUE_SIZE,
            QEMU_CAPS_VIRTIO_NET_TX_QUEUE_SIZE);
1440
    DO_TEST_PARSE_ERROR("net-virtio-rxqueuesize-invalid-size", NONE);
1441 1442
    DO_TEST("net-eth", NONE);
    DO_TEST("net-eth-ifname", NONE);
1443
    DO_TEST("net-eth-names", NONE);
1444
    DO_TEST("net-eth-hostip", NONE);
1445 1446 1447
    DO_TEST("net-client", NONE);
    DO_TEST("net-server", NONE);
    DO_TEST("net-mcast", NONE);
1448
    DO_TEST("net-udp", NONE);
1449
    DO_TEST("net-hostdev", NONE);
1450
    DO_TEST("net-hostdev-bootorder", NONE);
1451
    DO_TEST("net-hostdev-multidomain", NONE);
1452 1453
    DO_TEST("net-hostdev-vfio",
            QEMU_CAPS_DEVICE_VFIO_PCI);
1454
    DO_TEST("net-hostdev-vfio-multidomain",
1455
            QEMU_CAPS_DEVICE_VFIO_PCI);
1456 1457 1458
    DO_TEST_FAILURE("net-hostdev-fail",
                    QEMU_CAPS_DEVICE_VFIO_PCI);

1459

1460 1461
    DO_TEST("serial-file-log",
            QEMU_CAPS_CHARDEV_FILE_APPEND,
1462
            QEMU_CAPS_DEVICE_ISA_SERIAL,
1463
            QEMU_CAPS_CHARDEV_LOGFILE);
1464
    DO_TEST("serial-spiceport",
1465
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
1466
            QEMU_CAPS_DEVICE_QXL,
1467
            QEMU_CAPS_SPICE,
1468
            QEMU_CAPS_DEVICE_ISA_SERIAL);
1469
    DO_TEST("serial-spiceport-nospice", NONE);
1470

1471 1472 1473 1474
    DO_TEST("console-compat",
            QEMU_CAPS_DEVICE_ISA_SERIAL);
    DO_TEST("console-compat-auto",
            QEMU_CAPS_DEVICE_ISA_SERIAL);
1475 1476

    DO_TEST("serial-vc-chardev",
1477
            QEMU_CAPS_DEVICE_ISA_SERIAL);
1478
    DO_TEST("serial-pty-chardev",
1479
            QEMU_CAPS_DEVICE_ISA_SERIAL);
1480
    DO_TEST("serial-dev-chardev",
1481
            QEMU_CAPS_DEVICE_ISA_SERIAL);
1482
    DO_TEST("serial-dev-chardev-iobase",
1483
            QEMU_CAPS_DEVICE_ISA_SERIAL);
1484
    DO_TEST("serial-file-chardev",
1485
            QEMU_CAPS_DEVICE_ISA_SERIAL,
1486
            QEMU_CAPS_CHARDEV_FILE_APPEND);
1487
    DO_TEST("serial-unix-chardev",
1488
            QEMU_CAPS_DEVICE_ISA_SERIAL);
1489
    DO_TEST_CAPS_LATEST("serial-unix-chardev");
1490
    DO_TEST_PARSE_ERROR("serial-unix-missing-source", NONE);
1491
    DO_TEST("serial-tcp-chardev",
1492
            QEMU_CAPS_DEVICE_ISA_SERIAL);
1493
    DO_TEST("serial-udp-chardev",
1494
            QEMU_CAPS_DEVICE_ISA_SERIAL);
1495
    DO_TEST("serial-tcp-telnet-chardev",
1496
            QEMU_CAPS_DEVICE_ISA_SERIAL);
1497 1498
    driver.config->chardevTLS = 1;
    DO_TEST("serial-tcp-tlsx509-chardev",
1499
            QEMU_CAPS_DEVICE_ISA_SERIAL,
1500
            QEMU_CAPS_OBJECT_TLS_CREDS_X509);
1501 1502
    driver.config->chardevTLSx509verify = 1;
    DO_TEST("serial-tcp-tlsx509-chardev-verify",
1503
            QEMU_CAPS_DEVICE_ISA_SERIAL,
1504 1505
            QEMU_CAPS_OBJECT_TLS_CREDS_X509);
    driver.config->chardevTLSx509verify = 0;
1506
    DO_TEST("serial-tcp-tlsx509-chardev-notls",
1507
            QEMU_CAPS_DEVICE_ISA_SERIAL,
1508
            QEMU_CAPS_OBJECT_TLS_CREDS_X509);
1509 1510 1511 1512 1513 1514 1515 1516
    VIR_FREE(driver.config->chardevTLSx509certdir);
    if (VIR_STRDUP_QUIET(driver.config->chardevTLSx509certdir, "/etc/pki/libvirt-chardev") < 0)
        return EXIT_FAILURE;
    if (VIR_STRDUP_QUIET(driver.config->chardevTLSx509secretUUID,
                         "6fd3f62d-9fe7-4a4e-a869-7acd6376d8ea") < 0)
        return EXIT_FAILURE;
    DO_TEST("serial-tcp-tlsx509-secret-chardev",
            QEMU_CAPS_OBJECT_SECRET,
1517
            QEMU_CAPS_DEVICE_ISA_SERIAL,
1518
            QEMU_CAPS_OBJECT_TLS_CREDS_X509);
1519 1520
    driver.config->chardevTLS = 0;
    VIR_FREE(driver.config->chardevTLSx509certdir);
1521
    DO_TEST("serial-many-chardev",
1522 1523 1524
            QEMU_CAPS_DEVICE_ISA_SERIAL);
    DO_TEST("parallel-tcp-chardev", NONE);
    DO_TEST("parallel-parport-chardev", NONE);
J
Ján Tomko 已提交
1525 1526
    DO_TEST_CAPS_VER("parallel-unix-chardev", "2.5.0");
    DO_TEST_CAPS_LATEST("parallel-unix-chardev");
1527
    DO_TEST("console-compat-chardev",
1528
            QEMU_CAPS_DEVICE_ISA_SERIAL);
M
Michal Privoznik 已提交
1529 1530
    DO_TEST("pci-serial-dev-chardev",
            QEMU_CAPS_DEVICE_PCI_SERIAL);
1531

1532
    DO_TEST("channel-guestfwd", NONE);
J
Ján Tomko 已提交
1533 1534
    DO_TEST_CAPS_VER("channel-unix-guestfwd", "2.5.0");
    DO_TEST_CAPS_LATEST("channel-unix-guestfwd");
1535 1536 1537 1538 1539 1540
    DO_TEST("channel-virtio", NONE);
    DO_TEST("channel-virtio-state", NONE);
    DO_TEST("channel-virtio-auto", NONE);
    DO_TEST("channel-virtio-autoassign", NONE);
    DO_TEST("channel-virtio-autoadd", NONE);
    DO_TEST("console-virtio", NONE);
1541
    DO_TEST("console-virtio-many",
1542
            QEMU_CAPS_DEVICE_ISA_SERIAL);
1543
    DO_TEST("console-virtio-s390",
1544
            QEMU_CAPS_VIRTIO_S390);
1545
    DO_TEST("console-virtio-ccw",
1546
            QEMU_CAPS_CCW,
1547
            QEMU_CAPS_VIRTIO_S390);
J
Ján Tomko 已提交
1548 1549
    DO_TEST_CAPS_VER("console-virtio-unix", "2.5.0");
    DO_TEST_CAPS_LATEST("console-virtio-unix");
1550
    DO_TEST("console-sclp",
1551
            QEMU_CAPS_VIRTIO_S390,
1552
            QEMU_CAPS_DEVICE_SCLPCONSOLE);
1553
    DO_TEST("channel-spicevmc",
1554
            QEMU_CAPS_SPICE,
1555
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
1556
    DO_TEST("channel-virtio-default",
1557
            QEMU_CAPS_SPICE);
1558
    DO_TEST("channel-virtio-unix", NONE);
1559

1560
    DO_TEST("smartcard-host",
1561
            QEMU_CAPS_CCID_EMULATED);
1562
    DO_TEST("smartcard-host-certificates",
1563
            QEMU_CAPS_CCID_EMULATED);
1564 1565
    DO_TEST("smartcard-host-certificates-database",
            QEMU_CAPS_CCID_EMULATED);
1566
    DO_TEST("smartcard-passthrough-tcp",
1567
            QEMU_CAPS_CCID_PASSTHRU);
1568
    DO_TEST("smartcard-passthrough-spicevmc",
1569
            QEMU_CAPS_CCID_PASSTHRU);
1570
    DO_TEST("smartcard-controller",
1571
            QEMU_CAPS_CCID_EMULATED);
J
Ján Tomko 已提交
1572 1573
    DO_TEST_CAPS_VER("smartcard-passthrough-unix", "2.5.0");
    DO_TEST_CAPS_LATEST("smartcard-passthrough-unix");
1574

1575 1576 1577 1578 1579 1580 1581 1582
    DO_TEST("chardev-reconnect",
            QEMU_CAPS_CHARDEV_RECONNECT,
            QEMU_CAPS_USB_REDIR,
            QEMU_CAPS_DEVICE_VIRTIO_RNG,
            QEMU_CAPS_OBJECT_RNG_EGD,
            QEMU_CAPS_CCID_PASSTHRU);
    DO_TEST_PARSE_ERROR("chardev-reconnect-invalid-timeout",
                        QEMU_CAPS_CHARDEV_RECONNECT);
1583 1584
    DO_TEST_PARSE_ERROR("chardev-reconnect-generated-path",
                        QEMU_CAPS_CHARDEV_RECONNECT);
1585

1586
    DO_TEST("usb-controller", NONE);
1587
    DO_TEST("usb-piix3-controller",
1588
            QEMU_CAPS_PIIX3_USB_UHCI);
1589
    DO_TEST("usb-ich9-ehci-addr",
1590
            QEMU_CAPS_ICH9_USB_EHCI1);
1591
    DO_TEST("input-usbmouse-addr", NONE);
1592
    DO_TEST("usb-ich9-companion",
1593
            QEMU_CAPS_ICH9_USB_EHCI1);
1594
    DO_TEST_PARSE_ERROR("usb-ich9-no-companion",
1595
            QEMU_CAPS_ICH9_USB_EHCI1);
1596
    DO_TEST("usb-ich9-autoassign",
1597
            QEMU_CAPS_ICH9_USB_EHCI1,
1598
            QEMU_CAPS_USB_HUB);
1599
    DO_TEST("usb-hub",
1600
            QEMU_CAPS_USB_HUB);
1601
    DO_TEST("usb-hub-autoadd",
1602
            QEMU_CAPS_USB_HUB);
1603
    DO_TEST("usb-hub-autoadd-deluxe",
1604
            QEMU_CAPS_USB_HUB);
J
Ján Tomko 已提交
1605
    DO_TEST_PARSE_ERROR("usb-hub-conflict",
1606
            QEMU_CAPS_USB_HUB);
1607
    DO_TEST_PARSE_ERROR("usb-hub-nonexistent",
1608
            QEMU_CAPS_USB_HUB);
J
Ján Tomko 已提交
1609
    DO_TEST("usb-port-missing",
1610
            QEMU_CAPS_USB_HUB);
1611
    DO_TEST_FAILURE("usb-bus-missing",
1612
                    QEMU_CAPS_USB_HUB);
1613
    DO_TEST("usb-ports",
1614
            QEMU_CAPS_USB_HUB);
1615
    DO_TEST_PARSE_ERROR("usb-ports-out-of-range",
1616
            QEMU_CAPS_USB_HUB);
1617
    DO_TEST("usb-port-autoassign",
1618
            QEMU_CAPS_USB_HUB);
1619
    DO_TEST("usb-redir",
1620 1621 1622
            QEMU_CAPS_USB_HUB,
            QEMU_CAPS_ICH9_USB_EHCI1,
            QEMU_CAPS_USB_REDIR,
1623
            QEMU_CAPS_SPICE);
1624
    DO_TEST("usb-redir-boot",
1625 1626 1627
            QEMU_CAPS_USB_HUB,
            QEMU_CAPS_ICH9_USB_EHCI1,
            QEMU_CAPS_USB_REDIR,
1628
            QEMU_CAPS_SPICE);
1629
    DO_TEST("usb-redir-filter",
1630 1631 1632 1633
            QEMU_CAPS_USB_HUB,
            QEMU_CAPS_ICH9_USB_EHCI1,
            QEMU_CAPS_USB_REDIR,
            QEMU_CAPS_SPICE,
1634
            QEMU_CAPS_USB_REDIR_FILTER);
1635 1636
    DO_TEST("usb-redir-filter-version",
            QEMU_CAPS_USB_REDIR,
1637
            QEMU_CAPS_SPICE,
1638
            QEMU_CAPS_USB_REDIR_FILTER);
J
Ján Tomko 已提交
1639 1640
    DO_TEST_CAPS_VER("usb-redir-unix", "2.5.0");
    DO_TEST_CAPS_LATEST("usb-redir-unix");
1641
    DO_TEST("usb1-usb2",
1642 1643 1644
            QEMU_CAPS_PIIX3_USB_UHCI,
            QEMU_CAPS_USB_HUB,
            QEMU_CAPS_ICH9_USB_EHCI1);
1645 1646
    DO_TEST("usb-none", NONE);
    DO_TEST_PARSE_ERROR("usb-none-other", NONE);
1647 1648
    DO_TEST_PARSE_ERROR("usb-none-hub",
            QEMU_CAPS_USB_HUB);
1649
    DO_TEST_PARSE_ERROR("usb-none-usbtablet", NONE);
1650
    DO_TEST("usb-controller-default-q35",
1651
            QEMU_CAPS_DEVICE_IOH3420,
1652 1653 1654
            QEMU_CAPS_PCI_OHCI,
            QEMU_CAPS_PIIX3_USB_UHCI,
            QEMU_CAPS_NEC_USB_XHCI);
1655
    DO_TEST_FAILURE("usb-controller-default-unavailable-q35",
1656
                    QEMU_CAPS_DEVICE_IOH3420,
1657
                    QEMU_CAPS_PCI_OHCI,
1658 1659
                    QEMU_CAPS_NEC_USB_XHCI);
    DO_TEST("usb-controller-explicit-q35",
1660
            QEMU_CAPS_DEVICE_IOH3420,
1661 1662 1663
            QEMU_CAPS_PCI_OHCI,
            QEMU_CAPS_PIIX3_USB_UHCI,
            QEMU_CAPS_NEC_USB_XHCI);
1664
    DO_TEST_FAILURE("usb-controller-explicit-unavailable-q35",
1665
                    QEMU_CAPS_DEVICE_IOH3420,
1666
                    QEMU_CAPS_PCI_OHCI,
1667
                    QEMU_CAPS_PIIX3_USB_UHCI);
1668
    DO_TEST("usb-controller-xhci",
1669 1670 1671
            QEMU_CAPS_PIIX3_USB_UHCI,
            QEMU_CAPS_NEC_USB_XHCI,
            QEMU_CAPS_NEC_USB_XHCI_PORTS);
1672
    DO_TEST("usb-xhci-autoassign",
1673 1674 1675
            QEMU_CAPS_PIIX3_USB_UHCI,
            QEMU_CAPS_NEC_USB_XHCI,
            QEMU_CAPS_NEC_USB_XHCI_PORTS,
1676
            QEMU_CAPS_USB_HUB);
1677
    DO_TEST_PARSE_ERROR("usb-controller-xhci-limit",
1678 1679 1680
            QEMU_CAPS_PIIX3_USB_UHCI,
            QEMU_CAPS_NEC_USB_XHCI,
            QEMU_CAPS_NEC_USB_XHCI_PORTS);
1681 1682 1683 1684
    DO_TEST("usb-controller-qemu-xhci", QEMU_CAPS_DEVICE_QEMU_XHCI);
    DO_TEST_FAILURE("usb-controller-qemu-xhci-unavailable", NONE);
    DO_TEST_PARSE_ERROR("usb-controller-qemu-xhci-limit",
                        QEMU_CAPS_DEVICE_QEMU_XHCI);
1685

1686 1687 1688
    DO_TEST("smbios", NONE);
    DO_TEST_PARSE_ERROR("smbios-date", NONE);
    DO_TEST_PARSE_ERROR("smbios-uuid-match", NONE);
1689

1690
    DO_TEST("watchdog", NONE);
1691
    DO_TEST("watchdog-device", NONE);
1692
    DO_TEST("watchdog-dump", NONE);
1693
    DO_TEST("watchdog-injectnmi", NONE);
1694
    DO_TEST("watchdog-diag288", QEMU_CAPS_VIRTIO_S390);
1695 1696
    DO_TEST("balloon-device", NONE);
    DO_TEST("balloon-device-deflate",
1697
            QEMU_CAPS_VIRTIO_BALLOON_AUTODEFLATE);
1698
    DO_TEST("balloon-ccw-deflate",
1699
            QEMU_CAPS_VIRTIO_BALLOON_AUTODEFLATE);
1700
    DO_TEST("balloon-mmio-deflate",
J
Ján Tomko 已提交
1701
            QEMU_CAPS_DEVICE_VIRTIO_MMIO,
1702
            QEMU_CAPS_VIRTIO_BALLOON_AUTODEFLATE);
1703
    DO_TEST("balloon-device-deflate-off",
1704
            QEMU_CAPS_VIRTIO_BALLOON_AUTODEFLATE);
1705 1706
    DO_TEST("balloon-device-auto", NONE);
    DO_TEST("balloon-device-period", NONE);
1707 1708
    DO_TEST("sound", NONE);
    DO_TEST("sound-device",
1709
            QEMU_CAPS_HDA_DUPLEX, QEMU_CAPS_HDA_MICRO,
1710
            QEMU_CAPS_HDA_OUTPUT,
1711 1712
            QEMU_CAPS_DEVICE_ICH9_INTEL_HDA,
            QEMU_CAPS_OBJECT_USB_AUDIO);
1713
    DO_TEST("fs9p", NONE);
1714
    DO_TEST("fs9p-ccw",
1715
            QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
1716

1717
    DO_TEST("hostdev-usb-address", NONE);
1718
    DO_TEST("hostdev-usb-address-device", NONE);
1719
    DO_TEST("hostdev-usb-address-device-boot", NONE);
J
Ján Tomko 已提交
1720
    DO_TEST("hostdev-pci-address", NONE);
1721
    DO_TEST("hostdev-pci-address-device", NONE);
1722 1723
    DO_TEST("hostdev-vfio",
            QEMU_CAPS_DEVICE_VFIO_PCI);
1724
    DO_TEST("hostdev-vfio-multidomain",
1725
            QEMU_CAPS_DEVICE_VFIO_PCI);
1726 1727 1728 1729 1730 1731
    DO_TEST("hostdev-mdev-precreated",
            QEMU_CAPS_DEVICE_VFIO_PCI);
    DO_TEST_PARSE_ERROR("hostdev-mdev-src-address-invalid",
            QEMU_CAPS_DEVICE_VFIO_PCI);
    DO_TEST_PARSE_ERROR("hostdev-mdev-invalid-target-address",
            QEMU_CAPS_DEVICE_VFIO_PCI);
1732 1733 1734 1735 1736 1737 1738
    DO_TEST_CAPS_LATEST("hostdev-mdev-display-spice-opengl");
    DO_TEST_CAPS_LATEST("hostdev-mdev-display-spice-egl-headless");
    DO_TEST_CAPS_LATEST("hostdev-mdev-display-vnc");
    DO_TEST_CAPS_LATEST("hostdev-mdev-display-vnc-egl-headless");
    DO_TEST_PARSE_ERROR("hostdev-mdev-display-missing-graphics",
            QEMU_CAPS_DEVICE_VFIO_PCI,
            QEMU_CAPS_VFIO_PCI_DISPLAY);
1739 1740
    DO_TEST_PARSE_ERROR("hostdev-vfio-zpci-wrong-arch",
                        QEMU_CAPS_DEVICE_VFIO_PCI);
1741 1742 1743
    DO_TEST("hostdev-vfio-zpci",
            QEMU_CAPS_DEVICE_VFIO_PCI,
            QEMU_CAPS_DEVICE_ZPCI);
1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756
    DO_TEST("hostdev-vfio-zpci-multidomain-many",
            QEMU_CAPS_DEVICE_VFIO_PCI,
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_ZPCI);
    DO_TEST("hostdev-vfio-zpci-autogenerate",
            QEMU_CAPS_DEVICE_VFIO_PCI,
            QEMU_CAPS_DEVICE_ZPCI);
    DO_TEST("hostdev-vfio-zpci-boundaries",
            QEMU_CAPS_DEVICE_VFIO_PCI,
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_ZPCI);
    DO_TEST_PARSE_ERROR("hostdev-vfio-zpci",
                        QEMU_CAPS_DEVICE_VFIO_PCI);
1757
    DO_TEST("pci-rom", NONE);
1758
    DO_TEST("pci-rom-disabled", NONE);
1759
    DO_TEST("pci-rom-disabled-invalid", NONE);
1760

1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776
    DO_TEST("hostdev-subsys-mdev-vfio-ccw",
            QEMU_CAPS_CCW,
            QEMU_CAPS_CCW_CSSID_UNRESTRICTED,
            QEMU_CAPS_DEVICE_VFIO_CCW);
    DO_TEST_FAILURE("hostdev-subsys-mdev-vfio-ccw",
            QEMU_CAPS_CCW,
            QEMU_CAPS_CCW_CSSID_UNRESTRICTED);
    DO_TEST_PARSE_ERROR("hostdev-subsys-mdev-vfio-ccw-duplicate-address",
            QEMU_CAPS_CCW,
            QEMU_CAPS_CCW_CSSID_UNRESTRICTED,
            QEMU_CAPS_DEVICE_VFIO_CCW);
    DO_TEST_PARSE_ERROR("hostdev-subsys-mdev-vfio-ccw-invalid-address",
            QEMU_CAPS_CCW,
            QEMU_CAPS_CCW_CSSID_UNRESTRICTED,
            QEMU_CAPS_DEVICE_VFIO_CCW);

1777
    DO_TEST_FULL("restore-v2",
1778 1779
                 ARG_MIGRATE_FROM, "exec:cat",
                 ARG_MIGRATE_FD, 7,
1780
                 ARG_QEMU_CAPS, NONE);
1781
    DO_TEST_FULL("restore-v2-fd",
1782 1783
                 ARG_MIGRATE_FROM, "stdio",
                 ARG_MIGRATE_FD, 7,
1784
                 ARG_QEMU_CAPS, NONE);
1785
    DO_TEST_FULL("restore-v2-fd",
1786 1787
                 ARG_MIGRATE_FROM, "fd:7",
                 ARG_MIGRATE_FD, 7,
1788
                 ARG_QEMU_CAPS, NONE);
1789
    DO_TEST_FULL("migrate",
1790
                 ARG_MIGRATE_FROM, "tcp:10.0.0.1:5000",
1791
                 ARG_QEMU_CAPS, NONE);
1792

1793
    DO_TEST_FULL("migrate-numa-unaligned",
1794 1795
                 ARG_MIGRATE_FROM, "stdio",
                 ARG_MIGRATE_FD, 7,
1796
                 ARG_QEMU_CAPS,
A
Andrea Bolognani 已提交
1797 1798
                 QEMU_CAPS_NUMA,
                 QEMU_CAPS_OBJECT_MEMORY_RAM);
1799

1800
    DO_TEST("qemu-ns", NONE);
1801
    DO_TEST("qemu-ns-no-env", NONE);
1802
    DO_TEST("qemu-ns-alt", NONE);
1803

1804
    DO_TEST("smp", NONE);
1805

J
John Ferlan 已提交
1806
    DO_TEST("iothreads", QEMU_CAPS_OBJECT_IOTHREAD);
1807 1808
    DO_TEST("iothreads-ids", QEMU_CAPS_OBJECT_IOTHREAD);
    DO_TEST("iothreads-ids-partial", QEMU_CAPS_OBJECT_IOTHREAD);
1809
    DO_TEST_FAILURE("iothreads-nocap", NONE);
1810 1811
    DO_TEST("iothreads-disk", QEMU_CAPS_OBJECT_IOTHREAD);
    DO_TEST("iothreads-disk-virtio-ccw", QEMU_CAPS_OBJECT_IOTHREAD,
1812
            QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
1813 1814
    DO_TEST_CAPS_LATEST("iothreads-virtio-scsi-pci");
    DO_TEST_CAPS_ARCH_LATEST("iothreads-virtio-scsi-ccw", "s390x");
J
John Ferlan 已提交
1815

1816 1817
    DO_TEST("cpu-topology1", NONE);
    DO_TEST("cpu-topology2", NONE);
1818
    DO_TEST("cpu-topology3", NONE);
1819 1820 1821 1822 1823 1824 1825 1826
    DO_TEST("cpu-minimum1", QEMU_CAPS_KVM);
    DO_TEST("cpu-minimum2", QEMU_CAPS_KVM);
    DO_TEST("cpu-exact1", QEMU_CAPS_KVM);
    DO_TEST("cpu-exact2", QEMU_CAPS_KVM);
    DO_TEST("cpu-exact2-nofallback", QEMU_CAPS_KVM);
    DO_TEST("cpu-fallback", QEMU_CAPS_KVM);
    DO_TEST_FAILURE("cpu-nofallback", QEMU_CAPS_KVM);
    DO_TEST("cpu-strict1", QEMU_CAPS_KVM);
1827
    DO_TEST("cpu-numa1", NONE);
1828 1829
    DO_TEST("cpu-numa2", NONE);
    DO_TEST("cpu-numa-no-memory-element", NONE);
1830
    DO_TEST_PARSE_ERROR("cpu-numa3", NONE);
1831 1832
    DO_TEST_FAILURE("cpu-numa-disjoint", NONE);
    DO_TEST("cpu-numa-disjoint", QEMU_CAPS_NUMA);
1833 1834
    DO_TEST_FAILURE("cpu-numa-memshared", QEMU_CAPS_OBJECT_MEMORY_RAM);
    DO_TEST_FAILURE("cpu-numa-memshared", NONE);
1835
    DO_TEST("cpu-numa-memshared", QEMU_CAPS_OBJECT_MEMORY_FILE);
1836
    DO_TEST("cpu-host-model", NONE);
1837
    DO_TEST("cpu-host-model-vendor", NONE);
1838
    DO_TEST_FULL("cpu-host-model-fallback",
1839
                 ARG_FLAGS, FLAG_SKIP_LEGACY_CPUS,
1840
                 ARG_QEMU_CAPS, NONE);
1841
    DO_TEST_FULL("cpu-host-model-nofallback",
1842
                 ARG_FLAGS, FLAG_SKIP_LEGACY_CPUS | FLAG_EXPECT_FAILURE,
1843
                 ARG_QEMU_CAPS, NONE);
A
Andrea Bolognani 已提交
1844 1845
    DO_TEST("cpu-host-passthrough", QEMU_CAPS_KVM);
    DO_TEST_FAILURE("cpu-qemu-host-passthrough", QEMU_CAPS_KVM);
1846

1847
    qemuTestSetHostArch(driver.caps, VIR_ARCH_S390X);
1848
    DO_TEST("cpu-s390-zEC12", QEMU_CAPS_KVM, QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
1849 1850
    DO_TEST("cpu-s390-features", QEMU_CAPS_KVM, QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION);
    DO_TEST_FAILURE("cpu-s390-features", QEMU_CAPS_KVM);
1851 1852
    qemuTestSetHostArch(driver.caps, VIR_ARCH_NONE);

1853
    qemuTestSetHostCPU(driver.caps, cpuHaswell);
1854 1855 1856 1857
    DO_TEST("cpu-Haswell", QEMU_CAPS_KVM);
    DO_TEST("cpu-Haswell2", QEMU_CAPS_KVM);
    DO_TEST("cpu-Haswell3", QEMU_CAPS_KVM);
    DO_TEST("cpu-Haswell-noTSX", QEMU_CAPS_KVM);
1858
    DO_TEST("cpu-host-model-cmt", NONE);
1859
    DO_TEST("cpu-tsc-frequency", QEMU_CAPS_KVM);
1860
    qemuTestSetHostCPU(driver.caps, NULL);
1861

1862 1863
    DO_TEST("encrypted-disk", QEMU_CAPS_QCOW2_LUKS, QEMU_CAPS_OBJECT_SECRET);
    DO_TEST("encrypted-disk-usage", QEMU_CAPS_QCOW2_LUKS, QEMU_CAPS_OBJECT_SECRET);
1864
    DO_TEST("luks-disks", QEMU_CAPS_OBJECT_SECRET);
1865
    DO_TEST("luks-disks-source", QEMU_CAPS_OBJECT_SECRET);
1866 1867
    DO_TEST_PARSE_ERROR("luks-disks-source-qcow2", QEMU_CAPS_OBJECT_SECRET);
    DO_TEST("luks-disks-source-qcow2", QEMU_CAPS_OBJECT_SECRET, QEMU_CAPS_QCOW2_LUKS);
1868
    DO_TEST_PARSE_ERROR("luks-disk-invalid", NONE);
1869
    DO_TEST_PARSE_ERROR("luks-disks-source-both", QEMU_CAPS_OBJECT_SECRET);
1870

1871 1872 1873 1874 1875 1876 1877 1878
    DO_TEST("memtune", NONE);
    DO_TEST("memtune-unlimited", NONE);
    DO_TEST("blkiotune", NONE);
    DO_TEST("blkiotune-device", NONE);
    DO_TEST("cputune", NONE);
    DO_TEST("cputune-zero-shares", NONE);
    DO_TEST_PARSE_ERROR("cputune-iothreadsched-toomuch", NONE);
    DO_TEST_PARSE_ERROR("cputune-vcpusched-overlap", NONE);
1879
    DO_TEST("cputune-numatune",
1880
            QEMU_CAPS_KVM,
1881
            QEMU_CAPS_OBJECT_IOTHREAD,
1882 1883
            QEMU_CAPS_OBJECT_MEMORY_RAM,
            QEMU_CAPS_OBJECT_MEMORY_FILE);
1884 1885 1886
    DO_TEST("vcpu-placement-static",
            QEMU_CAPS_KVM,
            QEMU_CAPS_OBJECT_IOTHREAD);
1887

1888
    DO_TEST("numatune-memory", NONE);
1889
    DO_TEST_PARSE_ERROR("numatune-memory-invalid-nodeset", NONE);
A
Andrea Bolognani 已提交
1890 1891 1892
    DO_TEST("numatune-memnode",
            QEMU_CAPS_NUMA,
            QEMU_CAPS_OBJECT_MEMORY_RAM);
1893 1894
    DO_TEST_FAILURE("numatune-memnode", NONE);

A
Andrea Bolognani 已提交
1895 1896 1897
    DO_TEST("numatune-memnode-no-memory",
            QEMU_CAPS_NUMA,
            QEMU_CAPS_OBJECT_MEMORY_RAM);
1898 1899
    DO_TEST_FAILURE("numatune-memnode-no-memory", NONE);

1900 1901
    DO_TEST("numatune-distances", QEMU_CAPS_NUMA, QEMU_CAPS_NUMA_DIST);

1902
    DO_TEST("numatune-auto-nodeset-invalid", NONE);
1903 1904
    DO_TEST("numatune-auto-prefer", QEMU_CAPS_OBJECT_MEMORY_RAM,
            QEMU_CAPS_OBJECT_MEMORY_FILE);
1905 1906
    DO_TEST_FAILURE("numatune-static-nodeset-exceed-hostnode",
                    QEMU_CAPS_OBJECT_MEMORY_RAM);
1907 1908
    DO_TEST_PARSE_ERROR("numatune-memnode-nocpu", NONE);
    DO_TEST_PARSE_ERROR("numatune-memnodes-problematic", NONE);
1909 1910
    DO_TEST("numad", NONE);
    DO_TEST("numad-auto-vcpu-static-numatune", NONE);
1911
    DO_TEST_PARSE_ERROR("numad-auto-vcpu-static-numatune-no-nodeset", NONE);
1912 1913 1914
    DO_TEST("numad-auto-memory-vcpu-cpuset", NONE);
    DO_TEST("numad-auto-memory-vcpu-no-cpuset-and-placement", NONE);
    DO_TEST("numad-static-memory-auto-vcpu", NONE);
1915
    DO_TEST("blkdeviotune-max",
1916
            QEMU_CAPS_DRIVE_IOTUNE_MAX);
1917 1918 1919
    DO_TEST("blkdeviotune-group-num",
            QEMU_CAPS_DRIVE_IOTUNE_MAX,
            QEMU_CAPS_DRIVE_IOTUNE_GROUP);
1920 1921 1922
    DO_TEST("blkdeviotune-max-length",
            QEMU_CAPS_DRIVE_IOTUNE_MAX,
            QEMU_CAPS_DRIVE_IOTUNE_MAX_LENGTH);
1923

1924
    DO_TEST("multifunction-pci-device",
1925
            QEMU_CAPS_SCSI_LSI);
1926

1927
    DO_TEST("monitor-json", NONE);
1928

1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940
    DO_TEST("seclabel-dynamic", NONE);
    DO_TEST("seclabel-dynamic-baselabel", NONE);
    DO_TEST("seclabel-dynamic-override", NONE);
    DO_TEST("seclabel-dynamic-labelskip", NONE);
    DO_TEST("seclabel-dynamic-relabel", NONE);
    DO_TEST("seclabel-static", NONE);
    DO_TEST("seclabel-static-relabel", NONE);
    DO_TEST("seclabel-static-labelskip", NONE);
    DO_TEST("seclabel-none", NONE);
    DO_TEST("seclabel-dac-none", NONE);
    DO_TEST_PARSE_ERROR("seclabel-multiple", NONE);
    DO_TEST_PARSE_ERROR("seclabel-device-duplicates", NONE);
1941

1942
    DO_TEST("pseries-basic",
1943
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1944
            QEMU_CAPS_DEVICE_SPAPR_VTY);
1945
    DO_TEST("pseries-vio",
1946
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1947
            QEMU_CAPS_DEVICE_SPAPR_VTY);
1948
    DO_TEST("pseries-usb-default",
1949
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1950
            QEMU_CAPS_DEVICE_SPAPR_VTY,
1951
            QEMU_CAPS_PIIX3_USB_UHCI,
1952
            QEMU_CAPS_PCI_OHCI);
1953
    DO_TEST("pseries-usb-multi",
1954
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1955
            QEMU_CAPS_DEVICE_SPAPR_VTY,
1956
            QEMU_CAPS_PIIX3_USB_UHCI,
1957
            QEMU_CAPS_PCI_OHCI);
1958
    DO_TEST("pseries-vio-user-assigned",
1959
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1960 1961
            QEMU_CAPS_DEVICE_SPAPR_VTY);
    DO_TEST_PARSE_ERROR("pseries-vio-address-clash", NONE);
1962 1963 1964
    DO_TEST("pseries-nvram",
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
            QEMU_CAPS_DEVICE_NVRAM);
1965
    DO_TEST("pseries-usb-kbd", QEMU_CAPS_PCI_OHCI,
1966
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1967
            QEMU_CAPS_DEVICE_USB_KBD,
1968
            QEMU_CAPS_DEVICE_SPAPR_VTY);
1969
    DO_TEST("pseries-cpu-exact",
1970
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1971 1972
            QEMU_CAPS_DEVICE_SPAPR_VTY);
    DO_TEST_PARSE_ERROR("pseries-no-parallel", NONE);
1973 1974

    qemuTestSetHostArch(driver.caps, VIR_ARCH_PPC64);
A
Andrea Bolognani 已提交
1975
    DO_TEST("pseries-cpu-compat", QEMU_CAPS_KVM,
1976
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1977
            QEMU_CAPS_DEVICE_SPAPR_VTY);
1978 1979 1980
    DO_TEST("pseries-machine-max-cpu-compat",
            QEMU_CAPS_KVM,
            QEMU_CAPS_MACHINE_PSERIES_MAX_CPU_COMPAT,
1981
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE);
A
Andrea Bolognani 已提交
1982
    DO_TEST("pseries-cpu-le", QEMU_CAPS_KVM,
1983
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1984
            QEMU_CAPS_DEVICE_SPAPR_VTY);
1985 1986 1987
    DO_TEST_FAILURE("pseries-cpu-compat-power9",
                    QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
                    QEMU_CAPS_KVM);
1988 1989 1990

    qemuTestSetHostCPU(driver.caps, cpuPower9);
    DO_TEST("pseries-cpu-compat-power9",
1991
            QEMU_CAPS_KVM,
1992
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1993
            QEMU_CAPS_DEVICE_SPAPR_VTY);
1994 1995
    qemuTestSetHostCPU(driver.caps, NULL);

1996 1997
    qemuTestSetHostArch(driver.caps, VIR_ARCH_NONE);

1998
    DO_TEST("pseries-panic-missing",
1999
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
2000
            QEMU_CAPS_DEVICE_SPAPR_VTY);
2001
    DO_TEST("pseries-panic-no-address",
2002
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
2003
            QEMU_CAPS_DEVICE_SPAPR_VTY);
2004
    DO_TEST_FAILURE("pseries-panic-address",
2005
                    QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE);
2006 2007 2008 2009 2010

    DO_TEST("pseries-phb-simple",
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE);
    DO_TEST("pseries-phb-default-missing",
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE);
2011 2012 2013 2014 2015 2016
    DO_TEST("pseries-phb-numa-node",
            QEMU_CAPS_NUMA,
            QEMU_CAPS_OBJECT_MEMORY_RAM,
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
            QEMU_CAPS_SPAPR_PCI_HOST_BRIDGE_NUMA_NODE);
    DO_TEST_PARSE_ERROR("pseries-default-phb-numa-node", NONE);
2017 2018 2019
    DO_TEST_PARSE_ERROR("pseries-phb-invalid-target-index-1", NONE);
    DO_TEST_PARSE_ERROR("pseries-phb-invalid-target-index-2", NONE);
    DO_TEST_PARSE_ERROR("pseries-phb-invalid-target-index-3", NONE);
2020

2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042
    DO_TEST("pseries-many-devices",
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
            QEMU_CAPS_VIRTIO_SCSI);
    DO_TEST("pseries-many-buses-1",
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
            QEMU_CAPS_VIRTIO_SCSI);
    DO_TEST("pseries-many-buses-2",
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
            QEMU_CAPS_VIRTIO_SCSI);
    DO_TEST("pseries-hostdevs-1",
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_DEVICE_VFIO_PCI);
    DO_TEST("pseries-hostdevs-2",
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_DEVICE_VFIO_PCI);
    DO_TEST("pseries-hostdevs-3",
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_DEVICE_VFIO_PCI);

2043
    DO_TEST("pseries-features",
2044
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
2045
            QEMU_CAPS_MACHINE_PSERIES_CAP_HPT_MAX_PAGE_SIZE,
2046
            QEMU_CAPS_MACHINE_PSERIES_CAP_HTM,
2047
            QEMU_CAPS_MACHINE_PSERIES_CAP_NESTED_HV,
2048
            QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT);
2049
    DO_TEST_FAILURE("pseries-features",
2050
                    QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE);
A
Andrea Bolognani 已提交
2051
    DO_TEST_PARSE_ERROR("pseries-features-invalid-machine", NONE);
2052

2053
    DO_TEST("pseries-serial-native",
2054
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
2055 2056
            QEMU_CAPS_DEVICE_SPAPR_VTY);
    DO_TEST("pseries-serial+console-native",
2057
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
2058 2059
            QEMU_CAPS_DEVICE_SPAPR_VTY);
    DO_TEST("pseries-serial-compat",
2060
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
2061
            QEMU_CAPS_DEVICE_SPAPR_VTY);
2062
    DO_TEST("pseries-serial-pci",
2063
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
2064 2065
            QEMU_CAPS_DEVICE_PCI_SERIAL);
    DO_TEST("pseries-serial-usb",
2066
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
2067 2068
            QEMU_CAPS_DEVICE_QEMU_XHCI,
            QEMU_CAPS_DEVICE_USB_SERIAL);
2069
    DO_TEST("pseries-console-native",
2070
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
2071 2072
            QEMU_CAPS_DEVICE_SPAPR_VTY);
    DO_TEST("pseries-console-virtio",
2073
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE);
2074 2075
    DO_TEST_PARSE_ERROR("pseries-serial-invalid-machine", NONE);

2076
    DO_TEST("mach-virt-serial-native",
2077
            QEMU_CAPS_DEVICE_PL011);
2078
    DO_TEST("mach-virt-serial+console-native",
2079
            QEMU_CAPS_DEVICE_PL011);
2080
    DO_TEST("mach-virt-serial-compat",
2081
            QEMU_CAPS_DEVICE_PL011);
2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093
    DO_TEST("mach-virt-serial-pci",
            QEMU_CAPS_OBJECT_GPEX,
            QEMU_CAPS_DEVICE_PCIE_ROOT_PORT,
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_PCI_SERIAL);
    DO_TEST("mach-virt-serial-usb",
            QEMU_CAPS_OBJECT_GPEX,
            QEMU_CAPS_DEVICE_PCIE_ROOT_PORT,
            QEMU_CAPS_DEVICE_QEMU_XHCI,
            QEMU_CAPS_DEVICE_USB_SERIAL);
    DO_TEST("mach-virt-console-native",
2094
            QEMU_CAPS_DEVICE_PL011);
2095 2096
    DO_TEST("mach-virt-console-virtio",
            QEMU_CAPS_DEVICE_VIRTIO_MMIO);
2097 2098
    DO_TEST_PARSE_ERROR("mach-virt-serial-invalid-machine", NONE);

2099 2100
    DO_TEST("disk-ide-split", NONE);
    DO_TEST("disk-ide-wwn", QEMU_CAPS_IDE_DRIVE_WWN);
2101

2102
    DO_TEST("disk-geometry", NONE);
2103
    DO_TEST("disk-blockio", QEMU_CAPS_BLOCKIO);
2104

2105
    DO_TEST("video-device-pciaddr-default",
2106 2107
            QEMU_CAPS_KVM,
            QEMU_CAPS_VNC,
2108
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2109
            QEMU_CAPS_DEVICE_QXL);
2110
    DO_TEST("video-vga-nodevice", QEMU_CAPS_DEVICE_VGA);
2111
    DO_TEST("video-vga-device", QEMU_CAPS_DEVICE_VGA,
2112
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
2113
    DO_TEST("video-vga-device-vgamem", QEMU_CAPS_DEVICE_VGA,
2114
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY, QEMU_CAPS_VGA_VGAMEM);
2115
    DO_TEST("video-qxl-nodevice", QEMU_CAPS_DEVICE_QXL);
2116
    DO_TEST("video-qxl-device",
2117
            QEMU_CAPS_DEVICE_QXL,
2118
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
2119
    DO_TEST("video-qxl-device-vgamem",
2120
            QEMU_CAPS_DEVICE_QXL,
2121
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2122
            QEMU_CAPS_QXL_VGAMEM);
2123
    DO_TEST_CAPS_LATEST("video-qxl-device-vram64");
2124
    DO_TEST("video-qxl-sec-device",
2125
            QEMU_CAPS_DEVICE_QXL, QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
2126
    DO_TEST("video-qxl-sec-device-vgamem",
2127 2128
            QEMU_CAPS_DEVICE_QXL,
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2129
            QEMU_CAPS_QXL_VGAMEM);
2130
    DO_TEST_CAPS_LATEST("video-qxl-sec-device-vram64");
2131 2132 2133
    DO_TEST("video-qxl-heads",
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
            QEMU_CAPS_DEVICE_QXL,
2134
            QEMU_CAPS_QXL_MAX_OUTPUTS);
2135 2136 2137
    DO_TEST("video-vga-qxl-heads",
            QEMU_CAPS_DEVICE_QXL,
            QEMU_CAPS_QXL_MAX_OUTPUTS);
2138 2139 2140
    DO_TEST("video-qxl-noheads",
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
            QEMU_CAPS_DEVICE_QXL,
2141
            QEMU_CAPS_QXL_MAX_OUTPUTS);
M
Marc-André Lureau 已提交
2142
    DO_TEST("video-virtio-gpu-device",
2143
            QEMU_CAPS_DEVICE_VIRTIO_GPU,
M
Marc-André Lureau 已提交
2144
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
2145
    DO_TEST("video-virtio-gpu-virgl",
2146
            QEMU_CAPS_DEVICE_VIRTIO_GPU,
2147
            QEMU_CAPS_VIRTIO_GPU_VIRGL,
2148
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
2149 2150
    DO_TEST("video-virtio-gpu-spice-gl",
            QEMU_CAPS_DEVICE_VIRTIO_GPU,
2151
            QEMU_CAPS_VIRTIO_GPU_VIRGL,
2152 2153
            QEMU_CAPS_SPICE,
            QEMU_CAPS_SPICE_GL,
2154
            QEMU_CAPS_SPICE_RENDERNODE,
2155
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
2156 2157 2158 2159 2160
    DO_TEST("video-virtio-gpu-sdl-gl",
            QEMU_CAPS_DEVICE_VIRTIO_GPU,
            QEMU_CAPS_VIRTIO_GPU_VIRGL,
            QEMU_CAPS_SDL_GL,
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
2161 2162 2163
    DO_TEST("video-virtio-gpu-secondary",
            QEMU_CAPS_DEVICE_VIRTIO_GPU,
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
2164 2165 2166
    DO_TEST("video-virtio-vga",
            QEMU_CAPS_DEVICE_VIRTIO_GPU,
            QEMU_CAPS_DEVICE_VIRTIO_VGA,
2167 2168
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
            QEMU_CAPS_VIRTIO_GPU_MAX_OUTPUTS);
2169 2170 2171
    DO_TEST("video-none-device",
            QEMU_CAPS_VNC);
    DO_TEST_PARSE_ERROR("video-invalid-multiple-devices", NONE);
2172

2173 2174
    DO_TEST("virtio-rng-default",
            QEMU_CAPS_DEVICE_VIRTIO_RNG,
2175
            QEMU_CAPS_OBJECT_RNG_RANDOM);
2176 2177
    DO_TEST("virtio-rng-random",
            QEMU_CAPS_DEVICE_VIRTIO_RNG,
2178
            QEMU_CAPS_OBJECT_RNG_RANDOM);
2179 2180
    DO_TEST("virtio-rng-egd",
            QEMU_CAPS_DEVICE_VIRTIO_RNG,
2181
            QEMU_CAPS_OBJECT_RNG_EGD);
J
Ján Tomko 已提交
2182 2183
    DO_TEST_CAPS_VER("virtio-rng-egd-unix", "2.5.0");
    DO_TEST_CAPS_LATEST("virtio-rng-egd-unix");
2184 2185 2186 2187
    DO_TEST("virtio-rng-multiple",
            QEMU_CAPS_DEVICE_VIRTIO_RNG,
            QEMU_CAPS_OBJECT_RNG_EGD,
            QEMU_CAPS_OBJECT_RNG_RANDOM);
2188
    DO_TEST_PARSE_ERROR("virtio-rng-egd-crash",
2189 2190
            QEMU_CAPS_DEVICE_VIRTIO_RNG,
            QEMU_CAPS_OBJECT_RNG_EGD);
2191
    DO_TEST("virtio-rng-ccw",
2192
            QEMU_CAPS_CCW,
2193 2194
            QEMU_CAPS_VIRTIO_S390,
            QEMU_CAPS_DEVICE_VIRTIO_RNG,
2195
            QEMU_CAPS_OBJECT_RNG_RANDOM);
2196

2197
    DO_TEST("s390-allow-bogus-usb-none",
2198 2199 2200
            QEMU_CAPS_VIRTIO_S390,
            QEMU_CAPS_DEVICE_VIRTIO_RNG,
            QEMU_CAPS_OBJECT_RNG_RANDOM);
2201
    DO_TEST("s390-allow-bogus-usb-controller",
2202 2203 2204
            QEMU_CAPS_VIRTIO_S390,
            QEMU_CAPS_DEVICE_VIRTIO_RNG,
            QEMU_CAPS_OBJECT_RNG_RANDOM);
2205

2206
    DO_TEST("s390-panic-no-address",
2207
            QEMU_CAPS_CCW,
2208
            QEMU_CAPS_VIRTIO_S390);
2209
    DO_TEST_FAILURE("s390-panic-address",
2210
            QEMU_CAPS_CCW,
2211
            QEMU_CAPS_VIRTIO_S390);
2212
    DO_TEST("s390-panic-missing",
2213
            QEMU_CAPS_CCW,
2214
            QEMU_CAPS_VIRTIO_S390);
2215
    DO_TEST_PARSE_ERROR("s390-no-parallel",
2216
            QEMU_CAPS_CCW,
2217
            QEMU_CAPS_VIRTIO_S390);
2218
    DO_TEST("s390-serial",
2219
            QEMU_CAPS_CCW,
2220 2221 2222
            QEMU_CAPS_VIRTIO_S390,
            QEMU_CAPS_DEVICE_SCLPCONSOLE);
    DO_TEST("s390-serial-2",
2223
            QEMU_CAPS_CCW,
2224 2225 2226 2227
            QEMU_CAPS_VIRTIO_S390,
            QEMU_CAPS_DEVICE_SCLPCONSOLE,
            QEMU_CAPS_DEVICE_SCLPLMCONSOLE);
    DO_TEST("s390-serial-console",
2228
            QEMU_CAPS_CCW,
2229 2230
            QEMU_CAPS_VIRTIO_S390,
            QEMU_CAPS_DEVICE_SCLPCONSOLE);
2231

2232
    DO_TEST("ppc-dtb",
J
Ján Tomko 已提交
2233
            QEMU_CAPS_KVM);
2234 2235
    DO_TEST("ppce500-serial",
            QEMU_CAPS_KVM);
O
Olivia Yin 已提交
2236

2237
    DO_TEST("tpm-passthrough",
2238
            QEMU_CAPS_DEVICE_TPM_PASSTHROUGH, QEMU_CAPS_DEVICE_TPM_TIS);
2239 2240
    DO_TEST("tpm-passthrough-crb",
            QEMU_CAPS_DEVICE_TPM_PASSTHROUGH, QEMU_CAPS_DEVICE_TPM_CRB);
2241
    DO_TEST_PARSE_ERROR("tpm-no-backend-invalid",
2242
                        QEMU_CAPS_DEVICE_TPM_PASSTHROUGH, QEMU_CAPS_DEVICE_TPM_TIS);
2243
    DO_TEST_CAPS_LATEST("tpm-emulator");
2244
    DO_TEST_CAPS_LATEST("tpm-emulator-tpm2");
2245

2246 2247 2248 2249
    DO_TEST_PARSE_ERROR("pci-domain-invalid", NONE);
    DO_TEST_PARSE_ERROR("pci-bus-invalid", NONE);
    DO_TEST_PARSE_ERROR("pci-slot-invalid", NONE);
    DO_TEST_PARSE_ERROR("pci-function-invalid", NONE);
2250

2251 2252 2253 2254 2255 2256
    DO_TEST("pci-bridge",
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
            QEMU_CAPS_VNC,
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
    DO_TEST("pci-autoadd-addr",
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
2257
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
2258 2259
    DO_TEST("pci-autoadd-idx",
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
2260 2261
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
    DO_TEST("pci-autofill-addr", QEMU_CAPS_DEVICE_CIRRUS_VGA);
2262
    DO_TEST("pci-many",
2263
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
2264
    DO_TEST("pci-bridge-many-disks",
2265
            QEMU_CAPS_DEVICE_PCI_BRIDGE);
L
Laine Stump 已提交
2266
    DO_TEST("pcie-root",
2267 2268 2269 2270
            QEMU_CAPS_DEVICE_IOH3420,
            QEMU_CAPS_ICH9_AHCI,
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
            QEMU_CAPS_DEVICE_QXL);
2271
    DO_TEST("q35",
2272
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
2273
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
2274
            QEMU_CAPS_DEVICE_IOH3420,
2275
            QEMU_CAPS_ICH9_AHCI,
2276
            QEMU_CAPS_ICH9_USB_EHCI1,
2277
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2278
            QEMU_CAPS_DEVICE_QXL);
2279 2280 2281 2282 2283 2284 2285 2286
    DO_TEST_PARSE_ERROR("q35-dmi-bad-address1",
                        QEMU_CAPS_DEVICE_PCI_BRIDGE,
                        QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
                        QEMU_CAPS_DEVICE_IOH3420);
    DO_TEST_PARSE_ERROR("q35-dmi-bad-address2",
                        QEMU_CAPS_DEVICE_PCI_BRIDGE,
                        QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
                        QEMU_CAPS_DEVICE_IOH3420);
2287
    DO_TEST("q35-pm-disable",
2288
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
2289
            QEMU_CAPS_DEVICE_IOH3420,
2290 2291 2292 2293
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, QEMU_CAPS_ICH9_AHCI,
            QEMU_CAPS_PIIX_DISABLE_S3, QEMU_CAPS_PIIX_DISABLE_S4,
            QEMU_CAPS_ICH9_DISABLE_S3, QEMU_CAPS_ICH9_DISABLE_S4);
    DO_TEST("q35-pm-disable-fallback",
2294
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
2295
            QEMU_CAPS_DEVICE_IOH3420,
2296 2297
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, QEMU_CAPS_ICH9_AHCI,
            QEMU_CAPS_PIIX_DISABLE_S3, QEMU_CAPS_PIIX_DISABLE_S4);
2298
    DO_TEST("q35-usb2",
2299
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
2300
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
2301
            QEMU_CAPS_DEVICE_IOH3420,
2302
            QEMU_CAPS_ICH9_AHCI,
2303
            QEMU_CAPS_ICH9_USB_EHCI1,
2304
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2305
            QEMU_CAPS_DEVICE_QXL);
2306
    DO_TEST("q35-usb2-multi",
2307
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
2308
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
2309
            QEMU_CAPS_DEVICE_IOH3420,
2310
            QEMU_CAPS_ICH9_AHCI,
2311
            QEMU_CAPS_ICH9_USB_EHCI1,
2312
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2313
            QEMU_CAPS_DEVICE_QXL);
2314
    DO_TEST("q35-usb2-reorder",
2315
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
2316
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
2317
            QEMU_CAPS_DEVICE_IOH3420,
2318
            QEMU_CAPS_ICH9_AHCI,
2319
            QEMU_CAPS_ICH9_USB_EHCI1,
2320
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2321
            QEMU_CAPS_DEVICE_QXL);
2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339
    /* verify that devices with pcie capability are assigned to a pcie slot */
    DO_TEST("q35-pcie",
            QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY,
            QEMU_CAPS_DEVICE_VIRTIO_RNG,
            QEMU_CAPS_OBJECT_RNG_RANDOM,
            QEMU_CAPS_DEVICE_VIRTIO_NET,
            QEMU_CAPS_DEVICE_VIRTIO_GPU,
            QEMU_CAPS_VIRTIO_GPU_VIRGL,
            QEMU_CAPS_VIRTIO_KEYBOARD,
            QEMU_CAPS_VIRTIO_MOUSE,
            QEMU_CAPS_VIRTIO_TABLET,
            QEMU_CAPS_VIRTIO_INPUT_HOST,
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_IOH3420,
            QEMU_CAPS_ICH9_AHCI,
            QEMU_CAPS_ICH9_USB_EHCI1,
2340
            QEMU_CAPS_NEC_USB_XHCI,
2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
    /* same XML as q35-pcie, but don't set
     * QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY, so virtio devices should
     * be assigned to legacy pci slots
     */
    DO_TEST("q35-virtio-pci",
            QEMU_CAPS_DEVICE_VIRTIO_RNG,
            QEMU_CAPS_OBJECT_RNG_RANDOM,
            QEMU_CAPS_DEVICE_VIRTIO_NET,
            QEMU_CAPS_DEVICE_VIRTIO_GPU,
            QEMU_CAPS_VIRTIO_GPU_VIRGL,
            QEMU_CAPS_VIRTIO_KEYBOARD,
            QEMU_CAPS_VIRTIO_MOUSE,
2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373
            QEMU_CAPS_VIRTIO_TABLET,
            QEMU_CAPS_VIRTIO_INPUT_HOST,
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_IOH3420,
            QEMU_CAPS_ICH9_AHCI,
            QEMU_CAPS_ICH9_USB_EHCI1,
            QEMU_CAPS_NEC_USB_XHCI,
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
    /* same as q35-pcie, but all PCI controllers are added automatically */
    DO_TEST("q35-pcie-autoadd",
            QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY,
            QEMU_CAPS_DEVICE_VIRTIO_RNG,
            QEMU_CAPS_OBJECT_RNG_RANDOM,
            QEMU_CAPS_DEVICE_VIRTIO_NET,
            QEMU_CAPS_DEVICE_VIRTIO_GPU,
            QEMU_CAPS_VIRTIO_GPU_VIRGL,
            QEMU_CAPS_VIRTIO_KEYBOARD,
            QEMU_CAPS_VIRTIO_MOUSE,
2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387
            QEMU_CAPS_VIRTIO_TABLET,
            QEMU_CAPS_VIRTIO_INPUT_HOST,
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_IOH3420,
            QEMU_CAPS_ICH9_AHCI,
            QEMU_CAPS_ICH9_USB_EHCI1,
            QEMU_CAPS_NEC_USB_XHCI,
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
    DO_TEST("q35-default-devices-only",
            QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY,
            QEMU_CAPS_DEVICE_VIRTIO_RNG,
            QEMU_CAPS_OBJECT_RNG_RANDOM,
2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406
            QEMU_CAPS_DEVICE_VIRTIO_NET,
            QEMU_CAPS_DEVICE_VIRTIO_GPU,
            QEMU_CAPS_VIRTIO_GPU_VIRGL,
            QEMU_CAPS_VIRTIO_KEYBOARD,
            QEMU_CAPS_VIRTIO_MOUSE,
            QEMU_CAPS_VIRTIO_TABLET,
            QEMU_CAPS_VIRTIO_INPUT_HOST,
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_IOH3420,
            QEMU_CAPS_ICH9_AHCI,
            QEMU_CAPS_ICH9_USB_EHCI1,
            QEMU_CAPS_NEC_USB_XHCI,
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
    DO_TEST("q35-multifunction",
            QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY,
            QEMU_CAPS_DEVICE_VIRTIO_RNG,
            QEMU_CAPS_OBJECT_RNG_RANDOM,
2407 2408 2409 2410 2411
            QEMU_CAPS_DEVICE_VIRTIO_NET,
            QEMU_CAPS_DEVICE_VIRTIO_GPU,
            QEMU_CAPS_VIRTIO_GPU_VIRGL,
            QEMU_CAPS_VIRTIO_KEYBOARD,
            QEMU_CAPS_VIRTIO_MOUSE,
2412 2413 2414 2415 2416 2417 2418 2419
            QEMU_CAPS_VIRTIO_TABLET,
            QEMU_CAPS_VIRTIO_INPUT_HOST,
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_IOH3420,
            QEMU_CAPS_ICH9_AHCI,
            QEMU_CAPS_ICH9_USB_EHCI1,
2420
            QEMU_CAPS_NEC_USB_XHCI,
2421
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
2422 2423
    DO_TEST("q35-virt-manager-basic",
            QEMU_CAPS_KVM,
2424
            QEMU_CAPS_MACHINE_VMPORT_OPT,
2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448
            QEMU_CAPS_ICH9_DISABLE_S3,
            QEMU_CAPS_ICH9_DISABLE_S4,
            QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY,
            QEMU_CAPS_DEVICE_VIRTIO_RNG,
            QEMU_CAPS_OBJECT_RNG_RANDOM,
            QEMU_CAPS_DEVICE_VIRTIO_NET,
            QEMU_CAPS_DEVICE_VIRTIO_GPU,
            QEMU_CAPS_VIRTIO_GPU_VIRGL,
            QEMU_CAPS_VIRTIO_KEYBOARD,
            QEMU_CAPS_VIRTIO_MOUSE,
            QEMU_CAPS_VIRTIO_TABLET,
            QEMU_CAPS_VIRTIO_INPUT_HOST,
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_IOH3420,
            QEMU_CAPS_ICH9_AHCI,
            QEMU_CAPS_ICH9_USB_EHCI1,
            QEMU_CAPS_NEC_USB_XHCI,
            QEMU_CAPS_DEVICE_ICH9_INTEL_HDA,
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
            QEMU_CAPS_SPICE,
            QEMU_CAPS_DEVICE_QXL,
            QEMU_CAPS_HDA_DUPLEX,
2449
            QEMU_CAPS_DEVICE_ISA_SERIAL,
2450
            QEMU_CAPS_USB_REDIR);
2451 2452

    /* Test automatic and manual setting of pcie-root-port attributes */
2453 2454
    DO_TEST("pcie-root-port",
            QEMU_CAPS_DEVICE_IOH3420,
2455
            QEMU_CAPS_ICH9_AHCI,
2456
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2457
            QEMU_CAPS_DEVICE_QXL);
2458 2459 2460 2461 2462 2463

    /* Make sure the default model for PCIe Root Ports is picked correctly
     * based on QEMU binary capabilities. We use x86/q35 for the test, but
     * any PCIe machine type (such as aarch64/virt) will behave the same */
    DO_TEST("pcie-root-port-model-generic",
            QEMU_CAPS_DEVICE_PCIE_ROOT_PORT,
2464
            QEMU_CAPS_DEVICE_IOH3420);
2465
    DO_TEST("pcie-root-port-model-ioh3420",
2466
            QEMU_CAPS_DEVICE_IOH3420);
2467

2468 2469 2470 2471 2472 2473 2474
    DO_TEST("autoindex",
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_IOH3420,
            QEMU_CAPS_DEVICE_X3130_UPSTREAM,
            QEMU_CAPS_DEVICE_XIO3130_DOWNSTREAM,
            QEMU_CAPS_ICH9_AHCI,
2475
            QEMU_CAPS_ICH9_USB_EHCI1,
2476
            QEMU_CAPS_NEC_USB_XHCI);
2477 2478 2479 2480 2481 2482 2483
    /* Make sure the user can always override libvirt's default device
     * placement policy by providing an explicit PCI address */
    DO_TEST("q35-pci-force-address",
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_IOH3420,
            QEMU_CAPS_HDA_DUPLEX);
2484

2485
    DO_TEST_PARSE_ERROR("q35-wrong-root",
2486
            QEMU_CAPS_DEVICE_IOH3420,
2487
            QEMU_CAPS_ICH9_AHCI,
2488
            QEMU_CAPS_ICH9_USB_EHCI1,
2489
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2490
            QEMU_CAPS_DEVICE_QXL);
2491
    DO_TEST_PARSE_ERROR("440fx-wrong-root", NONE);
2492
    DO_TEST_PARSE_ERROR("440fx-ide-address-conflict", NONE);
2493

2494
    DO_TEST_PARSE_ERROR("pcie-root-port-too-many",
2495
            QEMU_CAPS_DEVICE_IOH3420,
2496
            QEMU_CAPS_ICH9_AHCI,
2497
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2498
            QEMU_CAPS_DEVICE_QXL);
2499

2500 2501 2502
    DO_TEST("pcie-switch-upstream-port",
            QEMU_CAPS_DEVICE_IOH3420,
            QEMU_CAPS_DEVICE_X3130_UPSTREAM,
2503
            QEMU_CAPS_ICH9_AHCI,
2504
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2505
            QEMU_CAPS_DEVICE_QXL);
2506 2507 2508 2509
    DO_TEST("pcie-switch-downstream-port",
            QEMU_CAPS_DEVICE_IOH3420,
            QEMU_CAPS_DEVICE_X3130_UPSTREAM,
            QEMU_CAPS_DEVICE_XIO3130_DOWNSTREAM,
2510
            QEMU_CAPS_ICH9_AHCI,
2511
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2512
            QEMU_CAPS_DEVICE_QXL);
2513

2514 2515 2516 2517 2518 2519
    DO_TEST("pci-expander-bus",
            QEMU_CAPS_DEVICE_PXB);
    DO_TEST_PARSE_ERROR("pci-expander-bus-bad-node",
                        QEMU_CAPS_DEVICE_PXB);
    DO_TEST_PARSE_ERROR("pci-expander-bus-bad-machine",
                        QEMU_CAPS_DEVICE_PXB);
2520 2521
    DO_TEST_PARSE_ERROR("pci-expander-bus-bad-bus",
                        QEMU_CAPS_DEVICE_PXB);
2522

2523 2524 2525 2526 2527 2528 2529 2530 2531 2532
    DO_TEST("pcie-expander-bus",
            QEMU_CAPS_DEVICE_IOH3420,
            QEMU_CAPS_DEVICE_X3130_UPSTREAM,
            QEMU_CAPS_DEVICE_XIO3130_DOWNSTREAM,
            QEMU_CAPS_DEVICE_PXB_PCIE);
    DO_TEST_PARSE_ERROR("pcie-expander-bus-bad-machine",
                        QEMU_CAPS_DEVICE_IOH3420,
                        QEMU_CAPS_DEVICE_X3130_UPSTREAM,
                        QEMU_CAPS_DEVICE_XIO3130_DOWNSTREAM,
                        QEMU_CAPS_DEVICE_PXB_PCIE);
2533 2534 2535
    DO_TEST_PARSE_ERROR("pcie-expander-bus-bad-bus",
                        QEMU_CAPS_DEVICE_IOH3420,
                        QEMU_CAPS_DEVICE_PXB_PCIE);
2536

2537
    DO_TEST("hostdev-scsi-lsi",
2538 2539
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_SCSI_LSI);
2540
    DO_TEST("hostdev-scsi-virtio-scsi",
2541 2542
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_SCSI_LSI);
2543
    DO_TEST("hostdev-scsi-readonly",
2544 2545
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_SCSI_LSI);
2546
    DO_TEST("hostdev-scsi-virtio-scsi",
2547 2548
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_SCSI_LSI);
2549
    DO_TEST("hostdev-scsi-lsi-iscsi",
2550 2551
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_SCSI_LSI);
2552
    DO_TEST("hostdev-scsi-lsi-iscsi-auth",
2553 2554
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_SCSI_LSI);
2555
    DO_TEST("hostdev-scsi-virtio-iscsi",
2556 2557
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_SCSI_LSI);
2558
    DO_TEST("hostdev-scsi-virtio-iscsi-auth",
2559 2560
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_SCSI_LSI);
2561
    DO_TEST("disk-hostdev-scsi-virtio-iscsi-auth-AES",
2562 2563 2564
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_SCSI_LSI,
            QEMU_CAPS_OBJECT_SECRET,
2565
            QEMU_CAPS_ISCSI_PASSWORD_SECRET);
2566 2567
    DO_TEST("hostdev-scsi-vhost-scsi-ccw",
            QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE_VHOST_SCSI,
2568
            QEMU_CAPS_CCW);
2569
    DO_TEST("hostdev-scsi-vhost-scsi-pci",
2570 2571
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_DEVICE_VHOST_SCSI);
2572 2573 2574 2575 2576
    DO_TEST("hostdev-scsi-vhost-scsi-pcie",
            QEMU_CAPS_KVM,
            QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE_VHOST_SCSI,
            QEMU_CAPS_DEVICE_PCIE_ROOT_PORT,
            QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY);
2577

2578
    DO_TEST("mlock-on", QEMU_CAPS_REALTIME_MLOCK);
2579
    DO_TEST_FAILURE("mlock-on", NONE);
2580
    DO_TEST("mlock-off", QEMU_CAPS_REALTIME_MLOCK);
2581 2582
    DO_TEST("mlock-unsupported", NONE);

2583 2584 2585 2586
    DO_TEST_PARSE_ERROR("pci-bridge-negative-index-invalid", NONE);
    DO_TEST_PARSE_ERROR("pci-bridge-duplicate-index", NONE);
    DO_TEST_PARSE_ERROR("pci-root-nonzero-index", NONE);
    DO_TEST_PARSE_ERROR("pci-root-address", NONE);
2587

2588
    DO_TEST("hotplug-base",
2589
            QEMU_CAPS_KVM, QEMU_CAPS_VIRTIO_SCSI);
2590

2591 2592
    DO_TEST("pcihole64", QEMU_CAPS_I440FX_PCI_HOLE64_SIZE);
    DO_TEST_FAILURE("pcihole64-none", NONE);
2593
    DO_TEST("pcihole64-q35",
2594
            QEMU_CAPS_DEVICE_IOH3420,
2595
            QEMU_CAPS_ICH9_AHCI,
2596
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2597
            QEMU_CAPS_DEVICE_QXL,
2598 2599
            QEMU_CAPS_Q35_PCI_HOLE64_SIZE);

J
Ján Tomko 已提交
2600 2601
    DO_TEST("arm-vexpressa9-nodevs", NONE);
    DO_TEST("arm-vexpressa9-basic", NONE);
2602
    DO_TEST("arm-vexpressa9-virtio",
2603
            QEMU_CAPS_DEVICE_VIRTIO_MMIO,
2604
            QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM);
2605
    DO_TEST("arm-virt-virtio",
2606
            QEMU_CAPS_DEVICE_VIRTIO_MMIO,
2607
            QEMU_CAPS_DEVICE_PL011,
2608
            QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM);
2609

2610
    DO_TEST("aarch64-virt-virtio",
2611
            QEMU_CAPS_DEVICE_VIRTIO_MMIO,
2612
            QEMU_CAPS_DEVICE_PL011,
2613
            QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM);
2614 2615 2616 2617 2618 2619

    /* Demonstrates the virtio-pci default... namely that there isn't any!
       q35 style PCI controllers will be added if the binary supports it,
       but virtio-mmio is always used unless PCI addresses are manually
       specified. */
    DO_TEST("aarch64-virtio-pci-default",
2620
            QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY,
2621 2622 2623
            QEMU_CAPS_DEVICE_VIRTIO_MMIO,
            QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM,
            QEMU_CAPS_OBJECT_GPEX, QEMU_CAPS_DEVICE_PCI_BRIDGE,
2624
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
2625
            QEMU_CAPS_DEVICE_IOH3420,
2626
            QEMU_CAPS_DEVICE_PL011,
2627
            QEMU_CAPS_VIRTIO_SCSI);
2628
    DO_TEST("aarch64-virt-2.6-virtio-pci-default",
2629
            QEMU_CAPS_DEVICE_VIRTIO_MMIO,
2630 2631
            QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM,
            QEMU_CAPS_OBJECT_GPEX, QEMU_CAPS_DEVICE_PCI_BRIDGE,
2632
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
2633
            QEMU_CAPS_DEVICE_PL011,
2634
            QEMU_CAPS_DEVICE_IOH3420);
2635 2636 2637
    /* Example of using virtio-pci with no explicit PCI controller
       but with manual PCI addresses */
    DO_TEST("aarch64-virtio-pci-manual-addresses",
2638
            QEMU_CAPS_DEVICE_VIRTIO_MMIO,
2639 2640
            QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM,
            QEMU_CAPS_OBJECT_GPEX, QEMU_CAPS_DEVICE_PCI_BRIDGE,
2641 2642 2643
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_IOH3420,
            QEMU_CAPS_VIRTIO_SCSI);
2644
    DO_TEST("aarch64-video-virtio-gpu-pci",
2645
            QEMU_CAPS_OBJECT_GPEX,
2646
            QEMU_CAPS_DEVICE_PCI_BRIDGE, QEMU_CAPS_DEVICE_IOH3420,
2647
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2648
            QEMU_CAPS_DEVICE_VIRTIO_GPU);
2649
    DO_TEST("aarch64-video-default",
2650
            QEMU_CAPS_OBJECT_GPEX,
2651
            QEMU_CAPS_DEVICE_PCI_BRIDGE, QEMU_CAPS_DEVICE_IOH3420,
2652
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2653 2654
            QEMU_CAPS_DEVICE_VIRTIO_GPU, QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
            QEMU_CAPS_VNC);
2655
    DO_TEST("aarch64-aavmf-virtio-mmio",
2656
            QEMU_CAPS_DEVICE_VIRTIO_MMIO,
2657
            QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM);
2658 2659
    DO_TEST("aarch64-virt-default-nic",
            QEMU_CAPS_DEVICE_VIRTIO_MMIO);
2660
    qemuTestSetHostArch(driver.caps, VIR_ARCH_AARCH64);
2661
    DO_TEST("aarch64-cpu-passthrough",
2662
            QEMU_CAPS_DEVICE_VIRTIO_MMIO,
A
Andrea Bolognani 已提交
2663
            QEMU_CAPS_KVM);
2664
    DO_TEST_GIC("aarch64-gic-none", GIC_NONE,
2665
            QEMU_CAPS_KVM,
2666
            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
2667
    DO_TEST_GIC("aarch64-gic-none-v2", GIC_V2,
2668
            QEMU_CAPS_KVM,
2669 2670
            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
    DO_TEST_GIC("aarch64-gic-none-v3", GIC_V3,
2671
            QEMU_CAPS_KVM,
2672
            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
2673
    DO_TEST_GIC("aarch64-gic-none-both", GIC_BOTH,
2674
            QEMU_CAPS_KVM,
2675
            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
2676 2677
    DO_TEST_GIC("aarch64-gic-none-tcg", GIC_BOTH,
            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
2678
    DO_TEST_GIC("aarch64-gic-default", GIC_NONE,
2679
            QEMU_CAPS_KVM,
2680
            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
A
Andrea Bolognani 已提交
2681
    DO_TEST_GIC("aarch64-gic-default-v2", GIC_V2,
2682
            QEMU_CAPS_KVM,
2683
            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
A
Andrea Bolognani 已提交
2684
    DO_TEST_GIC("aarch64-gic-default-v3", GIC_V3,
2685
            QEMU_CAPS_KVM,
2686
            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
A
Andrea Bolognani 已提交
2687
    DO_TEST_GIC("aarch64-gic-default-both", GIC_BOTH,
2688
            QEMU_CAPS_KVM,
2689 2690
            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
    DO_TEST_GIC("aarch64-gic-v2", GIC_NONE,
2691
            QEMU_CAPS_KVM,
2692 2693
            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
    DO_TEST_GIC("aarch64-gic-v2", GIC_V2,
2694
            QEMU_CAPS_KVM,
2695 2696
            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
    DO_TEST_GIC("aarch64-gic-v2", GIC_V3,
2697
            QEMU_CAPS_KVM,
2698
            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
2699
    DO_TEST_GIC("aarch64-gic-v2", GIC_BOTH,
2700
            QEMU_CAPS_KVM,
2701
            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
2702
    DO_TEST_FAILURE("aarch64-gic-v3",
2703
            QEMU_CAPS_KVM, NONE);
2704
    DO_TEST_GIC("aarch64-gic-v3", GIC_NONE,
2705
            QEMU_CAPS_KVM,
2706 2707
            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
    DO_TEST_GIC("aarch64-gic-v3", GIC_V2,
2708
            QEMU_CAPS_KVM,
2709 2710
            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
    DO_TEST_GIC("aarch64-gic-v3", GIC_V3,
2711
            QEMU_CAPS_KVM,
2712 2713
            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
    DO_TEST_GIC("aarch64-gic-v3", GIC_BOTH,
2714
            QEMU_CAPS_KVM,
2715
            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
2716
    DO_TEST_FAILURE("aarch64-gic-host",
2717
            QEMU_CAPS_KVM, NONE);
2718
    DO_TEST_GIC("aarch64-gic-host", GIC_NONE,
2719
            QEMU_CAPS_KVM,
2720 2721
            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
    DO_TEST_GIC("aarch64-gic-host", GIC_V2,
2722
            QEMU_CAPS_KVM,
2723 2724
            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
    DO_TEST_GIC("aarch64-gic-host", GIC_V3,
2725
            QEMU_CAPS_KVM,
2726 2727
            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
    DO_TEST_GIC("aarch64-gic-host", GIC_BOTH,
2728
            QEMU_CAPS_KVM,
2729
            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
2730
    DO_TEST_PARSE_ERROR("aarch64-gic-invalid",
2731
            QEMU_CAPS_KVM,
2732
            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
2733
    DO_TEST_PARSE_ERROR("aarch64-gic-not-virt",
2734
                        QEMU_CAPS_KVM,
2735 2736
                        QEMU_CAPS_MACH_VIRT_GIC_VERSION);
    DO_TEST_PARSE_ERROR("aarch64-gic-not-arm",
2737
                        QEMU_CAPS_KVM,
2738
                        QEMU_CAPS_MACH_VIRT_GIC_VERSION);
2739
    DO_TEST("aarch64-kvm-32-on-64",
2740
            QEMU_CAPS_DEVICE_VIRTIO_MMIO,
2741
            QEMU_CAPS_DEVICE_PL011,
A
Andrea Bolognani 已提交
2742
            QEMU_CAPS_KVM, QEMU_CAPS_CPU_AARCH64_OFF);
2743
    DO_TEST_FAILURE("aarch64-kvm-32-on-64",
2744
            QEMU_CAPS_DEVICE_VIRTIO_MMIO,
A
Andrea Bolognani 已提交
2745
            QEMU_CAPS_KVM);
2746 2747 2748 2749 2750 2751 2752
    DO_TEST("aarch64-pci-serial",
            QEMU_CAPS_DEVICE_PCI_SERIAL,
            QEMU_CAPS_CHARDEV_LOGFILE,
            QEMU_CAPS_OBJECT_GPEX,
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_PCIE_ROOT_PORT);
2753 2754 2755 2756
    DO_TEST("aarch64-traditional-pci",
            QEMU_CAPS_OBJECT_GPEX,
            QEMU_CAPS_DEVICE_PCIE_ROOT_PORT,
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
2757
            QEMU_CAPS_DEVICE_PCIE_PCI_BRIDGE,
2758 2759
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_PCI_SERIAL);
2760 2761 2762 2763 2764 2765 2766

    /* Make sure all combinations of ACPI and UEFI behave as expected */
    DO_TEST("aarch64-acpi-uefi", NONE);
    DO_TEST("aarch64-noacpi-uefi", NONE);
    DO_TEST("aarch64-noacpi-nouefi", NONE);
    DO_TEST_PARSE_ERROR("aarch64-acpi-nouefi", NONE);

2767
    qemuTestSetHostArch(driver.caps, VIR_ARCH_NONE);
2768

2769
    DO_TEST("kvm-pit-delay", QEMU_CAPS_KVM_PIT_TICK_POLICY);
2770
    DO_TEST("kvm-pit-discard", QEMU_CAPS_KVM_PIT_TICK_POLICY);
2771

2772 2773 2774 2775
    DO_TEST("panic",
            QEMU_CAPS_DEVICE_PANIC);
    DO_TEST("panic-double",
            QEMU_CAPS_DEVICE_PANIC);
H
Hu Tao 已提交
2776

2777 2778
    DO_TEST("panic-no-address",
            QEMU_CAPS_DEVICE_PANIC);
2779

2780 2781
    DO_TEST("fips-enabled", QEMU_CAPS_ENABLE_FIPS);

J
Ján Tomko 已提交
2782
    DO_TEST("shmem", QEMU_CAPS_DEVICE_IVSHMEM);
2783 2784 2785
    DO_TEST("shmem-plain-doorbell", QEMU_CAPS_DEVICE_IVSHMEM,
            QEMU_CAPS_DEVICE_IVSHMEM_PLAIN,
            QEMU_CAPS_DEVICE_IVSHMEM_DOORBELL);
2786
    DO_TEST_FAILURE("shmem", NONE);
J
Ján Tomko 已提交
2787
    DO_TEST_FAILURE("shmem-invalid-size",
2788
                    QEMU_CAPS_DEVICE_IVSHMEM);
J
Ján Tomko 已提交
2789
    DO_TEST_FAILURE("shmem-invalid-address",
2790
                    QEMU_CAPS_DEVICE_IVSHMEM);
J
Ján Tomko 已提交
2791
    DO_TEST_FAILURE("shmem-small-size",
2792
                    QEMU_CAPS_DEVICE_IVSHMEM);
2793
    DO_TEST_PARSE_ERROR("shmem-msi-only", NONE);
A
Andrea Bolognani 已提交
2794
    DO_TEST("cpu-host-passthrough-features", QEMU_CAPS_KVM);
2795

2796
    DO_TEST_FAILURE("memory-align-fail", NONE);
2797
    DO_TEST_FAILURE("memory-hotplug-nonuma", QEMU_CAPS_DEVICE_PC_DIMM);
M
Michal Privoznik 已提交
2798
    DO_TEST("memory-hotplug", NONE);
2799
    DO_TEST("memory-hotplug", QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_NUMA);
2800
    DO_TEST("memory-hotplug-dimm", QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_NUMA,
2801
            QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_OBJECT_MEMORY_FILE);
2802
    DO_TEST("memory-hotplug-dimm-addr", QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_NUMA,
2803
            QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_OBJECT_MEMORY_FILE);
2804
    DO_TEST("memory-hotplug-ppc64-nonuma", QEMU_CAPS_KVM, QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_NUMA,
2805
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
2806
            QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_OBJECT_MEMORY_FILE);
2807 2808 2809
    DO_TEST_CAPS_LATEST("memory-hotplug-nvdimm");
    DO_TEST_CAPS_LATEST("memory-hotplug-nvdimm-access");
    DO_TEST_CAPS_LATEST("memory-hotplug-nvdimm-label");
2810
    DO_TEST_CAPS_LATEST("memory-hotplug-nvdimm-align");
2811
    DO_TEST_CAPS_LATEST("memory-hotplug-nvdimm-pmem");
2812
    DO_TEST_CAPS_LATEST("memory-hotplug-nvdimm-readonly");
2813

2814
    DO_TEST("machine-aeskeywrap-on-caps",
2815
            QEMU_CAPS_AES_KEY_WRAP,
2816
            QEMU_CAPS_DEA_KEY_WRAP,
2817
            QEMU_CAPS_VIRTIO_SCSI,
2818
            QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
2819
    DO_TEST_FAILURE("machine-aeskeywrap-on-caps",
2820
                    QEMU_CAPS_VIRTIO_SCSI,
2821
                    QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
2822 2823 2824
    DO_TEST_FAILURE("machine-aeskeywrap-on-caps", NONE);

    DO_TEST("machine-aeskeywrap-on-cap",
2825
            QEMU_CAPS_AES_KEY_WRAP,
2826
            QEMU_CAPS_VIRTIO_SCSI,
2827
            QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
2828
    DO_TEST_FAILURE("machine-aeskeywrap-on-cap",
2829
                    QEMU_CAPS_VIRTIO_SCSI,
2830
                    QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
2831 2832 2833
    DO_TEST_FAILURE("machine-aeskeywrap-on-cap", NONE);

    DO_TEST("machine-aeskeywrap-off-caps",
2834
            QEMU_CAPS_AES_KEY_WRAP, QEMU_CAPS_DEA_KEY_WRAP,
2835
            QEMU_CAPS_VIRTIO_SCSI,
2836
            QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
2837
    DO_TEST_FAILURE("machine-aeskeywrap-off-caps",
2838
                    QEMU_CAPS_VIRTIO_SCSI,
2839
                    QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
2840 2841 2842
    DO_TEST_FAILURE("machine-aeskeywrap-off-caps", NONE);

    DO_TEST("machine-aeskeywrap-off-cap",
2843
            QEMU_CAPS_AES_KEY_WRAP,
2844
            QEMU_CAPS_VIRTIO_SCSI,
2845
            QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
2846
    DO_TEST_FAILURE("machine-aeskeywrap-off-cap",
2847
                    QEMU_CAPS_VIRTIO_SCSI,
2848
                    QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
2849 2850 2851
    DO_TEST_FAILURE("machine-aeskeywrap-off-cap", NONE);

    DO_TEST("machine-deakeywrap-on-caps",
2852
            QEMU_CAPS_AES_KEY_WRAP, QEMU_CAPS_DEA_KEY_WRAP,
2853
            QEMU_CAPS_VIRTIO_SCSI,
2854
            QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
2855
    DO_TEST_FAILURE("machine-deakeywrap-on-caps",
2856
                    QEMU_CAPS_VIRTIO_SCSI,
2857
                    QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
2858 2859 2860
    DO_TEST_FAILURE("machine-deakeywrap-on-caps", NONE);

    DO_TEST("machine-deakeywrap-on-cap",
2861
            QEMU_CAPS_DEA_KEY_WRAP,
2862
            QEMU_CAPS_VIRTIO_SCSI,
2863
            QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
2864
    DO_TEST_FAILURE("machine-deakeywrap-on-cap",
2865
                    QEMU_CAPS_VIRTIO_SCSI,
2866
                    QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
2867 2868 2869
    DO_TEST_FAILURE("machine-deakeywrap-on-cap", NONE);

    DO_TEST("machine-deakeywrap-off-caps",
2870
            QEMU_CAPS_AES_KEY_WRAP, QEMU_CAPS_DEA_KEY_WRAP,
2871
            QEMU_CAPS_VIRTIO_SCSI,
2872
            QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
2873
    DO_TEST_FAILURE("machine-deakeywrap-off-caps",
2874
                    QEMU_CAPS_VIRTIO_SCSI,
2875
                    QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
2876 2877 2878
    DO_TEST_FAILURE("machine-deakeywrap-off-caps", NONE);

    DO_TEST("machine-deakeywrap-off-cap",
2879
            QEMU_CAPS_DEA_KEY_WRAP,
2880
            QEMU_CAPS_VIRTIO_SCSI,
2881
            QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
2882
    DO_TEST_FAILURE("machine-deakeywrap-off-cap",
2883
                    QEMU_CAPS_VIRTIO_SCSI,
2884
                    QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
2885 2886 2887
    DO_TEST_FAILURE("machine-deakeywrap-off-cap", NONE);

    DO_TEST("machine-keywrap-none-caps",
2888
            QEMU_CAPS_AES_KEY_WRAP, QEMU_CAPS_DEA_KEY_WRAP,
2889
            QEMU_CAPS_VIRTIO_SCSI,
2890
            QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
2891
    DO_TEST("machine-keywrap-none",
2892
            QEMU_CAPS_VIRTIO_SCSI,
2893
            QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
2894

2895
    DO_TEST("machine-loadparm-s390",
2896
            QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390,
2897
            QEMU_CAPS_LOADPARM);
2898
    DO_TEST("machine-loadparm-net-s390",
2899
            QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390,
2900
            QEMU_CAPS_LOADPARM);
2901
    DO_TEST("machine-loadparm-multiple-disks-nets-s390",
2902
            QEMU_CAPS_CCW,
2903
            QEMU_CAPS_VIRTIO_S390,
2904 2905
            QEMU_CAPS_LOADPARM);
    DO_TEST_PARSE_ERROR("machine-loadparm-s390-char-invalid",
2906
                        QEMU_CAPS_CCW,
2907
                        QEMU_CAPS_VIRTIO_S390,
2908 2909
                        QEMU_CAPS_LOADPARM);
    DO_TEST_PARSE_ERROR("machine-loadparm-s390-len-invalid",
2910
                        QEMU_CAPS_CCW,
2911
                        QEMU_CAPS_VIRTIO_S390,
2912 2913
                        QEMU_CAPS_LOADPARM);

J
Jiri Denemark 已提交
2914 2915 2916 2917 2918 2919 2920
    DO_TEST("qemu-ns-domain-ns0", NONE);
    DO_TEST("qemu-ns-domain-commandline", NONE);
    DO_TEST("qemu-ns-domain-commandline-ns0", NONE);
    DO_TEST("qemu-ns-commandline", NONE);
    DO_TEST("qemu-ns-commandline-ns0", NONE);
    DO_TEST("qemu-ns-commandline-ns1", NONE);

2921
    DO_TEST("virtio-input", QEMU_CAPS_VIRTIO_KEYBOARD,
2922
            QEMU_CAPS_VIRTIO_MOUSE, QEMU_CAPS_VIRTIO_TABLET);
2923
    DO_TEST("virtio-input-passthrough", QEMU_CAPS_VIRTIO_INPUT_HOST);
2924

2925
    DO_TEST("ppc64-usb-controller",
2926
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
2927
            QEMU_CAPS_PCI_OHCI);
2928
    DO_TEST("ppc64-usb-controller-legacy",
2929
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
2930
            QEMU_CAPS_PIIX3_USB_UHCI);
2931
    DO_TEST_FULL("ppc64-usb-controller-qemu-xhci",
2932
                 ARG_PARSEFLAGS, VIR_DOMAIN_DEF_PARSE_ABI_UPDATE,
2933
                 ARG_QEMU_CAPS,
2934
                 QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
2935 2936 2937 2938 2939 2940 2941
                 QEMU_CAPS_NEC_USB_XHCI,
                 QEMU_CAPS_DEVICE_QEMU_XHCI);

    DO_TEST("aarch64-usb-controller-qemu-xhci",
            QEMU_CAPS_OBJECT_GPEX,
            QEMU_CAPS_NEC_USB_XHCI,
            QEMU_CAPS_DEVICE_QEMU_XHCI);
2942

2943 2944 2945 2946
    DO_TEST("aarch64-usb-controller-nec-xhci",
            QEMU_CAPS_OBJECT_GPEX,
            QEMU_CAPS_NEC_USB_XHCI);

2947 2948 2949
    /* VM XML has invalid arch/ostype/virttype combo, but the SKIP flag
     * will avoid the error. Still, we expect qemu driver to complain about
     * missing machine error, and not crash */
2950 2951 2952 2953
    DO_TEST_FULL("missing-machine",
                 ARG_FLAGS, FLAG_EXPECT_PARSE_ERROR | FLAG_EXPECT_FAILURE,
                 ARG_PARSEFLAGS, VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE,
                 ARG_QEMU_CAPS, NONE);
2954

2955 2956 2957
    DO_TEST("name-escape",
            QEMU_CAPS_NAME_DEBUG_THREADS,
            QEMU_CAPS_OBJECT_SECRET,
2958 2959
            QEMU_CAPS_DRIVE_IOTUNE_MAX,
            QEMU_CAPS_DRIVE_IOTUNE_GROUP,
2960 2961 2962 2963
            QEMU_CAPS_VNC,
            QEMU_CAPS_NAME_GUEST,
            QEMU_CAPS_DEVICE_CIRRUS_VGA,
            QEMU_CAPS_SPICE,
2964
            QEMU_CAPS_SPICE_UNIX,
2965 2966 2967 2968 2969
            QEMU_CAPS_DEVICE_VIRTIO_GPU,
            QEMU_CAPS_VIRTIO_GPU_VIRGL,
            QEMU_CAPS_SPICE_GL,
            QEMU_CAPS_SPICE_RENDERNODE,
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2970
            QEMU_CAPS_DEVICE_ISA_SERIAL,
2971
            QEMU_CAPS_CHARDEV_FILE_APPEND,
2972
            QEMU_CAPS_CCID_EMULATED,
2973
            QEMU_CAPS_VIRTIO_SCSI);
M
Marc-André Lureau 已提交
2974 2975
    DO_TEST("debug-threads", QEMU_CAPS_NAME_DEBUG_THREADS);

2976
    DO_TEST("master-key", QEMU_CAPS_OBJECT_SECRET);
2977
    DO_TEST("usb-long-port-path",
J
Ján Tomko 已提交
2978
            QEMU_CAPS_USB_HUB);
2979
    DO_TEST_PARSE_ERROR("usb-too-long-port-path-invalid",
2980
                        QEMU_CAPS_USB_HUB);
2981

2982
    DO_TEST("acpi-table", NONE);
2983
    DO_TEST("intel-iommu",
2984
            QEMU_CAPS_DEVICE_INTEL_IOMMU);
2985 2986
    DO_TEST("intel-iommu-machine",
            QEMU_CAPS_MACHINE_IOMMU);
J
Ján Tomko 已提交
2987
    DO_TEST("intel-iommu-caching-mode",
2988 2989
            QEMU_CAPS_MACHINE_KERNEL_IRQCHIP,
            QEMU_CAPS_MACHINE_KERNEL_IRQCHIP_SPLIT,
2990 2991 2992 2993 2994 2995 2996 2997
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_IOH3420,
            QEMU_CAPS_ICH9_AHCI,
            QEMU_CAPS_ICH9_USB_EHCI1,
            QEMU_CAPS_DEVICE_INTEL_IOMMU,
            QEMU_CAPS_INTEL_IOMMU_INTREMAP,
            QEMU_CAPS_INTEL_IOMMU_CACHING_MODE);
2998 2999 3000 3001 3002 3003
    DO_TEST("intel-iommu-eim",
            QEMU_CAPS_MACHINE_KERNEL_IRQCHIP,
            QEMU_CAPS_MACHINE_KERNEL_IRQCHIP_SPLIT,
            QEMU_CAPS_INTEL_IOMMU_INTREMAP,
            QEMU_CAPS_INTEL_IOMMU_EIM,
            QEMU_CAPS_DEVICE_INTEL_IOMMU);
3004 3005 3006 3007 3008 3009
    DO_TEST("intel-iommu-device-iotlb",
            QEMU_CAPS_MACHINE_KERNEL_IRQCHIP,
            QEMU_CAPS_MACHINE_KERNEL_IRQCHIP_SPLIT,
            QEMU_CAPS_INTEL_IOMMU_INTREMAP,
            QEMU_CAPS_INTEL_IOMMU_DEVICE_IOTLB,
            QEMU_CAPS_DEVICE_INTEL_IOMMU);
3010

3011
    DO_TEST("cpu-hotplug-startup", QEMU_CAPS_QUERY_HOTPLUGGABLE_CPUS);
3012 3013 3014
    DO_TEST_PARSE_ERROR("cpu-hotplug-granularity",
                        QEMU_CAPS_QUERY_HOTPLUGGABLE_CPUS);

3015 3016 3017 3018 3019 3020 3021
    DO_TEST("virtio-options", QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_VIRTIO_KEYBOARD,
            QEMU_CAPS_VIRTIO_MOUSE, QEMU_CAPS_VIRTIO_TABLET,
            QEMU_CAPS_VIRTIO_INPUT_HOST,
            QEMU_CAPS_DEVICE_VIRTIO_GPU,
            QEMU_CAPS_VIRTIO_GPU_VIRGL,
            QEMU_CAPS_DEVICE_VIRTIO_RNG,
            QEMU_CAPS_OBJECT_RNG_RANDOM,
3022 3023 3024
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
            QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM,
            QEMU_CAPS_VIRTIO_PCI_ATS);
3025

J
Ján Tomko 已提交
3026
    DO_TEST("fd-memory-numa-topology", QEMU_CAPS_OBJECT_MEMORY_FILE,
3027
            QEMU_CAPS_KVM);
J
Ján Tomko 已提交
3028
    DO_TEST("fd-memory-numa-topology2", QEMU_CAPS_OBJECT_MEMORY_FILE,
3029
            QEMU_CAPS_KVM);
J
Ján Tomko 已提交
3030
    DO_TEST("fd-memory-numa-topology3", QEMU_CAPS_OBJECT_MEMORY_FILE,
3031 3032
            QEMU_CAPS_KVM);

J
Ján Tomko 已提交
3033
    DO_TEST("fd-memory-no-numa-topology", QEMU_CAPS_OBJECT_MEMORY_FILE,
3034 3035
            QEMU_CAPS_KVM);

M
Marc-André Lureau 已提交
3036 3037
    DO_TEST_CAPS_LATEST("memfd-memory-numa");

3038 3039 3040 3041 3042 3043 3044 3045
    DO_TEST("cpu-check-none", QEMU_CAPS_KVM);
    DO_TEST("cpu-check-partial", QEMU_CAPS_KVM);
    DO_TEST("cpu-check-full", QEMU_CAPS_KVM);
    DO_TEST("cpu-check-default-none", QEMU_CAPS_KVM);
    DO_TEST("cpu-check-default-none2", NONE);
    DO_TEST("cpu-check-default-partial", QEMU_CAPS_KVM);
    DO_TEST("cpu-check-default-partial2", QEMU_CAPS_KVM);

3046 3047 3048 3049 3050 3051 3052 3053 3054
    DO_TEST("cpu-cache-disable", QEMU_CAPS_KVM, QEMU_CAPS_CPU_CACHE);
    DO_TEST("cpu-cache-disable2", QEMU_CAPS_KVM);
    DO_TEST("cpu-cache-disable3", QEMU_CAPS_KVM, QEMU_CAPS_CPU_CACHE);
    DO_TEST("cpu-cache-passthrough", QEMU_CAPS_KVM, QEMU_CAPS_CPU_CACHE);
    DO_TEST("cpu-cache-passthrough2", QEMU_CAPS_KVM);
    DO_TEST("cpu-cache-emulate-l3", QEMU_CAPS_KVM, QEMU_CAPS_CPU_CACHE);
    DO_TEST_PARSE_ERROR("cpu-cache-emulate-l2", QEMU_CAPS_KVM);
    DO_TEST_PARSE_ERROR("cpu-cache-passthrough3", QEMU_CAPS_KVM);
    DO_TEST_PARSE_ERROR("cpu-cache-passthrough-l3", QEMU_CAPS_KVM);
M
Marc-André Lureau 已提交
3055
    DO_TEST("vmcoreinfo", QEMU_CAPS_DEVICE_VMCOREINFO);
3056

3057 3058 3059
    DO_TEST("user-aliases", QEMU_CAPS_KVM, QEMU_CAPS_DEVICE_CIRRUS_VGA,
            QEMU_CAPS_OBJECT_MEMORY_FILE, QEMU_CAPS_PIIX_DISABLE_S3,
            QEMU_CAPS_PIIX_DISABLE_S4, QEMU_CAPS_VNC,
3060
            QEMU_CAPS_DEVICE_ISA_SERIAL,
3061
            QEMU_CAPS_HDA_DUPLEX,
3062 3063
            QEMU_CAPS_CCID_EMULATED,
            QEMU_CAPS_QCOW2_LUKS, QEMU_CAPS_OBJECT_SECRET);
3064
    DO_TEST("user-aliases2", QEMU_CAPS_DEVICE_IOH3420, QEMU_CAPS_ICH9_AHCI);
3065 3066
    DO_TEST("user-aliases-usb", QEMU_CAPS_KVM,
            QEMU_CAPS_PIIX_DISABLE_S3, QEMU_CAPS_PIIX_DISABLE_S4,
3067
            QEMU_CAPS_ICH9_USB_EHCI1);
3068

3069
    DO_TEST_CAPS_VER("disk-virtio-scsi-reservations", "2.12.0");
3070
    DO_TEST_CAPS_LATEST("disk-virtio-scsi-reservations");
3071

3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096
    DO_TEST_CAPS_LATEST("tseg-explicit-size");
    DO_TEST_PARSE_ERROR("tseg-i440fx",
                        QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
                        QEMU_CAPS_DEVICE_PCI_BRIDGE,
                        QEMU_CAPS_DEVICE_IOH3420,
                        QEMU_CAPS_ICH9_AHCI,
                        QEMU_CAPS_MACHINE_SMM_OPT,
                        QEMU_CAPS_VIRTIO_SCSI,
                        QEMU_CAPS_MCH_EXTENDED_TSEG_MBYTES);
    DO_TEST_PARSE_ERROR("tseg-explicit-size",
                        QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
                        QEMU_CAPS_DEVICE_PCI_BRIDGE,
                        QEMU_CAPS_DEVICE_IOH3420,
                        QEMU_CAPS_ICH9_AHCI,
                        QEMU_CAPS_MACHINE_SMM_OPT,
                        QEMU_CAPS_VIRTIO_SCSI);
    DO_TEST_PARSE_ERROR("tseg-invalid-size",
                        QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
                        QEMU_CAPS_DEVICE_PCI_BRIDGE,
                        QEMU_CAPS_DEVICE_IOH3420,
                        QEMU_CAPS_ICH9_AHCI,
                        QEMU_CAPS_MACHINE_SMM_OPT,
                        QEMU_CAPS_VIRTIO_SCSI,
                        QEMU_CAPS_MCH_EXTENDED_TSEG_MBYTES);

3097
    DO_TEST("video-virtio-gpu-ccw", QEMU_CAPS_CCW,
3098 3099 3100 3101 3102 3103
            QEMU_CAPS_DEVICE_VIRTIO_GPU,
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
            QEMU_CAPS_VIRTIO_GPU_MAX_OUTPUTS,
            QEMU_CAPS_VNC,
            QEMU_CAPS_DEVICE_VIRTIO_GPU_CCW);

3104
    DO_TEST("input-virtio-ccw", QEMU_CAPS_CCW,
3105 3106 3107 3108 3109 3110 3111
            QEMU_CAPS_VIRTIO_KEYBOARD,
            QEMU_CAPS_VIRTIO_MOUSE,
            QEMU_CAPS_VIRTIO_TABLET,
            QEMU_CAPS_DEVICE_VIRTIO_KEYBOARD_CCW,
            QEMU_CAPS_DEVICE_VIRTIO_MOUSE_CCW,
            QEMU_CAPS_DEVICE_VIRTIO_TABLET_CCW);

3112 3113
    DO_TEST_CAPS_LATEST("vhost-vsock");
    DO_TEST_CAPS_LATEST("vhost-vsock-auto");
3114 3115
    DO_TEST_CAPS_ARCH_LATEST("vhost-vsock-ccw", "s390x");
    DO_TEST_CAPS_ARCH_LATEST("vhost-vsock-ccw-auto", "s390x");
3116

3117
    DO_TEST_CAPS_VER("launch-security-sev", "2.12.0");
3118

L
Lubomir Rintel 已提交
3119 3120
    DO_TEST("riscv64-virt",
            QEMU_CAPS_DEVICE_VIRTIO_MMIO);
3121 3122
    DO_TEST("riscv64-virt-pci",
            QEMU_CAPS_OBJECT_GPEX);
L
Lubomir Rintel 已提交
3123

3124 3125 3126 3127 3128
    /* Older version checks disable-legacy usage */
    DO_TEST_CAPS_VER("virtio-transitional", "3.1.0");
    DO_TEST_CAPS_VER("virtio-non-transitional", "3.1.0");
    DO_TEST_CAPS_LATEST("virtio-transitional");
    DO_TEST_CAPS_LATEST("virtio-non-transitional");
3129 3130 3131 3132
    DO_TEST_PARSE_ERROR("virtio-transitional-not-supported",
                        QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
                        QEMU_CAPS_DEVICE_PCI_BRIDGE,
                        QEMU_CAPS_DEVICE_IOH3420);
3133

3134 3135 3136 3137 3138 3139 3140 3141
    /* Simple headless guests for various architectures */
    DO_TEST_CAPS_ARCH_LATEST("aarch64-virt-headless", "aarch64");
    DO_TEST_CAPS_ARCH_LATEST("ppc64-pseries-headless", "ppc64");
    DO_TEST_CAPS_ARCH_LATEST("riscv64-virt-headless", "riscv64");
    DO_TEST_CAPS_ARCH_LATEST("s390x-ccw-headless", "s390x");
    DO_TEST_CAPS_ARCH_LATEST("x86_64-pc-headless", "x86_64");
    DO_TEST_CAPS_ARCH_LATEST("x86_64-q35-headless", "x86_64");

3142 3143 3144
    /* Simple guests with graphics for various architectures */
    DO_TEST_CAPS_ARCH_LATEST("aarch64-virt-graphics", "aarch64");
    DO_TEST_CAPS_ARCH_LATEST("ppc64-pseries-graphics", "ppc64");
3145
    DO_TEST_CAPS_ARCH_LATEST("s390x-ccw-graphics", "s390x");
3146 3147 3148
    DO_TEST_CAPS_ARCH_LATEST("x86_64-pc-graphics", "x86_64");
    DO_TEST_CAPS_ARCH_LATEST("x86_64-q35-graphics", "x86_64");

3149 3150 3151 3152 3153
    DO_TEST_CAPS_LATEST("os-firmware-bios");
    DO_TEST_CAPS_LATEST("os-firmware-efi");
    DO_TEST_CAPS_LATEST("os-firmware-efi-secboot");
    DO_TEST_CAPS_ARCH_LATEST("aarch64-os-firmware-efi", "aarch64");

A
Andrea Bolognani 已提交
3154 3155 3156
    if (getenv("LIBVIRT_SKIP_CLEANUP") == NULL)
        virFileDeleteTree(fakerootdir);

3157
    VIR_FREE(driver.config->nbdTLSx509certdir);
3158
    qemuTestDriverFree(&driver);
A
Andrea Bolognani 已提交
3159
    VIR_FREE(fakerootdir);
3160
    virHashFree(capslatest);
3161
    virFileWrapperClearPrefixes();
3162

3163
    return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
3164 3165
}

3166
VIR_TEST_MAIN_PRELOAD(mymain,
A
Andrea Bolognani 已提交
3167 3168 3169 3170
                      abs_builddir "/.libs/qemuxml2argvmock.so",
                      abs_builddir "/.libs/virrandommock.so",
                      abs_builddir "/.libs/qemucpumock.so",
                      abs_builddir "/.libs/virpcimock.so")
3171

3172 3173
#else

3174 3175 3176 3177
int main(void)
{
    return EXIT_AM_SKIP;
}
3178 3179

#endif /* WITH_QEMU */