qemuxml2argvtest.c 117.7 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
typedef enum {
    ARG_QEMU_CAPS,
610
    ARG_GIC,
611 612
    ARG_MIGRATE_FROM,
    ARG_MIGRATE_FD,
613
    ARG_FLAGS,
614
    ARG_PARSEFLAGS,
615 616 617 618 619 620 621 622 623 624 625 626 627 628 629

    /* 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;

630 631 632 633
static int
testInfoSetArgs(struct testInfo *info, ...)
{
    va_list argptr;
634
    testInfoArgName argname;
635 636
    virQEMUCapsPtr qemuCaps = NULL;
    int gic = GIC_NONE;
637
    int ret = -1;
638 639

    va_start(argptr, info);
640 641 642
    while ((argname = va_arg(argptr, testInfoArgName)) < ARG_END) {
        switch (argname) {
        case ARG_QEMU_CAPS:
643 644 645
            if (qemuCaps || !(qemuCaps = virQEMUCapsNew()))
                goto cleanup;
            virQEMUCapsSetVAList(qemuCaps, argptr);
646 647
            break;

648
        case ARG_GIC:
649
            gic = va_arg(argptr, int);
650 651
            break;

652 653 654 655 656 657 658 659
        case ARG_MIGRATE_FROM:
            info->migrateFrom = va_arg(argptr, char *);
            break;

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

660 661 662 663
        case ARG_FLAGS:
            info->flags = va_arg(argptr, int);
            break;

664 665 666 667
        case ARG_PARSEFLAGS:
            info->parseFlags = va_arg(argptr, int);
            break;

668 669 670 671 672 673 674
        case ARG_END:
        default:
            fprintf(stderr, "Unexpected test info argument");
            goto cleanup;
        }
    }

675 676 677 678 679 680 681 682 683 684 685
    if (!info->qemuCaps) {
        if (!qemuCaps) {
            fprintf(stderr, "No qemuCaps generated\n");
            goto cleanup;
        }
        VIR_STEAL_PTR(info->qemuCaps, qemuCaps);
    }

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

686 687 688
    ret = 0;

 cleanup:
689
    virObjectUnref(qemuCaps);
690 691 692 693 694
    va_end(argptr);

    return ret;
}

695 696 697 698 699 700
static void
testInfoClear(struct testInfo *info)
{
    virObjectUnref(info->qemuCaps);
}

A
Andrea Bolognani 已提交
701
# define FAKEROOTDIRTEMPLATE abs_builddir "/fakerootdir-XXXXXX"
702

703
static int
E
Eric Blake 已提交
704
mymain(void)
705
{
706
    int ret = 0, i;
A
Andrea Bolognani 已提交
707
    char *fakerootdir;
708 709 710 711 712 713 714
    const char *archs[] = {
        "aarch64",
        "ppc64",
        "riscv64",
        "s390x",
        "x86_64",
    };
715
    virHashTablePtr capslatest = NULL;
716

A
Andrea Bolognani 已提交
717 718 719 720 721 722 723 724 725 726 727 728
    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);

729 730 731 732 733 734 735 736 737 738
    /* 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;
    }

739
    if (qemuTestDriverInit(&driver) < 0)
740
        return EXIT_FAILURE;
741 742

    driver.privileged = true;
743

744 745 746
    VIR_FREE(driver.config->defaultTLSx509certdir);
    if (VIR_STRDUP_QUIET(driver.config->defaultTLSx509certdir, "/etc/pki/qemu") < 0)
        return EXIT_FAILURE;
747
    VIR_FREE(driver.config->vncTLSx509certdir);
748
    if (VIR_STRDUP_QUIET(driver.config->vncTLSx509certdir, "/etc/pki/libvirt-vnc") < 0)
749 750
        return EXIT_FAILURE;
    VIR_FREE(driver.config->spiceTLSx509certdir);
751
    if (VIR_STRDUP_QUIET(driver.config->spiceTLSx509certdir, "/etc/pki/libvirt-spice") < 0)
752
        return EXIT_FAILURE;
753 754 755
    VIR_FREE(driver.config->chardevTLSx509certdir);
    if (VIR_STRDUP_QUIET(driver.config->chardevTLSx509certdir, "/etc/pki/libvirt-chardev") < 0)
        return EXIT_FAILURE;
756
    VIR_FREE(driver.config->vxhsTLSx509certdir);
757
    if (VIR_STRDUP_QUIET(driver.config->vxhsTLSx509certdir, "/etc/pki/libvirt-vxhs/dummy,path") < 0)
758
        return EXIT_FAILURE;
759 760 761
    VIR_FREE(driver.config->nbdTLSx509certdir);
    if (VIR_STRDUP_QUIET(driver.config->nbdTLSx509certdir, "/etc/pki/libvirt-nbd/dummy,path") < 0)
        return EXIT_FAILURE;
762

763
    VIR_FREE(driver.config->hugetlbfs);
764
    if (VIR_ALLOC_N(driver.config->hugetlbfs, 2) < 0)
765
        return EXIT_FAILURE;
766 767 768
    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)
769
        return EXIT_FAILURE;
770 771
    driver.config->hugetlbfs[0].size = 2048;
    driver.config->hugetlbfs[0].deflt = true;
772
    driver.config->hugetlbfs[1].size = 1048576;
773
    driver.config->spiceTLS = 1;
774
    if (VIR_STRDUP_QUIET(driver.config->spicePassword, "123456") < 0)
775
        return EXIT_FAILURE;
776 777 778
    VIR_FREE(driver.config->memoryBackingDir);
    if (VIR_STRDUP_QUIET(driver.config->memoryBackingDir, "/var/lib/libvirt/qemu/ram") < 0)
        return EXIT_FAILURE;
779 780 781
    VIR_FREE(driver.config->nvramDir);
    if (VIR_STRDUP(driver.config->nvramDir, "/var/lib/libvirt/qemu/nvram") < 0)
        return EXIT_FAILURE;
782

783 784
    capslatest = virHashCreate(4, virHashValueFree);
    if (!capslatest)
785 786
        return EXIT_FAILURE;

787
    VIR_TEST_VERBOSE("\n");
788

789 790 791 792 793 794 795 796 797 798 799
    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");
800

801 802 803 804 805 806 807
    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");

808 809 810 811 812 813 814 815 816 817 818 819 820 821
/**
 * 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.
 */
822
# define TEST_CAPS_PATH abs_srcdir "/qemucapabilitiesdata"
823 824

# define DO_TEST_CAPS_INTERNAL(_name, arch, ver, ...) \
825 826
    do { \
        static struct testInfo info = { \
827
            .name = _name, \
828
            .suffix = "." arch "-" ver, \
829
        }; \
830
        static const char *capsfile = TEST_CAPS_PATH "/caps_" ver "." arch ".xml"; \
831 832 833 834 835
        static bool stripmachinealiases; \
        if (STREQ(ver, "latest")) { \
            capsfile = virHashLookup(capslatest, arch); \
            stripmachinealiases = true; \
        } \
836 837 838
        if (!(info.qemuCaps = qemuTestParseCapabilitiesArch(virArchFromString(arch), \
                                                            capsfile))) \
            return EXIT_FAILURE; \
839 840
        if (stripmachinealiases) \
            virQEMUCapsStripMachineAliases(info.qemuCaps); \
841 842 843
        if (testInfoSetArgs(&info, __VA_ARGS__, ARG_END) < 0) \
            return EXIT_FAILURE; \
        info.flags |= FLAG_REAL_CAPS; \
844
        if (virTestRun("QEMU XML-2-ARGV " _name "." arch "-" ver, \
845 846
                       testCompareXMLToArgv, &info) < 0) \
            ret = -1; \
847
        testInfoClear(&info); \
848 849
    } while (0)

850
# define DO_TEST_CAPS_ARCH_VER(name, arch, ver) \
851
    DO_TEST_CAPS_INTERNAL(name, arch, ver, ARG_END)
852 853

# define DO_TEST_CAPS_VER(name, ver) \
854
    DO_TEST_CAPS_ARCH_VER(name, "x86_64", ver)
855

856
# define DO_TEST_CAPS_ARCH_LATEST_FULL(name, arch, ...) \
857
    DO_TEST_CAPS_INTERNAL(name, arch, "latest", __VA_ARGS__)
858

859
# define DO_TEST_CAPS_ARCH_LATEST(name, arch) \
860
    DO_TEST_CAPS_ARCH_LATEST_FULL(name, arch, ARG_END)
861

862
# define DO_TEST_CAPS_LATEST(name) \
863
    DO_TEST_CAPS_ARCH_LATEST(name, "x86_64")
864

865
# define DO_TEST_CAPS_LATEST_FAILURE(name) \
866 867
    DO_TEST_CAPS_ARCH_LATEST_FULL(name, "x86_64", \
                                  ARG_FLAGS, FLAG_EXPECT_FAILURE)
868 869

# define DO_TEST_CAPS_LATEST_PARSE_ERROR(name) \
870 871
    DO_TEST_CAPS_ARCH_LATEST_FULL(name, "x86_64", \
                                  ARG_FLAGS, FLAG_EXPECT_PARSE_ERROR)
872

873

874
# define DO_TEST_FULL(_name, ...) \
875 876
    do { \
        static struct testInfo info = { \
877
            .name = _name, \
878
        }; \
879
        if (testInfoSetArgs(&info, __VA_ARGS__, QEMU_CAPS_LAST, ARG_END) < 0) \
880
            return EXIT_FAILURE; \
881
        if (virTestRun("QEMU XML-2-ARGV " _name, \
882 883
                       testCompareXMLToArgv, &info) < 0) \
            ret = -1; \
884
        testInfoClear(&info); \
885 886
    } while (0)

887 888 889
/* All the following macros require an explicit QEMU_CAPS_* list
 * at the end of the argument list, or the NONE placeholder.
 * */
890
# define DO_TEST(name, ...) \
891
    DO_TEST_FULL(name, \
892
                 ARG_QEMU_CAPS, __VA_ARGS__)
893

894
# define DO_TEST_GIC(name, gic, ...) \
895
    DO_TEST_FULL(name, \
896
                 ARG_GIC, gic, \
897
                 ARG_QEMU_CAPS, __VA_ARGS__)
898

899
# define DO_TEST_FAILURE(name, ...) \
900 901
    DO_TEST_FULL(name, \
                 ARG_FLAGS, FLAG_EXPECT_FAILURE, \
902
                 ARG_QEMU_CAPS, __VA_ARGS__)
903

904
# define DO_TEST_PARSE_ERROR(name, ...) \
905
    DO_TEST_FULL(name, \
906
                 ARG_FLAGS, FLAG_EXPECT_PARSE_ERROR | FLAG_EXPECT_FAILURE, \
907
                 ARG_QEMU_CAPS, __VA_ARGS__)
908

909
# define NONE QEMU_CAPS_LAST
910

911 912 913
    /* 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 */
914 915 916 917 918 919 920
    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");
921 922
    unsetenv("QEMU_AUDIO_DRV");
    unsetenv("SDL_AUDIODRIVER");
923

924
    DO_TEST("minimal", NONE);
925 926
    DO_TEST("minimal-sandbox",
            QEMU_CAPS_SECCOMP_BLACKLIST);
927
    DO_TEST_PARSE_ERROR("minimal-no-memory", NONE);
928
    DO_TEST("minimal-msg-timestamp", QEMU_CAPS_MSG_TIMESTAMP);
929 930 931 932

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

933
    DO_TEST("machine-aliases1", NONE);
934
    DO_TEST("machine-aliases2", QEMU_CAPS_KVM);
935
    DO_TEST("machine-core-on", NONE);
936
    driver.config->dumpGuestCore = true;
937
    DO_TEST("machine-core-off", NONE);
938
    driver.config->dumpGuestCore = false;
M
Michal Privoznik 已提交
939 940 941
    DO_TEST("machine-smm-opt",
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
942
            QEMU_CAPS_DEVICE_IOH3420,
M
Michal Privoznik 已提交
943 944 945
            QEMU_CAPS_ICH9_AHCI,
            QEMU_CAPS_MACHINE_SMM_OPT,
            QEMU_CAPS_VIRTIO_SCSI);
946
    DO_TEST("machine-vmport-opt",
947
            QEMU_CAPS_MACHINE_VMPORT_OPT);
948 949 950
    DO_TEST("default-kvm-host-arch", NONE);
    DO_TEST("default-qemu-host-arch", NONE);
    DO_TEST("x86-kvm-32-on-64", NONE);
951 952 953
    DO_TEST("boot-cdrom", NONE);
    DO_TEST("boot-network", NONE);
    DO_TEST("boot-floppy", NONE);
954
    DO_TEST("boot-floppy-q35",
955
            QEMU_CAPS_DEVICE_IOH3420,
956
            QEMU_CAPS_ICH9_AHCI);
J
Ján Tomko 已提交
957 958
    DO_TEST("boot-multi", NONE);
    DO_TEST("boot-menu-enable", NONE);
959
    DO_TEST("boot-menu-enable-with-timeout",
960
            QEMU_CAPS_SPLASH_TIMEOUT);
J
Ján Tomko 已提交
961
    DO_TEST_FAILURE("boot-menu-enable-with-timeout", NONE);
962
    DO_TEST_PARSE_ERROR("boot-menu-enable-with-timeout-invalid", NONE);
J
Ján Tomko 已提交
963 964
    DO_TEST("boot-menu-disable", NONE);
    DO_TEST("boot-menu-disable-drive", NONE);
965
    DO_TEST_PARSE_ERROR("boot-dev+order",
966
            QEMU_CAPS_VIRTIO_BLK_SCSI);
967
    DO_TEST("boot-order",
968
            QEMU_CAPS_VIRTIO_BLK_SCSI);
969
    DO_TEST("boot-complex",
970
            QEMU_CAPS_VIRTIO_BLK_SCSI);
971
    DO_TEST("boot-strict",
972
            QEMU_CAPS_BOOT_STRICT,
973
            QEMU_CAPS_VIRTIO_BLK_SCSI);
974 975 976 977 978

    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);

979
    DO_TEST("bios",
980
            QEMU_CAPS_DEVICE_ISA_SERIAL,
981
            QEMU_CAPS_SGA);
J
Ján Tomko 已提交
982
    DO_TEST("bios-nvram", NONE);
M
Michal Privoznik 已提交
983 984 985
    DO_TEST("bios-nvram-secure",
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
986
            QEMU_CAPS_DEVICE_IOH3420,
M
Michal Privoznik 已提交
987 988 989
            QEMU_CAPS_ICH9_AHCI,
            QEMU_CAPS_MACHINE_SMM_OPT,
            QEMU_CAPS_VIRTIO_SCSI);
990 991 992 993 994 995 996

    /* 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);

997
    DO_TEST("clock-utc", NONE);
998
    DO_TEST("clock-localtime", NONE);
J
Ján Tomko 已提交
999 1000 1001 1002
    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 已提交
1003
    DO_TEST("clock-catchup", QEMU_CAPS_KVM_PIT_TICK_POLICY);
1004 1005
    DO_TEST("cpu-kvmclock", NONE);
    DO_TEST("cpu-host-kvmclock", NONE);
1006
    DO_TEST("kvmclock", QEMU_CAPS_KVM);
1007
    DO_TEST("clock-timer-hyperv-rtc", QEMU_CAPS_KVM);
1008

1009 1010
    DO_TEST("cpu-eoi-disabled", NONE);
    DO_TEST("cpu-eoi-enabled", NONE);
J
Ján Tomko 已提交
1011
    DO_TEST("controller-order",
1012 1013 1014 1015 1016 1017
            QEMU_CAPS_KVM,
            QEMU_CAPS_PIIX3_USB_UHCI,
            QEMU_CAPS_CCID_PASSTHRU,
            QEMU_CAPS_SPICE,
            QEMU_CAPS_HDA_DUPLEX,
            QEMU_CAPS_USB_HUB,
1018
            QEMU_CAPS_DEVICE_ISA_SERIAL,
1019
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
1020 1021
    DO_TEST("eoi-disabled", NONE);
    DO_TEST("eoi-enabled", NONE);
1022 1023
    DO_TEST("pv-spinlock-disabled", NONE);
    DO_TEST("pv-spinlock-enabled", NONE);
1024
    DO_TEST("kvmclock+eoi-disabled", NONE);
1025

1026
    DO_TEST("hyperv", NONE);
1027
    DO_TEST("hyperv-off", NONE);
1028
    DO_TEST("hyperv-panic", NONE);
1029

1030 1031 1032
    DO_TEST("kvm-features", NONE);
    DO_TEST("kvm-features-off", NONE);

1033 1034 1035
    DO_TEST("pmu-feature", NONE);
    DO_TEST("pmu-feature-off", NONE);

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

1262 1263 1264
    DO_TEST("graphics-egl-headless",
            QEMU_CAPS_EGL_HEADLESS,
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
1265 1266
    DO_TEST_CAPS_LATEST("graphics-egl-headless");
    DO_TEST_CAPS_LATEST("graphics-egl-headless-rendernode");
1267

1268 1269
    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);
1270 1271
    DO_TEST("graphics-vnc-websocket",
            QEMU_CAPS_VNC,
1272
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
1273
    DO_TEST("graphics-vnc-policy", QEMU_CAPS_VNC,
1274 1275 1276 1277 1278
            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);
1279
    driver.config->vncAutoUnixSocket = true;
1280 1281
    DO_TEST("graphics-vnc-auto-socket-cfg", QEMU_CAPS_VNC,
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
1282
    driver.config->vncAutoUnixSocket = false;
1283 1284 1285 1286
    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);
1287 1288
    DO_TEST("graphics-vnc-socket-new-cmdline", QEMU_CAPS_VNC,
            QEMU_CAPS_DEVICE_CIRRUS_VGA, QEMU_CAPS_VNC_MULTI_SERVERS);
1289

1290 1291
    driver.config->vncSASL = 1;
    VIR_FREE(driver.config->vncSASLdir);
1292
    ignore_value(VIR_STRDUP(driver.config->vncSASLdir, "/root/.sasl2"));
1293
    DO_TEST("graphics-vnc-sasl", QEMU_CAPS_VNC, QEMU_CAPS_DEVICE_CIRRUS_VGA);
1294 1295
    driver.config->vncTLS = 1;
    driver.config->vncTLSx509verify = 1;
1296
    DO_TEST("graphics-vnc-tls", QEMU_CAPS_VNC, QEMU_CAPS_DEVICE_CIRRUS_VGA);
1297 1298
    DO_TEST_CAPS_VER("graphics-vnc-tls", "2.4.0");
    DO_TEST_CAPS_LATEST("graphics-vnc-tls");
1299 1300 1301 1302 1303
    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);
1304
    driver.config->vncSASL = driver.config->vncTLSx509verify = driver.config->vncTLS = 0;
1305 1306
    VIR_FREE(driver.config->vncSASLdir);
    VIR_FREE(driver.config->vncTLSx509certdir);
1307 1308 1309 1310
    DO_TEST("graphics-vnc-egl-headless",
            QEMU_CAPS_VNC,
            QEMU_CAPS_EGL_HEADLESS,
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
1311

J
Ján Tomko 已提交
1312 1313
    DO_TEST("graphics-sdl",
            QEMU_CAPS_DEVICE_VGA);
1314
    DO_TEST_CAPS_LATEST_PARSE_ERROR("graphics-sdl-egl-headless");
J
Ján Tomko 已提交
1315
    DO_TEST("graphics-sdl-fullscreen",
1316
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
1317
    DO_TEST("graphics-spice",
1318
            QEMU_CAPS_SPICE,
1319 1320
            QEMU_CAPS_DEVICE_QXL,
            QEMU_CAPS_SPICE_FILE_XFER_DISABLE);
1321
    DO_TEST("graphics-spice-no-args",
1322
            QEMU_CAPS_SPICE, QEMU_CAPS_DEVICE_CIRRUS_VGA);
1323 1324 1325
    driver.config->spiceSASL = 1;
    ignore_value(VIR_STRDUP(driver.config->spiceSASLdir, "/root/.sasl2"));
    DO_TEST("graphics-spice-sasl",
1326
            QEMU_CAPS_SPICE,
1327 1328 1329
            QEMU_CAPS_DEVICE_QXL);
    VIR_FREE(driver.config->spiceSASLdir);
    driver.config->spiceSASL = 0;
1330
    DO_TEST("graphics-spice-agentmouse",
1331
            QEMU_CAPS_DEVICE_QXL,
1332
            QEMU_CAPS_SPICE,
1333
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
1334
    DO_TEST("graphics-spice-compression",
1335
            QEMU_CAPS_SPICE,
1336
            QEMU_CAPS_DEVICE_QXL);
1337
    DO_TEST("graphics-spice-timeout",
1338
            QEMU_CAPS_KVM,
1339
            QEMU_CAPS_SPICE,
1340 1341
            QEMU_CAPS_DEVICE_QXL,
            QEMU_CAPS_DEVICE_VGA);
1342
    DO_TEST("graphics-spice-qxl-vga",
1343
            QEMU_CAPS_SPICE,
1344
            QEMU_CAPS_DEVICE_QXL);
1345
    DO_TEST("graphics-spice-usb-redir",
1346
            QEMU_CAPS_SPICE,
1347 1348 1349 1350
            QEMU_CAPS_USB_HUB,
            QEMU_CAPS_ICH9_USB_EHCI1,
            QEMU_CAPS_USB_REDIR,
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
1351
    DO_TEST("graphics-spice-agent-file-xfer",
1352
            QEMU_CAPS_SPICE,
1353 1354
            QEMU_CAPS_DEVICE_QXL,
            QEMU_CAPS_SPICE_FILE_XFER_DISABLE);
1355 1356
    DO_TEST("graphics-spice-socket",
            QEMU_CAPS_SPICE,
1357 1358
            QEMU_CAPS_SPICE_UNIX,
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
1359 1360
    DO_TEST("graphics-spice-auto-socket",
            QEMU_CAPS_SPICE,
1361 1362
            QEMU_CAPS_SPICE_UNIX,
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
1363 1364 1365
    driver.config->spiceAutoUnixSocket = true;
    DO_TEST("graphics-spice-auto-socket-cfg",
            QEMU_CAPS_SPICE,
1366 1367
            QEMU_CAPS_SPICE_UNIX,
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
1368
    driver.config->spiceAutoUnixSocket = false;
1369 1370 1371 1372
    DO_TEST("graphics-spice-egl-headless",
            QEMU_CAPS_SPICE,
            QEMU_CAPS_EGL_HEADLESS,
            QEMU_CAPS_DEVICE_QXL);
1373
    DO_TEST_CAPS_LATEST_PARSE_ERROR("graphics-spice-invalid-egl-headless");
1374
    DO_TEST_CAPS_LATEST("graphics-spice-gl-auto-rendernode");
1375

1376 1377 1378
    DO_TEST("input-usbmouse", NONE);
    DO_TEST("input-usbtablet", NONE);
    DO_TEST("misc-acpi", NONE);
1379 1380 1381
    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);
1382
    DO_TEST_FAILURE("misc-enable-s4", NONE);
1383
    DO_TEST("misc-no-reboot", NONE);
1384
    DO_TEST("misc-uuid", NONE);
1385
    DO_TEST_PARSE_ERROR("vhost_queues-invalid", NONE);
1386
    DO_TEST("net-vhostuser", QEMU_CAPS_CHARDEV_FD_PASS);
1387 1388
    DO_TEST_CAPS_VER("net-vhostuser", "2.5.0");
    DO_TEST_CAPS_LATEST("net-vhostuser");
1389
    DO_TEST("net-vhostuser-multiq",
J
Ján Tomko 已提交
1390 1391
            QEMU_CAPS_VHOSTUSER_MULTIQUEUE);
    DO_TEST_FAILURE("net-vhostuser-multiq", NONE);
1392 1393
    DO_TEST_FAILURE("net-vhostuser-fail",
                    QEMU_CAPS_VHOSTUSER_MULTIQUEUE);
1394
    DO_TEST("net-user", NONE);
J
Ján Tomko 已提交
1395
    DO_TEST("net-user-addr", NONE);
1396 1397
    DO_TEST("net-virtio", NONE);
    DO_TEST("net-virtio-device",
1398 1399 1400
            QEMU_CAPS_VIRTIO_TX_ALG);
    DO_TEST("net-virtio-disable-offloads", NONE);
    DO_TEST("net-virtio-netdev", NONE);
1401
    DO_TEST("net-virtio-s390",
1402
            QEMU_CAPS_VIRTIO_S390);
1403
    DO_TEST("net-virtio-ccw",
1404
            QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
1405 1406 1407
    DO_TEST("net-virtio-rxtxqueuesize",
            QEMU_CAPS_VIRTIO_NET_RX_QUEUE_SIZE,
            QEMU_CAPS_VIRTIO_NET_TX_QUEUE_SIZE);
1408
    DO_TEST_PARSE_ERROR("net-virtio-rxqueuesize-invalid-size", NONE);
1409 1410
    DO_TEST("net-eth", NONE);
    DO_TEST("net-eth-ifname", NONE);
1411
    DO_TEST("net-eth-names", NONE);
1412
    DO_TEST("net-eth-hostip", NONE);
1413 1414 1415
    DO_TEST("net-client", NONE);
    DO_TEST("net-server", NONE);
    DO_TEST("net-mcast", NONE);
1416
    DO_TEST("net-udp", NONE);
1417
    DO_TEST("net-hostdev", NONE);
1418
    DO_TEST("net-hostdev-bootorder", NONE);
1419
    DO_TEST("net-hostdev-multidomain", NONE);
1420 1421
    DO_TEST("net-hostdev-vfio",
            QEMU_CAPS_DEVICE_VFIO_PCI);
1422
    DO_TEST("net-hostdev-vfio-multidomain",
1423
            QEMU_CAPS_DEVICE_VFIO_PCI);
1424 1425 1426
    DO_TEST_FAILURE("net-hostdev-fail",
                    QEMU_CAPS_DEVICE_VFIO_PCI);

1427

1428 1429
    DO_TEST("serial-file-log",
            QEMU_CAPS_CHARDEV_FILE_APPEND,
1430
            QEMU_CAPS_DEVICE_ISA_SERIAL,
1431
            QEMU_CAPS_CHARDEV_LOGFILE);
1432
    DO_TEST("serial-spiceport",
1433
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
1434
            QEMU_CAPS_DEVICE_QXL,
1435
            QEMU_CAPS_SPICE,
1436
            QEMU_CAPS_DEVICE_ISA_SERIAL);
1437
    DO_TEST("serial-spiceport-nospice", NONE);
1438

1439 1440 1441 1442
    DO_TEST("console-compat",
            QEMU_CAPS_DEVICE_ISA_SERIAL);
    DO_TEST("console-compat-auto",
            QEMU_CAPS_DEVICE_ISA_SERIAL);
1443 1444

    DO_TEST("serial-vc-chardev",
1445
            QEMU_CAPS_DEVICE_ISA_SERIAL);
1446
    DO_TEST("serial-pty-chardev",
1447
            QEMU_CAPS_DEVICE_ISA_SERIAL);
1448
    DO_TEST("serial-dev-chardev",
1449
            QEMU_CAPS_DEVICE_ISA_SERIAL);
1450
    DO_TEST("serial-dev-chardev-iobase",
1451
            QEMU_CAPS_DEVICE_ISA_SERIAL);
1452
    DO_TEST("serial-file-chardev",
1453
            QEMU_CAPS_DEVICE_ISA_SERIAL,
1454
            QEMU_CAPS_CHARDEV_FILE_APPEND);
1455
    DO_TEST("serial-unix-chardev",
1456
            QEMU_CAPS_DEVICE_ISA_SERIAL);
1457
    DO_TEST_CAPS_LATEST("serial-unix-chardev");
1458
    DO_TEST_PARSE_ERROR("serial-unix-missing-source", NONE);
1459
    DO_TEST("serial-tcp-chardev",
1460
            QEMU_CAPS_DEVICE_ISA_SERIAL);
1461
    DO_TEST("serial-udp-chardev",
1462
            QEMU_CAPS_DEVICE_ISA_SERIAL);
1463
    DO_TEST("serial-tcp-telnet-chardev",
1464
            QEMU_CAPS_DEVICE_ISA_SERIAL);
1465 1466
    driver.config->chardevTLS = 1;
    DO_TEST("serial-tcp-tlsx509-chardev",
1467
            QEMU_CAPS_DEVICE_ISA_SERIAL,
1468
            QEMU_CAPS_OBJECT_TLS_CREDS_X509);
1469 1470
    driver.config->chardevTLSx509verify = 1;
    DO_TEST("serial-tcp-tlsx509-chardev-verify",
1471
            QEMU_CAPS_DEVICE_ISA_SERIAL,
1472 1473
            QEMU_CAPS_OBJECT_TLS_CREDS_X509);
    driver.config->chardevTLSx509verify = 0;
1474
    DO_TEST("serial-tcp-tlsx509-chardev-notls",
1475
            QEMU_CAPS_DEVICE_ISA_SERIAL,
1476
            QEMU_CAPS_OBJECT_TLS_CREDS_X509);
1477 1478 1479 1480 1481 1482 1483 1484
    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,
1485
            QEMU_CAPS_DEVICE_ISA_SERIAL,
1486
            QEMU_CAPS_OBJECT_TLS_CREDS_X509);
1487 1488
    driver.config->chardevTLS = 0;
    VIR_FREE(driver.config->chardevTLSx509certdir);
1489
    DO_TEST("serial-many-chardev",
1490 1491 1492
            QEMU_CAPS_DEVICE_ISA_SERIAL);
    DO_TEST("parallel-tcp-chardev", NONE);
    DO_TEST("parallel-parport-chardev", NONE);
J
Ján Tomko 已提交
1493 1494
    DO_TEST_CAPS_VER("parallel-unix-chardev", "2.5.0");
    DO_TEST_CAPS_LATEST("parallel-unix-chardev");
1495
    DO_TEST("console-compat-chardev",
1496
            QEMU_CAPS_DEVICE_ISA_SERIAL);
M
Michal Privoznik 已提交
1497 1498
    DO_TEST("pci-serial-dev-chardev",
            QEMU_CAPS_DEVICE_PCI_SERIAL);
1499

1500
    DO_TEST("channel-guestfwd", NONE);
J
Ján Tomko 已提交
1501 1502
    DO_TEST_CAPS_VER("channel-unix-guestfwd", "2.5.0");
    DO_TEST_CAPS_LATEST("channel-unix-guestfwd");
1503 1504 1505 1506 1507 1508
    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);
1509
    DO_TEST("console-virtio-many",
1510
            QEMU_CAPS_DEVICE_ISA_SERIAL);
1511
    DO_TEST("console-virtio-s390",
1512
            QEMU_CAPS_VIRTIO_S390);
1513
    DO_TEST("console-virtio-ccw",
1514
            QEMU_CAPS_CCW,
1515
            QEMU_CAPS_VIRTIO_S390);
J
Ján Tomko 已提交
1516 1517
    DO_TEST_CAPS_VER("console-virtio-unix", "2.5.0");
    DO_TEST_CAPS_LATEST("console-virtio-unix");
1518
    DO_TEST("console-sclp",
1519
            QEMU_CAPS_VIRTIO_S390,
1520
            QEMU_CAPS_DEVICE_SCLPCONSOLE);
1521
    DO_TEST("channel-spicevmc",
1522
            QEMU_CAPS_SPICE,
1523
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
1524
    DO_TEST("channel-virtio-default",
1525
            QEMU_CAPS_SPICE);
1526
    DO_TEST("channel-virtio-unix", NONE);
1527

1528
    DO_TEST("smartcard-host",
1529
            QEMU_CAPS_CCID_EMULATED);
1530
    DO_TEST("smartcard-host-certificates",
1531
            QEMU_CAPS_CCID_EMULATED);
1532 1533
    DO_TEST("smartcard-host-certificates-database",
            QEMU_CAPS_CCID_EMULATED);
1534
    DO_TEST("smartcard-passthrough-tcp",
1535
            QEMU_CAPS_CCID_PASSTHRU);
1536
    DO_TEST("smartcard-passthrough-spicevmc",
1537
            QEMU_CAPS_CCID_PASSTHRU);
1538
    DO_TEST("smartcard-controller",
1539
            QEMU_CAPS_CCID_EMULATED);
J
Ján Tomko 已提交
1540 1541
    DO_TEST_CAPS_VER("smartcard-passthrough-unix", "2.5.0");
    DO_TEST_CAPS_LATEST("smartcard-passthrough-unix");
1542

1543 1544 1545 1546 1547 1548 1549 1550
    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);
1551 1552
    DO_TEST_PARSE_ERROR("chardev-reconnect-generated-path",
                        QEMU_CAPS_CHARDEV_RECONNECT);
1553

1554
    DO_TEST("usb-controller", NONE);
1555
    DO_TEST("usb-piix3-controller",
1556
            QEMU_CAPS_PIIX3_USB_UHCI);
1557
    DO_TEST("usb-ich9-ehci-addr",
1558
            QEMU_CAPS_ICH9_USB_EHCI1);
1559
    DO_TEST("input-usbmouse-addr", NONE);
1560
    DO_TEST("usb-ich9-companion",
1561
            QEMU_CAPS_ICH9_USB_EHCI1);
1562
    DO_TEST_PARSE_ERROR("usb-ich9-no-companion",
1563
            QEMU_CAPS_ICH9_USB_EHCI1);
1564
    DO_TEST("usb-ich9-autoassign",
1565
            QEMU_CAPS_ICH9_USB_EHCI1,
1566
            QEMU_CAPS_USB_HUB);
1567
    DO_TEST("usb-hub",
1568
            QEMU_CAPS_USB_HUB);
1569
    DO_TEST("usb-hub-autoadd",
1570
            QEMU_CAPS_USB_HUB);
1571
    DO_TEST("usb-hub-autoadd-deluxe",
1572
            QEMU_CAPS_USB_HUB);
J
Ján Tomko 已提交
1573
    DO_TEST_PARSE_ERROR("usb-hub-conflict",
1574
            QEMU_CAPS_USB_HUB);
1575
    DO_TEST_PARSE_ERROR("usb-hub-nonexistent",
1576
            QEMU_CAPS_USB_HUB);
J
Ján Tomko 已提交
1577
    DO_TEST("usb-port-missing",
1578
            QEMU_CAPS_USB_HUB);
1579
    DO_TEST_FAILURE("usb-bus-missing",
1580
                    QEMU_CAPS_USB_HUB);
1581
    DO_TEST("usb-ports",
1582
            QEMU_CAPS_USB_HUB);
1583
    DO_TEST_PARSE_ERROR("usb-ports-out-of-range",
1584
            QEMU_CAPS_USB_HUB);
1585
    DO_TEST("usb-port-autoassign",
1586
            QEMU_CAPS_USB_HUB);
1587
    DO_TEST("usb-redir",
1588 1589 1590
            QEMU_CAPS_USB_HUB,
            QEMU_CAPS_ICH9_USB_EHCI1,
            QEMU_CAPS_USB_REDIR,
1591
            QEMU_CAPS_SPICE);
1592
    DO_TEST("usb-redir-boot",
1593 1594 1595
            QEMU_CAPS_USB_HUB,
            QEMU_CAPS_ICH9_USB_EHCI1,
            QEMU_CAPS_USB_REDIR,
1596
            QEMU_CAPS_SPICE);
1597
    DO_TEST("usb-redir-filter",
1598 1599 1600 1601
            QEMU_CAPS_USB_HUB,
            QEMU_CAPS_ICH9_USB_EHCI1,
            QEMU_CAPS_USB_REDIR,
            QEMU_CAPS_SPICE,
1602
            QEMU_CAPS_USB_REDIR_FILTER);
1603 1604
    DO_TEST("usb-redir-filter-version",
            QEMU_CAPS_USB_REDIR,
1605
            QEMU_CAPS_SPICE,
1606
            QEMU_CAPS_USB_REDIR_FILTER);
J
Ján Tomko 已提交
1607 1608
    DO_TEST_CAPS_VER("usb-redir-unix", "2.5.0");
    DO_TEST_CAPS_LATEST("usb-redir-unix");
1609
    DO_TEST("usb1-usb2",
1610 1611 1612
            QEMU_CAPS_PIIX3_USB_UHCI,
            QEMU_CAPS_USB_HUB,
            QEMU_CAPS_ICH9_USB_EHCI1);
1613 1614
    DO_TEST("usb-none", NONE);
    DO_TEST_PARSE_ERROR("usb-none-other", NONE);
1615 1616
    DO_TEST_PARSE_ERROR("usb-none-hub",
            QEMU_CAPS_USB_HUB);
1617
    DO_TEST_PARSE_ERROR("usb-none-usbtablet", NONE);
1618
    DO_TEST("usb-controller-default-q35",
1619
            QEMU_CAPS_DEVICE_IOH3420,
1620 1621 1622
            QEMU_CAPS_PCI_OHCI,
            QEMU_CAPS_PIIX3_USB_UHCI,
            QEMU_CAPS_NEC_USB_XHCI);
1623
    DO_TEST_FAILURE("usb-controller-default-unavailable-q35",
1624
                    QEMU_CAPS_DEVICE_IOH3420,
1625
                    QEMU_CAPS_PCI_OHCI,
1626 1627
                    QEMU_CAPS_NEC_USB_XHCI);
    DO_TEST("usb-controller-explicit-q35",
1628
            QEMU_CAPS_DEVICE_IOH3420,
1629 1630 1631
            QEMU_CAPS_PCI_OHCI,
            QEMU_CAPS_PIIX3_USB_UHCI,
            QEMU_CAPS_NEC_USB_XHCI);
1632
    DO_TEST_FAILURE("usb-controller-explicit-unavailable-q35",
1633
                    QEMU_CAPS_DEVICE_IOH3420,
1634
                    QEMU_CAPS_PCI_OHCI,
1635
                    QEMU_CAPS_PIIX3_USB_UHCI);
1636
    DO_TEST("usb-controller-xhci",
1637 1638 1639
            QEMU_CAPS_PIIX3_USB_UHCI,
            QEMU_CAPS_NEC_USB_XHCI,
            QEMU_CAPS_NEC_USB_XHCI_PORTS);
1640
    DO_TEST("usb-xhci-autoassign",
1641 1642 1643
            QEMU_CAPS_PIIX3_USB_UHCI,
            QEMU_CAPS_NEC_USB_XHCI,
            QEMU_CAPS_NEC_USB_XHCI_PORTS,
1644
            QEMU_CAPS_USB_HUB);
1645
    DO_TEST_PARSE_ERROR("usb-controller-xhci-limit",
1646 1647 1648
            QEMU_CAPS_PIIX3_USB_UHCI,
            QEMU_CAPS_NEC_USB_XHCI,
            QEMU_CAPS_NEC_USB_XHCI_PORTS);
1649 1650 1651 1652
    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);
1653

1654 1655 1656
    DO_TEST("smbios", NONE);
    DO_TEST_PARSE_ERROR("smbios-date", NONE);
    DO_TEST_PARSE_ERROR("smbios-uuid-match", NONE);
1657

1658
    DO_TEST("watchdog", NONE);
1659
    DO_TEST("watchdog-device", NONE);
1660
    DO_TEST("watchdog-dump", NONE);
1661
    DO_TEST("watchdog-injectnmi", NONE);
1662
    DO_TEST("watchdog-diag288", QEMU_CAPS_VIRTIO_S390);
1663 1664
    DO_TEST("balloon-device", NONE);
    DO_TEST("balloon-device-deflate",
1665
            QEMU_CAPS_VIRTIO_BALLOON_AUTODEFLATE);
1666
    DO_TEST("balloon-ccw-deflate",
1667
            QEMU_CAPS_VIRTIO_BALLOON_AUTODEFLATE);
1668
    DO_TEST("balloon-mmio-deflate",
J
Ján Tomko 已提交
1669
            QEMU_CAPS_DEVICE_VIRTIO_MMIO,
1670
            QEMU_CAPS_VIRTIO_BALLOON_AUTODEFLATE);
1671
    DO_TEST("balloon-device-deflate-off",
1672
            QEMU_CAPS_VIRTIO_BALLOON_AUTODEFLATE);
1673 1674
    DO_TEST("balloon-device-auto", NONE);
    DO_TEST("balloon-device-period", NONE);
1675 1676
    DO_TEST("sound", NONE);
    DO_TEST("sound-device",
1677
            QEMU_CAPS_HDA_DUPLEX, QEMU_CAPS_HDA_MICRO,
1678
            QEMU_CAPS_HDA_OUTPUT,
1679 1680
            QEMU_CAPS_DEVICE_ICH9_INTEL_HDA,
            QEMU_CAPS_OBJECT_USB_AUDIO);
1681
    DO_TEST("fs9p", NONE);
1682
    DO_TEST("fs9p-ccw",
1683
            QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
1684

1685
    DO_TEST("hostdev-usb-address", NONE);
1686
    DO_TEST("hostdev-usb-address-device", NONE);
1687
    DO_TEST("hostdev-usb-address-device-boot", NONE);
J
Ján Tomko 已提交
1688
    DO_TEST("hostdev-pci-address", NONE);
1689
    DO_TEST("hostdev-pci-address-device", NONE);
1690 1691
    DO_TEST("hostdev-vfio",
            QEMU_CAPS_DEVICE_VFIO_PCI);
1692
    DO_TEST("hostdev-vfio-multidomain",
1693
            QEMU_CAPS_DEVICE_VFIO_PCI);
1694 1695 1696 1697 1698 1699
    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);
1700 1701 1702 1703 1704 1705 1706
    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);
1707 1708
    DO_TEST_PARSE_ERROR("hostdev-vfio-zpci-wrong-arch",
                        QEMU_CAPS_DEVICE_VFIO_PCI);
1709 1710 1711
    DO_TEST("hostdev-vfio-zpci",
            QEMU_CAPS_DEVICE_VFIO_PCI,
            QEMU_CAPS_DEVICE_ZPCI);
1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724
    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);
1725
    DO_TEST("pci-rom", NONE);
1726
    DO_TEST("pci-rom-disabled", NONE);
1727
    DO_TEST("pci-rom-disabled-invalid", NONE);
1728

1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744
    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);

1745
    DO_TEST_FULL("restore-v2",
1746 1747
                 ARG_MIGRATE_FROM, "exec:cat",
                 ARG_MIGRATE_FD, 7,
1748
                 ARG_QEMU_CAPS, NONE);
1749
    DO_TEST_FULL("restore-v2-fd",
1750 1751
                 ARG_MIGRATE_FROM, "stdio",
                 ARG_MIGRATE_FD, 7,
1752
                 ARG_QEMU_CAPS, NONE);
1753
    DO_TEST_FULL("restore-v2-fd",
1754 1755
                 ARG_MIGRATE_FROM, "fd:7",
                 ARG_MIGRATE_FD, 7,
1756
                 ARG_QEMU_CAPS, NONE);
1757
    DO_TEST_FULL("migrate",
1758
                 ARG_MIGRATE_FROM, "tcp:10.0.0.1:5000",
1759
                 ARG_QEMU_CAPS, NONE);
1760

1761
    DO_TEST_FULL("migrate-numa-unaligned",
1762 1763
                 ARG_MIGRATE_FROM, "stdio",
                 ARG_MIGRATE_FD, 7,
1764
                 ARG_QEMU_CAPS,
A
Andrea Bolognani 已提交
1765 1766
                 QEMU_CAPS_NUMA,
                 QEMU_CAPS_OBJECT_MEMORY_RAM);
1767

1768
    DO_TEST("qemu-ns", NONE);
1769
    DO_TEST("qemu-ns-no-env", NONE);
1770
    DO_TEST("qemu-ns-alt", NONE);
1771

1772
    DO_TEST("smp", NONE);
1773

J
John Ferlan 已提交
1774
    DO_TEST("iothreads", QEMU_CAPS_OBJECT_IOTHREAD);
1775 1776
    DO_TEST("iothreads-ids", QEMU_CAPS_OBJECT_IOTHREAD);
    DO_TEST("iothreads-ids-partial", QEMU_CAPS_OBJECT_IOTHREAD);
1777
    DO_TEST_FAILURE("iothreads-nocap", NONE);
1778 1779
    DO_TEST("iothreads-disk", QEMU_CAPS_OBJECT_IOTHREAD);
    DO_TEST("iothreads-disk-virtio-ccw", QEMU_CAPS_OBJECT_IOTHREAD,
1780
            QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
1781 1782
    DO_TEST_CAPS_LATEST("iothreads-virtio-scsi-pci");
    DO_TEST_CAPS_ARCH_LATEST("iothreads-virtio-scsi-ccw", "s390x");
J
John Ferlan 已提交
1783

1784 1785
    DO_TEST("cpu-topology1", NONE);
    DO_TEST("cpu-topology2", NONE);
1786
    DO_TEST("cpu-topology3", NONE);
1787 1788 1789 1790 1791 1792 1793 1794
    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);
1795
    DO_TEST("cpu-numa1", NONE);
1796 1797
    DO_TEST("cpu-numa2", NONE);
    DO_TEST("cpu-numa-no-memory-element", NONE);
1798
    DO_TEST_PARSE_ERROR("cpu-numa3", NONE);
1799 1800
    DO_TEST_FAILURE("cpu-numa-disjoint", NONE);
    DO_TEST("cpu-numa-disjoint", QEMU_CAPS_NUMA);
1801 1802
    DO_TEST_FAILURE("cpu-numa-memshared", QEMU_CAPS_OBJECT_MEMORY_RAM);
    DO_TEST_FAILURE("cpu-numa-memshared", NONE);
1803
    DO_TEST("cpu-numa-memshared", QEMU_CAPS_OBJECT_MEMORY_FILE);
1804
    DO_TEST("cpu-host-model", NONE);
1805
    DO_TEST("cpu-host-model-vendor", NONE);
1806
    DO_TEST_FULL("cpu-host-model-fallback",
1807
                 ARG_FLAGS, FLAG_SKIP_LEGACY_CPUS,
1808
                 ARG_QEMU_CAPS, NONE);
1809
    DO_TEST_FULL("cpu-host-model-nofallback",
1810
                 ARG_FLAGS, FLAG_SKIP_LEGACY_CPUS | FLAG_EXPECT_FAILURE,
1811
                 ARG_QEMU_CAPS, NONE);
A
Andrea Bolognani 已提交
1812 1813
    DO_TEST("cpu-host-passthrough", QEMU_CAPS_KVM);
    DO_TEST_FAILURE("cpu-qemu-host-passthrough", QEMU_CAPS_KVM);
1814

1815
    qemuTestSetHostArch(driver.caps, VIR_ARCH_S390X);
1816
    DO_TEST("cpu-s390-zEC12", QEMU_CAPS_KVM, QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
1817 1818
    DO_TEST("cpu-s390-features", QEMU_CAPS_KVM, QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION);
    DO_TEST_FAILURE("cpu-s390-features", QEMU_CAPS_KVM);
1819 1820
    qemuTestSetHostArch(driver.caps, VIR_ARCH_NONE);

1821
    qemuTestSetHostCPU(driver.caps, cpuHaswell);
1822 1823 1824 1825
    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);
1826
    DO_TEST("cpu-host-model-cmt", NONE);
1827
    DO_TEST("cpu-tsc-frequency", QEMU_CAPS_KVM);
1828
    qemuTestSetHostCPU(driver.caps, NULL);
1829

1830 1831
    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);
1832
    DO_TEST("luks-disks", QEMU_CAPS_OBJECT_SECRET);
1833
    DO_TEST("luks-disks-source", QEMU_CAPS_OBJECT_SECRET);
1834 1835
    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);
1836
    DO_TEST_PARSE_ERROR("luks-disk-invalid", NONE);
1837
    DO_TEST_PARSE_ERROR("luks-disks-source-both", QEMU_CAPS_OBJECT_SECRET);
1838

1839 1840 1841 1842 1843 1844 1845 1846
    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);
1847
    DO_TEST("cputune-numatune",
1848
            QEMU_CAPS_KVM,
1849
            QEMU_CAPS_OBJECT_IOTHREAD,
1850 1851
            QEMU_CAPS_OBJECT_MEMORY_RAM,
            QEMU_CAPS_OBJECT_MEMORY_FILE);
1852 1853 1854
    DO_TEST("vcpu-placement-static",
            QEMU_CAPS_KVM,
            QEMU_CAPS_OBJECT_IOTHREAD);
1855

1856
    DO_TEST("numatune-memory", NONE);
1857
    DO_TEST_PARSE_ERROR("numatune-memory-invalid-nodeset", NONE);
A
Andrea Bolognani 已提交
1858 1859 1860
    DO_TEST("numatune-memnode",
            QEMU_CAPS_NUMA,
            QEMU_CAPS_OBJECT_MEMORY_RAM);
1861 1862
    DO_TEST_FAILURE("numatune-memnode", NONE);

A
Andrea Bolognani 已提交
1863 1864 1865
    DO_TEST("numatune-memnode-no-memory",
            QEMU_CAPS_NUMA,
            QEMU_CAPS_OBJECT_MEMORY_RAM);
1866 1867
    DO_TEST_FAILURE("numatune-memnode-no-memory", NONE);

1868 1869
    DO_TEST("numatune-distances", QEMU_CAPS_NUMA, QEMU_CAPS_NUMA_DIST);

1870
    DO_TEST("numatune-auto-nodeset-invalid", NONE);
1871 1872
    DO_TEST("numatune-auto-prefer", QEMU_CAPS_OBJECT_MEMORY_RAM,
            QEMU_CAPS_OBJECT_MEMORY_FILE);
1873 1874
    DO_TEST_FAILURE("numatune-static-nodeset-exceed-hostnode",
                    QEMU_CAPS_OBJECT_MEMORY_RAM);
1875 1876
    DO_TEST_PARSE_ERROR("numatune-memnode-nocpu", NONE);
    DO_TEST_PARSE_ERROR("numatune-memnodes-problematic", NONE);
1877 1878
    DO_TEST("numad", NONE);
    DO_TEST("numad-auto-vcpu-static-numatune", NONE);
1879
    DO_TEST_PARSE_ERROR("numad-auto-vcpu-static-numatune-no-nodeset", NONE);
1880 1881 1882
    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);
1883
    DO_TEST("blkdeviotune-max",
1884
            QEMU_CAPS_DRIVE_IOTUNE_MAX);
1885 1886 1887
    DO_TEST("blkdeviotune-group-num",
            QEMU_CAPS_DRIVE_IOTUNE_MAX,
            QEMU_CAPS_DRIVE_IOTUNE_GROUP);
1888 1889 1890
    DO_TEST("blkdeviotune-max-length",
            QEMU_CAPS_DRIVE_IOTUNE_MAX,
            QEMU_CAPS_DRIVE_IOTUNE_MAX_LENGTH);
1891

1892
    DO_TEST("multifunction-pci-device",
1893
            QEMU_CAPS_SCSI_LSI);
1894

1895
    DO_TEST("monitor-json", NONE);
1896

1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908
    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);
1909

1910
    DO_TEST("pseries-basic",
1911
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1912
            QEMU_CAPS_DEVICE_SPAPR_VTY);
1913
    DO_TEST("pseries-vio",
1914
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1915
            QEMU_CAPS_DEVICE_SPAPR_VTY);
1916
    DO_TEST("pseries-usb-default",
1917
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1918
            QEMU_CAPS_DEVICE_SPAPR_VTY,
1919
            QEMU_CAPS_PIIX3_USB_UHCI,
1920
            QEMU_CAPS_PCI_OHCI);
1921
    DO_TEST("pseries-usb-multi",
1922
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1923
            QEMU_CAPS_DEVICE_SPAPR_VTY,
1924
            QEMU_CAPS_PIIX3_USB_UHCI,
1925
            QEMU_CAPS_PCI_OHCI);
1926
    DO_TEST("pseries-vio-user-assigned",
1927
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1928 1929
            QEMU_CAPS_DEVICE_SPAPR_VTY);
    DO_TEST_PARSE_ERROR("pseries-vio-address-clash", NONE);
1930 1931 1932
    DO_TEST("pseries-nvram",
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
            QEMU_CAPS_DEVICE_NVRAM);
1933
    DO_TEST("pseries-usb-kbd", QEMU_CAPS_PCI_OHCI,
1934
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1935
            QEMU_CAPS_DEVICE_USB_KBD,
1936
            QEMU_CAPS_DEVICE_SPAPR_VTY);
1937
    DO_TEST("pseries-cpu-exact",
1938
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1939 1940
            QEMU_CAPS_DEVICE_SPAPR_VTY);
    DO_TEST_PARSE_ERROR("pseries-no-parallel", NONE);
1941 1942

    qemuTestSetHostArch(driver.caps, VIR_ARCH_PPC64);
A
Andrea Bolognani 已提交
1943
    DO_TEST("pseries-cpu-compat", QEMU_CAPS_KVM,
1944
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1945
            QEMU_CAPS_DEVICE_SPAPR_VTY);
1946 1947 1948
    DO_TEST("pseries-machine-max-cpu-compat",
            QEMU_CAPS_KVM,
            QEMU_CAPS_MACHINE_PSERIES_MAX_CPU_COMPAT,
1949
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE);
A
Andrea Bolognani 已提交
1950
    DO_TEST("pseries-cpu-le", QEMU_CAPS_KVM,
1951
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1952
            QEMU_CAPS_DEVICE_SPAPR_VTY);
1953 1954 1955
    DO_TEST_FAILURE("pseries-cpu-compat-power9",
                    QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
                    QEMU_CAPS_KVM);
1956 1957 1958

    qemuTestSetHostCPU(driver.caps, cpuPower9);
    DO_TEST("pseries-cpu-compat-power9",
1959
            QEMU_CAPS_KVM,
1960
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1961
            QEMU_CAPS_DEVICE_SPAPR_VTY);
1962 1963
    qemuTestSetHostCPU(driver.caps, NULL);

1964 1965
    qemuTestSetHostArch(driver.caps, VIR_ARCH_NONE);

1966
    DO_TEST("pseries-panic-missing",
1967
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1968
            QEMU_CAPS_DEVICE_SPAPR_VTY);
1969
    DO_TEST("pseries-panic-no-address",
1970
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1971
            QEMU_CAPS_DEVICE_SPAPR_VTY);
1972
    DO_TEST_FAILURE("pseries-panic-address",
1973
                    QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE);
1974 1975 1976 1977 1978

    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);
1979 1980 1981 1982 1983 1984
    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);
1985 1986 1987
    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);
1988

1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010
    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);

2011
    DO_TEST("pseries-features",
2012
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
2013
            QEMU_CAPS_MACHINE_PSERIES_CAP_HPT_MAX_PAGE_SIZE,
2014
            QEMU_CAPS_MACHINE_PSERIES_CAP_HTM,
2015
            QEMU_CAPS_MACHINE_PSERIES_CAP_NESTED_HV,
2016
            QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT);
2017
    DO_TEST_FAILURE("pseries-features",
2018
                    QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE);
A
Andrea Bolognani 已提交
2019
    DO_TEST_PARSE_ERROR("pseries-features-invalid-machine", NONE);
2020

2021
    DO_TEST("pseries-serial-native",
2022
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
2023 2024
            QEMU_CAPS_DEVICE_SPAPR_VTY);
    DO_TEST("pseries-serial+console-native",
2025
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
2026 2027
            QEMU_CAPS_DEVICE_SPAPR_VTY);
    DO_TEST("pseries-serial-compat",
2028
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
2029
            QEMU_CAPS_DEVICE_SPAPR_VTY);
2030
    DO_TEST("pseries-serial-pci",
2031
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
2032 2033
            QEMU_CAPS_DEVICE_PCI_SERIAL);
    DO_TEST("pseries-serial-usb",
2034
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
2035 2036
            QEMU_CAPS_DEVICE_QEMU_XHCI,
            QEMU_CAPS_DEVICE_USB_SERIAL);
2037
    DO_TEST("pseries-console-native",
2038
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
2039 2040
            QEMU_CAPS_DEVICE_SPAPR_VTY);
    DO_TEST("pseries-console-virtio",
2041
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE);
2042 2043
    DO_TEST_PARSE_ERROR("pseries-serial-invalid-machine", NONE);

2044
    DO_TEST("mach-virt-serial-native",
2045
            QEMU_CAPS_DEVICE_PL011);
2046
    DO_TEST("mach-virt-serial+console-native",
2047
            QEMU_CAPS_DEVICE_PL011);
2048
    DO_TEST("mach-virt-serial-compat",
2049
            QEMU_CAPS_DEVICE_PL011);
2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061
    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",
2062
            QEMU_CAPS_DEVICE_PL011);
2063 2064
    DO_TEST("mach-virt-console-virtio",
            QEMU_CAPS_DEVICE_VIRTIO_MMIO);
2065 2066
    DO_TEST_PARSE_ERROR("mach-virt-serial-invalid-machine", NONE);

2067 2068
    DO_TEST("disk-ide-split", NONE);
    DO_TEST("disk-ide-wwn", QEMU_CAPS_IDE_DRIVE_WWN);
2069

2070
    DO_TEST("disk-geometry", NONE);
2071
    DO_TEST("disk-blockio", QEMU_CAPS_BLOCKIO);
2072

2073
    DO_TEST("video-device-pciaddr-default",
2074 2075
            QEMU_CAPS_KVM,
            QEMU_CAPS_VNC,
2076
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2077
            QEMU_CAPS_DEVICE_QXL);
2078
    DO_TEST("video-vga-nodevice", QEMU_CAPS_DEVICE_VGA);
2079
    DO_TEST("video-vga-device", QEMU_CAPS_DEVICE_VGA,
2080
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
2081
    DO_TEST("video-vga-device-vgamem", QEMU_CAPS_DEVICE_VGA,
2082
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY, QEMU_CAPS_VGA_VGAMEM);
2083
    DO_TEST("video-qxl-nodevice", QEMU_CAPS_DEVICE_QXL);
2084
    DO_TEST("video-qxl-device",
2085
            QEMU_CAPS_DEVICE_QXL,
2086
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
2087
    DO_TEST("video-qxl-device-vgamem",
2088
            QEMU_CAPS_DEVICE_QXL,
2089
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2090
            QEMU_CAPS_QXL_VGAMEM);
2091
    DO_TEST_CAPS_LATEST("video-qxl-device-vram64");
2092
    DO_TEST("video-qxl-sec-device",
2093
            QEMU_CAPS_DEVICE_QXL, QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
2094
    DO_TEST("video-qxl-sec-device-vgamem",
2095 2096
            QEMU_CAPS_DEVICE_QXL,
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2097
            QEMU_CAPS_QXL_VGAMEM);
2098
    DO_TEST_CAPS_LATEST("video-qxl-sec-device-vram64");
2099 2100 2101
    DO_TEST("video-qxl-heads",
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
            QEMU_CAPS_DEVICE_QXL,
2102
            QEMU_CAPS_QXL_MAX_OUTPUTS);
2103 2104 2105
    DO_TEST("video-vga-qxl-heads",
            QEMU_CAPS_DEVICE_QXL,
            QEMU_CAPS_QXL_MAX_OUTPUTS);
2106 2107 2108
    DO_TEST("video-qxl-noheads",
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
            QEMU_CAPS_DEVICE_QXL,
2109
            QEMU_CAPS_QXL_MAX_OUTPUTS);
M
Marc-André Lureau 已提交
2110
    DO_TEST("video-virtio-gpu-device",
2111
            QEMU_CAPS_DEVICE_VIRTIO_GPU,
M
Marc-André Lureau 已提交
2112
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
2113
    DO_TEST("video-virtio-gpu-virgl",
2114
            QEMU_CAPS_DEVICE_VIRTIO_GPU,
2115
            QEMU_CAPS_VIRTIO_GPU_VIRGL,
2116
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
2117 2118
    DO_TEST("video-virtio-gpu-spice-gl",
            QEMU_CAPS_DEVICE_VIRTIO_GPU,
2119
            QEMU_CAPS_VIRTIO_GPU_VIRGL,
2120 2121
            QEMU_CAPS_SPICE,
            QEMU_CAPS_SPICE_GL,
2122
            QEMU_CAPS_SPICE_RENDERNODE,
2123
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
2124 2125 2126 2127 2128
    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);
2129 2130 2131
    DO_TEST("video-virtio-gpu-secondary",
            QEMU_CAPS_DEVICE_VIRTIO_GPU,
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
2132 2133 2134
    DO_TEST("video-virtio-vga",
            QEMU_CAPS_DEVICE_VIRTIO_GPU,
            QEMU_CAPS_DEVICE_VIRTIO_VGA,
2135 2136
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
            QEMU_CAPS_VIRTIO_GPU_MAX_OUTPUTS);
2137 2138 2139
    DO_TEST("video-none-device",
            QEMU_CAPS_VNC);
    DO_TEST_PARSE_ERROR("video-invalid-multiple-devices", NONE);
2140

2141 2142
    DO_TEST("virtio-rng-default",
            QEMU_CAPS_DEVICE_VIRTIO_RNG,
2143
            QEMU_CAPS_OBJECT_RNG_RANDOM);
2144 2145
    DO_TEST("virtio-rng-random",
            QEMU_CAPS_DEVICE_VIRTIO_RNG,
2146
            QEMU_CAPS_OBJECT_RNG_RANDOM);
2147 2148
    DO_TEST("virtio-rng-egd",
            QEMU_CAPS_DEVICE_VIRTIO_RNG,
2149
            QEMU_CAPS_OBJECT_RNG_EGD);
J
Ján Tomko 已提交
2150 2151
    DO_TEST_CAPS_VER("virtio-rng-egd-unix", "2.5.0");
    DO_TEST_CAPS_LATEST("virtio-rng-egd-unix");
2152 2153 2154 2155
    DO_TEST("virtio-rng-multiple",
            QEMU_CAPS_DEVICE_VIRTIO_RNG,
            QEMU_CAPS_OBJECT_RNG_EGD,
            QEMU_CAPS_OBJECT_RNG_RANDOM);
2156
    DO_TEST_PARSE_ERROR("virtio-rng-egd-crash",
2157 2158
            QEMU_CAPS_DEVICE_VIRTIO_RNG,
            QEMU_CAPS_OBJECT_RNG_EGD);
2159
    DO_TEST("virtio-rng-ccw",
2160
            QEMU_CAPS_CCW,
2161 2162
            QEMU_CAPS_VIRTIO_S390,
            QEMU_CAPS_DEVICE_VIRTIO_RNG,
2163
            QEMU_CAPS_OBJECT_RNG_RANDOM);
2164

2165
    DO_TEST("s390-allow-bogus-usb-none",
2166 2167 2168
            QEMU_CAPS_VIRTIO_S390,
            QEMU_CAPS_DEVICE_VIRTIO_RNG,
            QEMU_CAPS_OBJECT_RNG_RANDOM);
2169
    DO_TEST("s390-allow-bogus-usb-controller",
2170 2171 2172
            QEMU_CAPS_VIRTIO_S390,
            QEMU_CAPS_DEVICE_VIRTIO_RNG,
            QEMU_CAPS_OBJECT_RNG_RANDOM);
2173

2174
    DO_TEST("s390-panic-no-address",
2175
            QEMU_CAPS_CCW,
2176
            QEMU_CAPS_VIRTIO_S390);
2177
    DO_TEST_FAILURE("s390-panic-address",
2178
            QEMU_CAPS_CCW,
2179
            QEMU_CAPS_VIRTIO_S390);
2180
    DO_TEST("s390-panic-missing",
2181
            QEMU_CAPS_CCW,
2182
            QEMU_CAPS_VIRTIO_S390);
2183
    DO_TEST_PARSE_ERROR("s390-no-parallel",
2184
            QEMU_CAPS_CCW,
2185
            QEMU_CAPS_VIRTIO_S390);
2186
    DO_TEST("s390-serial",
2187
            QEMU_CAPS_CCW,
2188 2189 2190
            QEMU_CAPS_VIRTIO_S390,
            QEMU_CAPS_DEVICE_SCLPCONSOLE);
    DO_TEST("s390-serial-2",
2191
            QEMU_CAPS_CCW,
2192 2193 2194 2195
            QEMU_CAPS_VIRTIO_S390,
            QEMU_CAPS_DEVICE_SCLPCONSOLE,
            QEMU_CAPS_DEVICE_SCLPLMCONSOLE);
    DO_TEST("s390-serial-console",
2196
            QEMU_CAPS_CCW,
2197 2198
            QEMU_CAPS_VIRTIO_S390,
            QEMU_CAPS_DEVICE_SCLPCONSOLE);
2199

2200
    DO_TEST("ppc-dtb",
J
Ján Tomko 已提交
2201
            QEMU_CAPS_KVM);
2202 2203
    DO_TEST("ppce500-serial",
            QEMU_CAPS_KVM);
O
Olivia Yin 已提交
2204

2205
    DO_TEST("tpm-passthrough",
2206
            QEMU_CAPS_DEVICE_TPM_PASSTHROUGH, QEMU_CAPS_DEVICE_TPM_TIS);
2207 2208
    DO_TEST("tpm-passthrough-crb",
            QEMU_CAPS_DEVICE_TPM_PASSTHROUGH, QEMU_CAPS_DEVICE_TPM_CRB);
2209
    DO_TEST_PARSE_ERROR("tpm-no-backend-invalid",
2210
                        QEMU_CAPS_DEVICE_TPM_PASSTHROUGH, QEMU_CAPS_DEVICE_TPM_TIS);
2211
    DO_TEST_CAPS_LATEST("tpm-emulator");
2212
    DO_TEST_CAPS_LATEST("tpm-emulator-tpm2");
2213

2214 2215 2216 2217
    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);
2218

2219 2220 2221 2222 2223 2224
    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,
2225
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
2226 2227
    DO_TEST("pci-autoadd-idx",
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
2228 2229
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
    DO_TEST("pci-autofill-addr", QEMU_CAPS_DEVICE_CIRRUS_VGA);
2230
    DO_TEST("pci-many",
2231
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
2232
    DO_TEST("pci-bridge-many-disks",
2233
            QEMU_CAPS_DEVICE_PCI_BRIDGE);
L
Laine Stump 已提交
2234
    DO_TEST("pcie-root",
2235 2236 2237 2238
            QEMU_CAPS_DEVICE_IOH3420,
            QEMU_CAPS_ICH9_AHCI,
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
            QEMU_CAPS_DEVICE_QXL);
2239
    DO_TEST("q35",
2240
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
2241
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
2242
            QEMU_CAPS_DEVICE_IOH3420,
2243
            QEMU_CAPS_ICH9_AHCI,
2244
            QEMU_CAPS_ICH9_USB_EHCI1,
2245
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2246
            QEMU_CAPS_DEVICE_QXL);
2247 2248 2249 2250 2251 2252 2253 2254
    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);
2255
    DO_TEST("q35-pm-disable",
2256
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
2257
            QEMU_CAPS_DEVICE_IOH3420,
2258 2259 2260 2261
            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",
2262
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
2263
            QEMU_CAPS_DEVICE_IOH3420,
2264 2265
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, QEMU_CAPS_ICH9_AHCI,
            QEMU_CAPS_PIIX_DISABLE_S3, QEMU_CAPS_PIIX_DISABLE_S4);
2266
    DO_TEST("q35-usb2",
2267
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
2268
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
2269
            QEMU_CAPS_DEVICE_IOH3420,
2270
            QEMU_CAPS_ICH9_AHCI,
2271
            QEMU_CAPS_ICH9_USB_EHCI1,
2272
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2273
            QEMU_CAPS_DEVICE_QXL);
2274
    DO_TEST("q35-usb2-multi",
2275
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
2276
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
2277
            QEMU_CAPS_DEVICE_IOH3420,
2278
            QEMU_CAPS_ICH9_AHCI,
2279
            QEMU_CAPS_ICH9_USB_EHCI1,
2280
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2281
            QEMU_CAPS_DEVICE_QXL);
2282
    DO_TEST("q35-usb2-reorder",
2283
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
2284
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
2285
            QEMU_CAPS_DEVICE_IOH3420,
2286
            QEMU_CAPS_ICH9_AHCI,
2287
            QEMU_CAPS_ICH9_USB_EHCI1,
2288
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2289
            QEMU_CAPS_DEVICE_QXL);
2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307
    /* 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,
2308
            QEMU_CAPS_NEC_USB_XHCI,
2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321
            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,
2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341
            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,
2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355
            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,
2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374
            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,
2375 2376 2377 2378 2379
            QEMU_CAPS_DEVICE_VIRTIO_NET,
            QEMU_CAPS_DEVICE_VIRTIO_GPU,
            QEMU_CAPS_VIRTIO_GPU_VIRGL,
            QEMU_CAPS_VIRTIO_KEYBOARD,
            QEMU_CAPS_VIRTIO_MOUSE,
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,
2388
            QEMU_CAPS_NEC_USB_XHCI,
2389
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
2390 2391
    DO_TEST("q35-virt-manager-basic",
            QEMU_CAPS_KVM,
2392
            QEMU_CAPS_MACHINE_VMPORT_OPT,
2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416
            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,
2417
            QEMU_CAPS_DEVICE_ISA_SERIAL,
2418
            QEMU_CAPS_USB_REDIR);
2419 2420

    /* Test automatic and manual setting of pcie-root-port attributes */
2421 2422
    DO_TEST("pcie-root-port",
            QEMU_CAPS_DEVICE_IOH3420,
2423
            QEMU_CAPS_ICH9_AHCI,
2424
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2425
            QEMU_CAPS_DEVICE_QXL);
2426 2427 2428 2429 2430 2431

    /* 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,
2432
            QEMU_CAPS_DEVICE_IOH3420);
2433
    DO_TEST("pcie-root-port-model-ioh3420",
2434
            QEMU_CAPS_DEVICE_IOH3420);
2435

2436 2437 2438 2439 2440 2441 2442
    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,
2443
            QEMU_CAPS_ICH9_USB_EHCI1,
2444
            QEMU_CAPS_NEC_USB_XHCI);
2445 2446 2447 2448 2449 2450 2451
    /* 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);
2452

2453
    DO_TEST_PARSE_ERROR("q35-wrong-root",
2454
            QEMU_CAPS_DEVICE_IOH3420,
2455
            QEMU_CAPS_ICH9_AHCI,
2456
            QEMU_CAPS_ICH9_USB_EHCI1,
2457
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2458
            QEMU_CAPS_DEVICE_QXL);
2459
    DO_TEST_PARSE_ERROR("440fx-wrong-root", NONE);
2460
    DO_TEST_PARSE_ERROR("440fx-ide-address-conflict", NONE);
2461

2462
    DO_TEST_PARSE_ERROR("pcie-root-port-too-many",
2463
            QEMU_CAPS_DEVICE_IOH3420,
2464
            QEMU_CAPS_ICH9_AHCI,
2465
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2466
            QEMU_CAPS_DEVICE_QXL);
2467

2468 2469 2470
    DO_TEST("pcie-switch-upstream-port",
            QEMU_CAPS_DEVICE_IOH3420,
            QEMU_CAPS_DEVICE_X3130_UPSTREAM,
2471
            QEMU_CAPS_ICH9_AHCI,
2472
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2473
            QEMU_CAPS_DEVICE_QXL);
2474 2475 2476 2477
    DO_TEST("pcie-switch-downstream-port",
            QEMU_CAPS_DEVICE_IOH3420,
            QEMU_CAPS_DEVICE_X3130_UPSTREAM,
            QEMU_CAPS_DEVICE_XIO3130_DOWNSTREAM,
2478
            QEMU_CAPS_ICH9_AHCI,
2479
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2480
            QEMU_CAPS_DEVICE_QXL);
2481

2482 2483 2484 2485 2486 2487
    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);
2488 2489
    DO_TEST_PARSE_ERROR("pci-expander-bus-bad-bus",
                        QEMU_CAPS_DEVICE_PXB);
2490

2491 2492 2493 2494 2495 2496 2497 2498 2499 2500
    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);
2501 2502 2503
    DO_TEST_PARSE_ERROR("pcie-expander-bus-bad-bus",
                        QEMU_CAPS_DEVICE_IOH3420,
                        QEMU_CAPS_DEVICE_PXB_PCIE);
2504

2505
    DO_TEST("hostdev-scsi-lsi",
2506 2507
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_SCSI_LSI);
2508
    DO_TEST("hostdev-scsi-virtio-scsi",
2509 2510
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_SCSI_LSI);
2511
    DO_TEST("hostdev-scsi-readonly",
2512 2513
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_SCSI_LSI);
2514
    DO_TEST("hostdev-scsi-virtio-scsi",
2515 2516
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_SCSI_LSI);
2517
    DO_TEST("hostdev-scsi-lsi-iscsi",
2518 2519
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_SCSI_LSI);
2520
    DO_TEST("hostdev-scsi-lsi-iscsi-auth",
2521 2522
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_SCSI_LSI);
2523
    DO_TEST("hostdev-scsi-virtio-iscsi",
2524 2525
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_SCSI_LSI);
2526
    DO_TEST("hostdev-scsi-virtio-iscsi-auth",
2527 2528
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_SCSI_LSI);
2529
    DO_TEST("disk-hostdev-scsi-virtio-iscsi-auth-AES",
2530 2531 2532
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_SCSI_LSI,
            QEMU_CAPS_OBJECT_SECRET,
2533
            QEMU_CAPS_ISCSI_PASSWORD_SECRET);
2534 2535
    DO_TEST("hostdev-scsi-vhost-scsi-ccw",
            QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE_VHOST_SCSI,
2536
            QEMU_CAPS_CCW);
2537
    DO_TEST("hostdev-scsi-vhost-scsi-pci",
2538 2539
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_DEVICE_VHOST_SCSI);
2540 2541 2542 2543 2544
    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);
2545

2546
    DO_TEST("mlock-on", QEMU_CAPS_REALTIME_MLOCK);
2547
    DO_TEST_FAILURE("mlock-on", NONE);
2548
    DO_TEST("mlock-off", QEMU_CAPS_REALTIME_MLOCK);
2549 2550
    DO_TEST("mlock-unsupported", NONE);

2551 2552 2553 2554
    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);
2555

2556
    DO_TEST("hotplug-base",
2557
            QEMU_CAPS_KVM, QEMU_CAPS_VIRTIO_SCSI);
2558

2559 2560
    DO_TEST("pcihole64", QEMU_CAPS_I440FX_PCI_HOLE64_SIZE);
    DO_TEST_FAILURE("pcihole64-none", NONE);
2561
    DO_TEST("pcihole64-q35",
2562
            QEMU_CAPS_DEVICE_IOH3420,
2563
            QEMU_CAPS_ICH9_AHCI,
2564
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2565
            QEMU_CAPS_DEVICE_QXL,
2566 2567
            QEMU_CAPS_Q35_PCI_HOLE64_SIZE);

J
Ján Tomko 已提交
2568 2569
    DO_TEST("arm-vexpressa9-nodevs", NONE);
    DO_TEST("arm-vexpressa9-basic", NONE);
2570
    DO_TEST("arm-vexpressa9-virtio",
2571
            QEMU_CAPS_DEVICE_VIRTIO_MMIO,
2572
            QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM);
2573
    DO_TEST("arm-virt-virtio",
2574
            QEMU_CAPS_DEVICE_VIRTIO_MMIO,
2575
            QEMU_CAPS_DEVICE_PL011,
2576
            QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM);
2577

2578
    DO_TEST("aarch64-virt-virtio",
2579
            QEMU_CAPS_DEVICE_VIRTIO_MMIO,
2580
            QEMU_CAPS_DEVICE_PL011,
2581
            QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM);
2582 2583 2584 2585 2586 2587

    /* 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",
2588
            QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY,
2589 2590 2591
            QEMU_CAPS_DEVICE_VIRTIO_MMIO,
            QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM,
            QEMU_CAPS_OBJECT_GPEX, QEMU_CAPS_DEVICE_PCI_BRIDGE,
2592
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
2593
            QEMU_CAPS_DEVICE_IOH3420,
2594
            QEMU_CAPS_DEVICE_PL011,
2595
            QEMU_CAPS_VIRTIO_SCSI);
2596
    DO_TEST("aarch64-virt-2.6-virtio-pci-default",
2597
            QEMU_CAPS_DEVICE_VIRTIO_MMIO,
2598 2599
            QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM,
            QEMU_CAPS_OBJECT_GPEX, QEMU_CAPS_DEVICE_PCI_BRIDGE,
2600
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
2601
            QEMU_CAPS_DEVICE_PL011,
2602
            QEMU_CAPS_DEVICE_IOH3420);
2603 2604 2605
    /* Example of using virtio-pci with no explicit PCI controller
       but with manual PCI addresses */
    DO_TEST("aarch64-virtio-pci-manual-addresses",
2606
            QEMU_CAPS_DEVICE_VIRTIO_MMIO,
2607 2608
            QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM,
            QEMU_CAPS_OBJECT_GPEX, QEMU_CAPS_DEVICE_PCI_BRIDGE,
2609 2610 2611
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_IOH3420,
            QEMU_CAPS_VIRTIO_SCSI);
2612
    DO_TEST("aarch64-video-virtio-gpu-pci",
2613
            QEMU_CAPS_OBJECT_GPEX,
2614
            QEMU_CAPS_DEVICE_PCI_BRIDGE, QEMU_CAPS_DEVICE_IOH3420,
2615
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2616
            QEMU_CAPS_DEVICE_VIRTIO_GPU);
2617
    DO_TEST("aarch64-video-default",
2618
            QEMU_CAPS_OBJECT_GPEX,
2619
            QEMU_CAPS_DEVICE_PCI_BRIDGE, QEMU_CAPS_DEVICE_IOH3420,
2620
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2621 2622
            QEMU_CAPS_DEVICE_VIRTIO_GPU, QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
            QEMU_CAPS_VNC);
2623
    DO_TEST("aarch64-aavmf-virtio-mmio",
2624
            QEMU_CAPS_DEVICE_VIRTIO_MMIO,
2625
            QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM);
2626 2627
    DO_TEST("aarch64-virt-default-nic",
            QEMU_CAPS_DEVICE_VIRTIO_MMIO);
2628
    qemuTestSetHostArch(driver.caps, VIR_ARCH_AARCH64);
2629
    DO_TEST("aarch64-cpu-passthrough",
2630
            QEMU_CAPS_DEVICE_VIRTIO_MMIO,
A
Andrea Bolognani 已提交
2631
            QEMU_CAPS_KVM);
2632
    DO_TEST_GIC("aarch64-gic-none", GIC_NONE,
2633
            QEMU_CAPS_KVM,
2634
            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
2635
    DO_TEST_GIC("aarch64-gic-none-v2", GIC_V2,
2636
            QEMU_CAPS_KVM,
2637 2638
            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
    DO_TEST_GIC("aarch64-gic-none-v3", GIC_V3,
2639
            QEMU_CAPS_KVM,
2640
            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
2641
    DO_TEST_GIC("aarch64-gic-none-both", GIC_BOTH,
2642
            QEMU_CAPS_KVM,
2643
            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
2644 2645
    DO_TEST_GIC("aarch64-gic-none-tcg", GIC_BOTH,
            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
2646
    DO_TEST_GIC("aarch64-gic-default", GIC_NONE,
2647
            QEMU_CAPS_KVM,
2648
            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
A
Andrea Bolognani 已提交
2649
    DO_TEST_GIC("aarch64-gic-default-v2", GIC_V2,
2650
            QEMU_CAPS_KVM,
2651
            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
A
Andrea Bolognani 已提交
2652
    DO_TEST_GIC("aarch64-gic-default-v3", GIC_V3,
2653
            QEMU_CAPS_KVM,
2654
            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
A
Andrea Bolognani 已提交
2655
    DO_TEST_GIC("aarch64-gic-default-both", GIC_BOTH,
2656
            QEMU_CAPS_KVM,
2657 2658
            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
    DO_TEST_GIC("aarch64-gic-v2", GIC_NONE,
2659
            QEMU_CAPS_KVM,
2660 2661
            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
    DO_TEST_GIC("aarch64-gic-v2", GIC_V2,
2662
            QEMU_CAPS_KVM,
2663 2664
            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
    DO_TEST_GIC("aarch64-gic-v2", GIC_V3,
2665
            QEMU_CAPS_KVM,
2666
            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
2667
    DO_TEST_GIC("aarch64-gic-v2", GIC_BOTH,
2668
            QEMU_CAPS_KVM,
2669
            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
2670
    DO_TEST_FAILURE("aarch64-gic-v3",
2671
            QEMU_CAPS_KVM, NONE);
2672
    DO_TEST_GIC("aarch64-gic-v3", GIC_NONE,
2673
            QEMU_CAPS_KVM,
2674 2675
            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
    DO_TEST_GIC("aarch64-gic-v3", GIC_V2,
2676
            QEMU_CAPS_KVM,
2677 2678
            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
    DO_TEST_GIC("aarch64-gic-v3", GIC_V3,
2679
            QEMU_CAPS_KVM,
2680 2681
            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
    DO_TEST_GIC("aarch64-gic-v3", GIC_BOTH,
2682
            QEMU_CAPS_KVM,
2683
            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
2684
    DO_TEST_FAILURE("aarch64-gic-host",
2685
            QEMU_CAPS_KVM, NONE);
2686
    DO_TEST_GIC("aarch64-gic-host", GIC_NONE,
2687
            QEMU_CAPS_KVM,
2688 2689
            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
    DO_TEST_GIC("aarch64-gic-host", GIC_V2,
2690
            QEMU_CAPS_KVM,
2691 2692
            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
    DO_TEST_GIC("aarch64-gic-host", GIC_V3,
2693
            QEMU_CAPS_KVM,
2694 2695
            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
    DO_TEST_GIC("aarch64-gic-host", GIC_BOTH,
2696
            QEMU_CAPS_KVM,
2697
            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
2698
    DO_TEST_PARSE_ERROR("aarch64-gic-invalid",
2699
            QEMU_CAPS_KVM,
2700
            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
2701
    DO_TEST_PARSE_ERROR("aarch64-gic-not-virt",
2702
                        QEMU_CAPS_KVM,
2703 2704
                        QEMU_CAPS_MACH_VIRT_GIC_VERSION);
    DO_TEST_PARSE_ERROR("aarch64-gic-not-arm",
2705
                        QEMU_CAPS_KVM,
2706
                        QEMU_CAPS_MACH_VIRT_GIC_VERSION);
2707
    DO_TEST("aarch64-kvm-32-on-64",
2708
            QEMU_CAPS_DEVICE_VIRTIO_MMIO,
2709
            QEMU_CAPS_DEVICE_PL011,
A
Andrea Bolognani 已提交
2710
            QEMU_CAPS_KVM, QEMU_CAPS_CPU_AARCH64_OFF);
2711
    DO_TEST_FAILURE("aarch64-kvm-32-on-64",
2712
            QEMU_CAPS_DEVICE_VIRTIO_MMIO,
A
Andrea Bolognani 已提交
2713
            QEMU_CAPS_KVM);
2714 2715 2716 2717 2718 2719 2720
    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);
2721 2722 2723 2724
    DO_TEST("aarch64-traditional-pci",
            QEMU_CAPS_OBJECT_GPEX,
            QEMU_CAPS_DEVICE_PCIE_ROOT_PORT,
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
2725
            QEMU_CAPS_DEVICE_PCIE_PCI_BRIDGE,
2726 2727
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_PCI_SERIAL);
2728 2729 2730 2731 2732 2733 2734

    /* 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);

2735
    qemuTestSetHostArch(driver.caps, VIR_ARCH_NONE);
2736

2737
    DO_TEST("kvm-pit-delay", QEMU_CAPS_KVM_PIT_TICK_POLICY);
2738
    DO_TEST("kvm-pit-discard", QEMU_CAPS_KVM_PIT_TICK_POLICY);
2739

2740 2741 2742 2743
    DO_TEST("panic",
            QEMU_CAPS_DEVICE_PANIC);
    DO_TEST("panic-double",
            QEMU_CAPS_DEVICE_PANIC);
H
Hu Tao 已提交
2744

2745 2746
    DO_TEST("panic-no-address",
            QEMU_CAPS_DEVICE_PANIC);
2747

2748 2749
    DO_TEST("fips-enabled", QEMU_CAPS_ENABLE_FIPS);

J
Ján Tomko 已提交
2750
    DO_TEST("shmem", QEMU_CAPS_DEVICE_IVSHMEM);
2751 2752 2753
    DO_TEST("shmem-plain-doorbell", QEMU_CAPS_DEVICE_IVSHMEM,
            QEMU_CAPS_DEVICE_IVSHMEM_PLAIN,
            QEMU_CAPS_DEVICE_IVSHMEM_DOORBELL);
2754
    DO_TEST_FAILURE("shmem", NONE);
J
Ján Tomko 已提交
2755
    DO_TEST_FAILURE("shmem-invalid-size",
2756
                    QEMU_CAPS_DEVICE_IVSHMEM);
J
Ján Tomko 已提交
2757
    DO_TEST_FAILURE("shmem-invalid-address",
2758
                    QEMU_CAPS_DEVICE_IVSHMEM);
J
Ján Tomko 已提交
2759
    DO_TEST_FAILURE("shmem-small-size",
2760
                    QEMU_CAPS_DEVICE_IVSHMEM);
2761
    DO_TEST_PARSE_ERROR("shmem-msi-only", NONE);
A
Andrea Bolognani 已提交
2762
    DO_TEST("cpu-host-passthrough-features", QEMU_CAPS_KVM);
2763

2764
    DO_TEST_FAILURE("memory-align-fail", NONE);
2765
    DO_TEST_FAILURE("memory-hotplug-nonuma", QEMU_CAPS_DEVICE_PC_DIMM);
M
Michal Privoznik 已提交
2766
    DO_TEST("memory-hotplug", NONE);
2767
    DO_TEST("memory-hotplug", QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_NUMA);
2768
    DO_TEST("memory-hotplug-dimm", QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_NUMA,
2769
            QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_OBJECT_MEMORY_FILE);
2770
    DO_TEST("memory-hotplug-dimm-addr", QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_NUMA,
2771
            QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_OBJECT_MEMORY_FILE);
2772
    DO_TEST("memory-hotplug-ppc64-nonuma", QEMU_CAPS_KVM, QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_NUMA,
2773
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
2774
            QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_OBJECT_MEMORY_FILE);
2775 2776 2777
    DO_TEST_CAPS_LATEST("memory-hotplug-nvdimm");
    DO_TEST_CAPS_LATEST("memory-hotplug-nvdimm-access");
    DO_TEST_CAPS_LATEST("memory-hotplug-nvdimm-label");
2778
    DO_TEST_CAPS_LATEST("memory-hotplug-nvdimm-align");
2779
    DO_TEST_CAPS_LATEST("memory-hotplug-nvdimm-pmem");
2780
    DO_TEST_CAPS_LATEST("memory-hotplug-nvdimm-readonly");
2781

2782
    DO_TEST("machine-aeskeywrap-on-caps",
2783
            QEMU_CAPS_AES_KEY_WRAP,
2784
            QEMU_CAPS_DEA_KEY_WRAP,
2785
            QEMU_CAPS_VIRTIO_SCSI,
2786
            QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
2787
    DO_TEST_FAILURE("machine-aeskeywrap-on-caps",
2788
                    QEMU_CAPS_VIRTIO_SCSI,
2789
                    QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
2790 2791 2792
    DO_TEST_FAILURE("machine-aeskeywrap-on-caps", NONE);

    DO_TEST("machine-aeskeywrap-on-cap",
2793
            QEMU_CAPS_AES_KEY_WRAP,
2794
            QEMU_CAPS_VIRTIO_SCSI,
2795
            QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
2796
    DO_TEST_FAILURE("machine-aeskeywrap-on-cap",
2797
                    QEMU_CAPS_VIRTIO_SCSI,
2798
                    QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
2799 2800 2801
    DO_TEST_FAILURE("machine-aeskeywrap-on-cap", NONE);

    DO_TEST("machine-aeskeywrap-off-caps",
2802
            QEMU_CAPS_AES_KEY_WRAP, QEMU_CAPS_DEA_KEY_WRAP,
2803
            QEMU_CAPS_VIRTIO_SCSI,
2804
            QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
2805
    DO_TEST_FAILURE("machine-aeskeywrap-off-caps",
2806
                    QEMU_CAPS_VIRTIO_SCSI,
2807
                    QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
2808 2809 2810
    DO_TEST_FAILURE("machine-aeskeywrap-off-caps", NONE);

    DO_TEST("machine-aeskeywrap-off-cap",
2811
            QEMU_CAPS_AES_KEY_WRAP,
2812
            QEMU_CAPS_VIRTIO_SCSI,
2813
            QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
2814
    DO_TEST_FAILURE("machine-aeskeywrap-off-cap",
2815
                    QEMU_CAPS_VIRTIO_SCSI,
2816
                    QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
2817 2818 2819
    DO_TEST_FAILURE("machine-aeskeywrap-off-cap", NONE);

    DO_TEST("machine-deakeywrap-on-caps",
2820
            QEMU_CAPS_AES_KEY_WRAP, QEMU_CAPS_DEA_KEY_WRAP,
2821
            QEMU_CAPS_VIRTIO_SCSI,
2822
            QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
2823
    DO_TEST_FAILURE("machine-deakeywrap-on-caps",
2824
                    QEMU_CAPS_VIRTIO_SCSI,
2825
                    QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
2826 2827 2828
    DO_TEST_FAILURE("machine-deakeywrap-on-caps", NONE);

    DO_TEST("machine-deakeywrap-on-cap",
2829
            QEMU_CAPS_DEA_KEY_WRAP,
2830
            QEMU_CAPS_VIRTIO_SCSI,
2831
            QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
2832
    DO_TEST_FAILURE("machine-deakeywrap-on-cap",
2833
                    QEMU_CAPS_VIRTIO_SCSI,
2834
                    QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
2835 2836 2837
    DO_TEST_FAILURE("machine-deakeywrap-on-cap", NONE);

    DO_TEST("machine-deakeywrap-off-caps",
2838
            QEMU_CAPS_AES_KEY_WRAP, QEMU_CAPS_DEA_KEY_WRAP,
2839
            QEMU_CAPS_VIRTIO_SCSI,
2840
            QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
2841
    DO_TEST_FAILURE("machine-deakeywrap-off-caps",
2842
                    QEMU_CAPS_VIRTIO_SCSI,
2843
                    QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
2844 2845 2846
    DO_TEST_FAILURE("machine-deakeywrap-off-caps", NONE);

    DO_TEST("machine-deakeywrap-off-cap",
2847
            QEMU_CAPS_DEA_KEY_WRAP,
2848
            QEMU_CAPS_VIRTIO_SCSI,
2849
            QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
2850
    DO_TEST_FAILURE("machine-deakeywrap-off-cap",
2851
                    QEMU_CAPS_VIRTIO_SCSI,
2852
                    QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
2853 2854 2855
    DO_TEST_FAILURE("machine-deakeywrap-off-cap", NONE);

    DO_TEST("machine-keywrap-none-caps",
2856
            QEMU_CAPS_AES_KEY_WRAP, QEMU_CAPS_DEA_KEY_WRAP,
2857
            QEMU_CAPS_VIRTIO_SCSI,
2858
            QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
2859
    DO_TEST("machine-keywrap-none",
2860
            QEMU_CAPS_VIRTIO_SCSI,
2861
            QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
2862

2863
    DO_TEST("machine-loadparm-s390",
2864
            QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390,
2865
            QEMU_CAPS_LOADPARM);
2866
    DO_TEST("machine-loadparm-net-s390",
2867
            QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390,
2868
            QEMU_CAPS_LOADPARM);
2869
    DO_TEST("machine-loadparm-multiple-disks-nets-s390",
2870
            QEMU_CAPS_CCW,
2871
            QEMU_CAPS_VIRTIO_S390,
2872 2873
            QEMU_CAPS_LOADPARM);
    DO_TEST_PARSE_ERROR("machine-loadparm-s390-char-invalid",
2874
                        QEMU_CAPS_CCW,
2875
                        QEMU_CAPS_VIRTIO_S390,
2876 2877
                        QEMU_CAPS_LOADPARM);
    DO_TEST_PARSE_ERROR("machine-loadparm-s390-len-invalid",
2878
                        QEMU_CAPS_CCW,
2879
                        QEMU_CAPS_VIRTIO_S390,
2880 2881
                        QEMU_CAPS_LOADPARM);

J
Jiri Denemark 已提交
2882 2883 2884 2885 2886 2887 2888
    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);

2889
    DO_TEST("virtio-input", QEMU_CAPS_VIRTIO_KEYBOARD,
2890
            QEMU_CAPS_VIRTIO_MOUSE, QEMU_CAPS_VIRTIO_TABLET);
2891
    DO_TEST("virtio-input-passthrough", QEMU_CAPS_VIRTIO_INPUT_HOST);
2892

2893
    DO_TEST("ppc64-usb-controller",
2894
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
2895
            QEMU_CAPS_PCI_OHCI);
2896
    DO_TEST("ppc64-usb-controller-legacy",
2897
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
2898
            QEMU_CAPS_PIIX3_USB_UHCI);
2899
    DO_TEST_FULL("ppc64-usb-controller-qemu-xhci",
2900
                 ARG_PARSEFLAGS, VIR_DOMAIN_DEF_PARSE_ABI_UPDATE,
2901
                 ARG_QEMU_CAPS,
2902
                 QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
2903 2904 2905 2906 2907 2908 2909
                 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);
2910

2911 2912 2913 2914
    DO_TEST("aarch64-usb-controller-nec-xhci",
            QEMU_CAPS_OBJECT_GPEX,
            QEMU_CAPS_NEC_USB_XHCI);

2915 2916 2917
    /* 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 */
2918 2919 2920 2921
    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);
2922

2923 2924 2925
    DO_TEST("name-escape",
            QEMU_CAPS_NAME_DEBUG_THREADS,
            QEMU_CAPS_OBJECT_SECRET,
2926 2927
            QEMU_CAPS_DRIVE_IOTUNE_MAX,
            QEMU_CAPS_DRIVE_IOTUNE_GROUP,
2928 2929 2930 2931
            QEMU_CAPS_VNC,
            QEMU_CAPS_NAME_GUEST,
            QEMU_CAPS_DEVICE_CIRRUS_VGA,
            QEMU_CAPS_SPICE,
2932
            QEMU_CAPS_SPICE_UNIX,
2933 2934 2935 2936 2937
            QEMU_CAPS_DEVICE_VIRTIO_GPU,
            QEMU_CAPS_VIRTIO_GPU_VIRGL,
            QEMU_CAPS_SPICE_GL,
            QEMU_CAPS_SPICE_RENDERNODE,
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2938
            QEMU_CAPS_DEVICE_ISA_SERIAL,
2939
            QEMU_CAPS_CHARDEV_FILE_APPEND,
2940
            QEMU_CAPS_CCID_EMULATED,
2941
            QEMU_CAPS_VIRTIO_SCSI);
M
Marc-André Lureau 已提交
2942 2943
    DO_TEST("debug-threads", QEMU_CAPS_NAME_DEBUG_THREADS);

2944
    DO_TEST("master-key", QEMU_CAPS_OBJECT_SECRET);
2945
    DO_TEST("usb-long-port-path",
J
Ján Tomko 已提交
2946
            QEMU_CAPS_USB_HUB);
2947
    DO_TEST_PARSE_ERROR("usb-too-long-port-path-invalid",
2948
                        QEMU_CAPS_USB_HUB);
2949

2950
    DO_TEST("acpi-table", NONE);
2951
    DO_TEST("intel-iommu",
2952
            QEMU_CAPS_DEVICE_INTEL_IOMMU);
2953 2954
    DO_TEST("intel-iommu-machine",
            QEMU_CAPS_MACHINE_IOMMU);
J
Ján Tomko 已提交
2955
    DO_TEST("intel-iommu-caching-mode",
2956 2957
            QEMU_CAPS_MACHINE_KERNEL_IRQCHIP,
            QEMU_CAPS_MACHINE_KERNEL_IRQCHIP_SPLIT,
2958 2959 2960 2961 2962 2963 2964 2965
            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);
2966 2967 2968 2969 2970 2971
    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);
2972 2973 2974 2975 2976 2977
    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);
2978

2979
    DO_TEST("cpu-hotplug-startup", QEMU_CAPS_QUERY_HOTPLUGGABLE_CPUS);
2980 2981 2982
    DO_TEST_PARSE_ERROR("cpu-hotplug-granularity",
                        QEMU_CAPS_QUERY_HOTPLUGGABLE_CPUS);

2983 2984 2985 2986 2987 2988 2989
    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,
2990 2991 2992
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
            QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM,
            QEMU_CAPS_VIRTIO_PCI_ATS);
2993

J
Ján Tomko 已提交
2994
    DO_TEST("fd-memory-numa-topology", QEMU_CAPS_OBJECT_MEMORY_FILE,
2995
            QEMU_CAPS_KVM);
J
Ján Tomko 已提交
2996
    DO_TEST("fd-memory-numa-topology2", QEMU_CAPS_OBJECT_MEMORY_FILE,
2997
            QEMU_CAPS_KVM);
J
Ján Tomko 已提交
2998
    DO_TEST("fd-memory-numa-topology3", QEMU_CAPS_OBJECT_MEMORY_FILE,
2999 3000
            QEMU_CAPS_KVM);

J
Ján Tomko 已提交
3001
    DO_TEST("fd-memory-no-numa-topology", QEMU_CAPS_OBJECT_MEMORY_FILE,
3002 3003
            QEMU_CAPS_KVM);

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

3006 3007 3008 3009 3010 3011 3012 3013
    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);

3014 3015 3016 3017 3018 3019 3020 3021 3022
    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 已提交
3023
    DO_TEST("vmcoreinfo", QEMU_CAPS_DEVICE_VMCOREINFO);
3024

3025 3026 3027
    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,
3028
            QEMU_CAPS_DEVICE_ISA_SERIAL,
3029
            QEMU_CAPS_HDA_DUPLEX,
3030 3031
            QEMU_CAPS_CCID_EMULATED,
            QEMU_CAPS_QCOW2_LUKS, QEMU_CAPS_OBJECT_SECRET);
3032
    DO_TEST("user-aliases2", QEMU_CAPS_DEVICE_IOH3420, QEMU_CAPS_ICH9_AHCI);
3033 3034
    DO_TEST("user-aliases-usb", QEMU_CAPS_KVM,
            QEMU_CAPS_PIIX_DISABLE_S3, QEMU_CAPS_PIIX_DISABLE_S4,
3035
            QEMU_CAPS_ICH9_USB_EHCI1);
3036

3037
    DO_TEST_CAPS_VER("disk-virtio-scsi-reservations", "2.12.0");
3038
    DO_TEST_CAPS_LATEST("disk-virtio-scsi-reservations");
3039

3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064
    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);

3065
    DO_TEST("video-virtio-gpu-ccw", QEMU_CAPS_CCW,
3066 3067 3068 3069 3070 3071
            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);

3072
    DO_TEST("input-virtio-ccw", QEMU_CAPS_CCW,
3073 3074 3075 3076 3077 3078 3079
            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);

3080 3081
    DO_TEST_CAPS_LATEST("vhost-vsock");
    DO_TEST_CAPS_LATEST("vhost-vsock-auto");
3082 3083
    DO_TEST_CAPS_ARCH_LATEST("vhost-vsock-ccw", "s390x");
    DO_TEST_CAPS_ARCH_LATEST("vhost-vsock-ccw-auto", "s390x");
3084

3085
    DO_TEST_CAPS_VER("launch-security-sev", "2.12.0");
3086

L
Lubomir Rintel 已提交
3087 3088
    DO_TEST("riscv64-virt",
            QEMU_CAPS_DEVICE_VIRTIO_MMIO);
3089 3090
    DO_TEST("riscv64-virt-pci",
            QEMU_CAPS_OBJECT_GPEX);
L
Lubomir Rintel 已提交
3091

3092 3093 3094 3095 3096
    /* 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");
3097 3098 3099 3100
    DO_TEST_PARSE_ERROR("virtio-transitional-not-supported",
                        QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
                        QEMU_CAPS_DEVICE_PCI_BRIDGE,
                        QEMU_CAPS_DEVICE_IOH3420);
3101

3102 3103 3104 3105 3106 3107 3108 3109
    /* 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");

3110 3111 3112
    /* 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");
3113
    DO_TEST_CAPS_ARCH_LATEST("s390x-ccw-graphics", "s390x");
3114 3115 3116
    DO_TEST_CAPS_ARCH_LATEST("x86_64-pc-graphics", "x86_64");
    DO_TEST_CAPS_ARCH_LATEST("x86_64-q35-graphics", "x86_64");

3117 3118 3119 3120 3121
    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 已提交
3122 3123 3124
    if (getenv("LIBVIRT_SKIP_CLEANUP") == NULL)
        virFileDeleteTree(fakerootdir);

3125
    VIR_FREE(driver.config->nbdTLSx509certdir);
3126
    qemuTestDriverFree(&driver);
A
Andrea Bolognani 已提交
3127
    VIR_FREE(fakerootdir);
3128
    virHashFree(capslatest);
3129
    virFileWrapperClearPrefixes();
3130

3131
    return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
3132 3133
}

3134
VIR_TEST_MAIN_PRELOAD(mymain,
A
Andrea Bolognani 已提交
3135 3136 3137 3138
                      abs_builddir "/.libs/qemuxml2argvmock.so",
                      abs_builddir "/.libs/virrandommock.so",
                      abs_builddir "/.libs/qemucpumock.so",
                      abs_builddir "/.libs/virpcimock.so")
3139

3140 3141
#else

3142 3143 3144 3145
int main(void)
{
    return EXIT_AM_SKIP;
}
3146 3147

#endif /* WITH_QEMU */