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

3
#include <stdio.h>
4 5
#include <stdlib.h>
#include <unistd.h>
6 7 8 9 10
#include <string.h>

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

11 12
#include "testutils.h"

13 14
#ifdef WITH_QEMU

15
# include "internal.h"
16
# include "viralloc.h"
17 18
# include "qemu/qemu_capabilities.h"
# include "qemu/qemu_command.h"
M
Matthias Bolte 已提交
19
# include "qemu/qemu_domain.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 "testutilsqemu.h"
28

29 30
# define VIR_FROM_THIS VIR_FROM_QEMU

31
static const char *abs_top_srcdir;
32
static virQEMUDriver driver;
33

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

static virSecretPtr
fakeSecretLookupByUsage(virConnectPtr conn,
                        int usageType ATTRIBUTE_UNUSED,
                        const char *usageID)
{
52
    unsigned char uuid[VIR_UUID_BUFLEN];
53 54
    if (STRNEQ(usageID, "mycluster_myname"))
        return NULL;
55

56 57 58
    if (virUUIDGenerate(uuid) < 0)
        return NULL;

59
    return virGetSecret(conn, uuid, usageType, usageID);
60 61 62
}

static virSecretDriver fakeSecretDriver = {
63 64 65 66 67 68 69 70 71
    .connectNumOfSecrets = NULL,
    .connectListSecrets = NULL,
    .secretLookupByUUID = NULL,
    .secretLookupByUsage = fakeSecretLookupByUsage,
    .secretDefineXML = NULL,
    .secretGetXMLDesc = NULL,
    .secretSetValue = NULL,
    .secretGetValue = fakeSecretGetValue,
    .secretUndefine = NULL,
72 73
};

74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100

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

101
 cleanup:
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
    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);

138
 cleanup:
139 140 141
    virStringFreeList(volinfo);
    return ret;

142
 fallback:
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 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
    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;

    if (virtTestLoadFile(xmlpath, &xmlbuf) < 0) {
        virReportError(VIR_ERR_INTERNAL_ERROR,
                       "failed to load XML file '%s'",
                       xmlpath);
        goto cleanup;
    }

201
 cleanup:
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218
    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
219
 * qemu command line.
220 221 222
 *
 * There are a few "magic" values to pass to these functions:
 *
223 224
 * 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
225 226 227
 * 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
228
 * pattern VOLUME_TYPE+VOLUME_PATH can be used to simulate a volume in a pool.
229 230 231 232 233 234 235 236 237 238 239 240
 * 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,
};

241 242 243 244 245
typedef enum {
    FLAG_EXPECT_ERROR       = 1 << 0,
    FLAG_EXPECT_FAILURE     = 1 << 1,
    FLAG_EXPECT_PARSE_ERROR = 1 << 2,
    FLAG_JSON               = 1 << 3,
246
    FLAG_FIPS               = 1 << 4,
247 248
} virQemuXML2ArgvTestFlags;

249
static int testCompareXMLToArgvFiles(const char *xml,
E
Eric Blake 已提交
250
                                     const char *cmdline,
251
                                     virQEMUCapsPtr extraFlags,
J
Jiri Denemark 已提交
252
                                     const char *migrateFrom,
253
                                     int migrateFd,
254
                                     virQemuXML2ArgvTestFlags flags)
255
{
256
    char *actualargv = NULL;
E
Eric Blake 已提交
257
    int ret = -1;
258
    virDomainDefPtr vmdef = NULL;
259
    virDomainChrSourceDef monitor_chr;
260
    virConnectPtr conn;
J
Jiri Denemark 已提交
261
    char *log = NULL;
E
Eric Blake 已提交
262
    virCommandPtr cmd = NULL;
263
    size_t i;
264
    virBitmapPtr nodeset = NULL;
265 266

    if (!(conn = virGetConnect()))
267
        goto out;
268
    conn->secretDriver = &fakeSecretDriver;
269
    conn->storageDriver = &fakeStorageDriver;
270

271 272 273
    if (virBitmapParse("0-3", '\0', &nodeset, 4) < 0)
        goto out;

274
    if (!(vmdef = virDomainDefParseFile(xml, driver.caps, driver.xmlopt,
275
                                        VIR_DOMAIN_DEF_PARSE_INACTIVE))) {
276 277
        if (!virtTestOOMActive() &&
            (flags & FLAG_EXPECT_PARSE_ERROR))
278
            goto ok;
279
        goto out;
280
    }
281

282
    if (!virDomainDefCheckABIStability(vmdef, vmdef)) {
283
        VIR_TEST_DEBUG("ABI stability check failed on %s", xml);
284 285 286
        goto out;
    }

287
    vmdef->id = -1;
288

289
    memset(&monitor_chr, 0, sizeof(monitor_chr));
290 291 292
    monitor_chr.type = VIR_DOMAIN_CHR_TYPE_UNIX;
    monitor_chr.data.nix.path = (char *)"/tmp/test-monitor";
    monitor_chr.data.nix.listen = true;
293

294 295 296 297 298
    virQEMUCapsSetList(extraFlags,
                       QEMU_CAPS_VNC_COLON,
                       QEMU_CAPS_NO_REBOOT,
                       QEMU_CAPS_NO_ACPI,
                       QEMU_CAPS_LAST);
299

300 301 302
    if (STREQ(vmdef->os.machine, "pc") &&
        STREQ(vmdef->emulator, "/usr/bin/qemu-system-x86_64")) {
        VIR_FREE(vmdef->os.machine);
303
        if (VIR_STRDUP(vmdef->os.machine, "pc-0.11") < 0)
304 305
            goto out;
    }
306

307 308
    virQEMUCapsFilterByMachineType(extraFlags, vmdef->os.machine);

309
    if (virQEMUCapsGet(extraFlags, QEMU_CAPS_DEVICE)) {
310
        if (qemuDomainAssignAddresses(vmdef, extraFlags, NULL)) {
311
            if (flags & FLAG_EXPECT_ERROR)
312
                goto ok;
313
            goto out;
314
        }
315 316
    }

317 318
    log = virtTestLogContentAndReset();
    VIR_FREE(log);
319
    virResetLastError();
J
Jiri Denemark 已提交
320

321 322
    if (vmdef->os.arch == VIR_ARCH_X86_64 ||
        vmdef->os.arch == VIR_ARCH_I686) {
323
        virQEMUCapsSet(extraFlags, QEMU_CAPS_PCI_MULTIBUS);
324 325
    }

326
    if (qemuAssignDeviceAliases(vmdef, extraFlags) < 0)
327
        goto out;
328

329 330 331 332 333 334 335 336 337 338
    for (i = 0; i < vmdef->nhostdevs; i++) {
        virDomainHostdevDefPtr hostdev = vmdef->hostdevs[i];

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

339
    for (i = 0; i < vmdef->ndisks; i++) {
340
        if (virStorageTranslateDiskSourcePool(conn, vmdef->disks[i]) < 0)
341 342 343
            goto out;
    }

344 345
    if (!(cmd = qemuBuildCommandLine(conn, &driver, vmdef, &monitor_chr,
                                     (flags & FLAG_JSON), extraFlags,
346
                                     migrateFrom, migrateFd, NULL,
347
                                     VIR_NETDEV_VPORT_PROFILE_OP_NO_OP,
348
                                     &testCallbacks, false,
349
                                     (flags & FLAG_FIPS),
350
                                     nodeset, NULL, NULL))) {
351 352
        if (!virtTestOOMActive() &&
            (flags & FLAG_EXPECT_FAILURE)) {
353
            ret = 0;
354 355
            VIR_TEST_DEBUG("Got expected error: %s\n",
                    virGetLastErrorMessage());
356 357 358
            virResetLastError();
        }
        goto out;
359
    } else if (flags & FLAG_EXPECT_FAILURE) {
360
        VIR_TEST_DEBUG("qemuBuildCommandLine should have failed\n");
361 362
        goto out;
    }
363

364 365
    if (!virtTestOOMActive() &&
        (!!virGetLastError() != !!(flags & FLAG_EXPECT_ERROR))) {
366 367
        if ((log = virtTestLogContentAndReset()))
            VIR_TEST_DEBUG("\n%s", log);
368
        goto out;
J
Jiri Denemark 已提交
369 370
    }

E
Eric Blake 已提交
371
    if (!(actualargv = virCommandToString(cmd)))
372
        goto out;
E
Eric Blake 已提交
373

C
Cole Robinson 已提交
374
    if (virtTestCompareToFile(actualargv, cmdline) < 0)
375
        goto out;
376

377
 ok:
378 379
    if (!virtTestOOMActive() &&
        (flags & FLAG_EXPECT_ERROR)) {
380 381 382 383
        /* need to suppress the errors */
        virResetLastError();
    }

384 385
    ret = 0;

386
 out:
387 388
    VIR_FREE(log);
    VIR_FREE(actualargv);
E
Eric Blake 已提交
389
    virCommandFree(cmd);
390
    virDomainDefFree(vmdef);
391
    virObjectUnref(conn);
392
    virBitmapFree(nodeset);
393 394 395 396
    return ret;
}


397 398
struct testInfo {
    const char *name;
399
    virQEMUCapsPtr extraFlags;
400
    const char *migrateFrom;
401
    int migrateFd;
402
    unsigned int flags;
403 404
};

405 406 407 408
static int
testCompareXMLToArgvHelper(const void *data)
{
    int result = -1;
409
    const struct testInfo *info = data;
410 411
    char *xml = NULL;
    char *args = NULL;
412
    unsigned int flags = info->flags;
413 414 415 416 417 418 419

    if (virAsprintf(&xml, "%s/qemuxml2argvdata/qemuxml2argv-%s.xml",
                    abs_srcdir, info->name) < 0 ||
        virAsprintf(&args, "%s/qemuxml2argvdata/qemuxml2argv-%s.args",
                    abs_srcdir, info->name) < 0)
        goto cleanup;

420
    if (virQEMUCapsGet(info->extraFlags, QEMU_CAPS_MONITOR_JSON))
421 422
        flags |= FLAG_JSON;

423 424 425
    if (virQEMUCapsGet(info->extraFlags, QEMU_CAPS_ENABLE_FIPS))
        flags |= FLAG_FIPS;

426
    result = testCompareXMLToArgvFiles(xml, args, info->extraFlags,
427
                                       info->migrateFrom, info->migrateFd,
428
                                       flags);
429

430
 cleanup:
431 432
    VIR_FREE(xml);
    VIR_FREE(args);
433
    return result;
434 435 436
}


437
static int
438
testAddCPUModels(virQEMUCapsPtr caps, bool skipLegacy)
439 440 441 442
{
    const char *newModels[] = {
        "Opteron_G3", "Opteron_G2", "Opteron_G1",
        "Nehalem", "Penryn", "Conroe",
443
        "Haswell-noTSX", "Haswell",
444 445 446 447 448 449 450 451
    };
    const char *legacyModels[] = {
        "n270", "athlon", "pentium3", "pentium2", "pentium",
        "486", "coreduo", "kvm32", "qemu32", "kvm64",
        "core2duo", "phenom", "qemu64",
    };
    size_t i;

452
    for (i = 0; i < ARRAY_CARDINALITY(newModels); i++) {
453
        if (virQEMUCapsAddCPUDefinition(caps, newModels[i]) < 0)
454 455 456 457
            return -1;
    }
    if (skipLegacy)
        return 0;
458
    for (i = 0; i < ARRAY_CARDINALITY(legacyModels); i++) {
459
        if (virQEMUCapsAddCPUDefinition(caps, legacyModels[i]) < 0)
460 461 462 463 464
            return -1;
    }
    return 0;
}

465

466
static int
E
Eric Blake 已提交
467
mymain(void)
468 469
{
    int ret = 0;
470
    bool skipLegacyCPUs = false;
471

472 473
    abs_top_srcdir = getenv("abs_top_srcdir");
    if (!abs_top_srcdir)
474
        abs_top_srcdir = abs_srcdir "/..";
475

476 477 478 479 480 481 482 483 484 485
    /* 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;
    }

486
    driver.config = virQEMUDriverConfigNew(false);
487 488
    if (driver.config == NULL)
        return EXIT_FAILURE;
489 490

    driver.privileged = true;
491

492 493 494
    VIR_FREE(driver.config->spiceListen);
    VIR_FREE(driver.config->vncListen);

495
    VIR_FREE(driver.config->vncTLSx509certdir);
496
    if (VIR_STRDUP_QUIET(driver.config->vncTLSx509certdir, "/etc/pki/libvirt-vnc") < 0)
497 498
        return EXIT_FAILURE;
    VIR_FREE(driver.config->spiceTLSx509certdir);
499
    if (VIR_STRDUP_QUIET(driver.config->spiceTLSx509certdir, "/etc/pki/libvirt-spice") < 0)
500 501
        return EXIT_FAILURE;

502 503
    if ((driver.caps = testQemuCapsInit()) == NULL)
        return EXIT_FAILURE;
504
    if (!(driver.xmlopt = virQEMUDriverCreateXMLConf(&driver)))
505
        return EXIT_FAILURE;
506
    VIR_FREE(driver.config->stateDir);
507
    if (VIR_STRDUP_QUIET(driver.config->stateDir, "/nowhere") < 0)
508
        return EXIT_FAILURE;
509
    VIR_FREE(driver.config->hugetlbfs);
510
    if (VIR_ALLOC_N(driver.config->hugetlbfs, 2) < 0)
511
        return EXIT_FAILURE;
512 513 514
    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)
515
        return EXIT_FAILURE;
516 517
    driver.config->hugetlbfs[0].size = 2048;
    driver.config->hugetlbfs[0].deflt = true;
518
    driver.config->hugetlbfs[1].size = 1048576;
519
    driver.config->spiceTLS = 1;
520
    if (VIR_STRDUP_QUIET(driver.config->spicePassword, "123456") < 0)
521
        return EXIT_FAILURE;
522

523
# define DO_TEST_FULL(name, migrateFrom, migrateFd, flags, ...)         \
524
    do {                                                                \
525
        static struct testInfo info = {                                 \
526
            name, NULL, migrateFrom, migrateFd, (flags)                 \
J
Jiri Denemark 已提交
527
        };                                                              \
528
        if (!(info.extraFlags = virQEMUCapsNew()))                      \
529
            return EXIT_FAILURE;                                        \
530 531
        if (testAddCPUModels(info.extraFlags, skipLegacyCPUs) < 0)      \
            return EXIT_FAILURE;                                        \
532
        virQEMUCapsSetList(info.extraFlags, __VA_ARGS__, QEMU_CAPS_LAST);\
533
        if (virtTestRun("QEMU XML-2-ARGV " name,                        \
534
                        testCompareXMLToArgvHelper, &info) < 0)         \
535
            ret = -1;                                                   \
536
        virObjectUnref(info.extraFlags);                                \
537 538
    } while (0)

539 540 541 542 543
# define DO_TEST(name, ...)                                             \
    DO_TEST_FULL(name, NULL, -1, 0, __VA_ARGS__)

# define DO_TEST_ERROR(name, ...)                                       \
    DO_TEST_FULL(name, NULL, -1, FLAG_EXPECT_ERROR, __VA_ARGS__)
544 545

# define DO_TEST_FAILURE(name, ...)                                     \
546 547 548 549 550 551
    DO_TEST_FULL(name, NULL, -1, FLAG_EXPECT_FAILURE, __VA_ARGS__)

# define DO_TEST_PARSE_ERROR(name, ...)                                 \
    DO_TEST_FULL(name, NULL, -1,                                        \
                 FLAG_EXPECT_PARSE_ERROR | FLAG_EXPECT_ERROR,           \
                 __VA_ARGS__)
552

553 554 555 556 557 558 559 560 561 562 563 564 565 566 567
# ifdef __linux__
    /* This is a macro that invokes test only on Linux. It's
     * meant to be called in those cases where qemuxml2argvmock
     * cooperation is expected (e.g. we need a fixed time,
     * predictable NUMA topology and so on). On non-Linux
     * platforms the macro just consume its argument. */
#  define DO_TEST_LINUX(name, ...)                                      \
    DO_TEST_FULL(name, NULL, -1, 0, __VA_ARGS__)
# else  /* __linux__ */
#  define DO_TEST_LINUX(name, ...)                                      \
    do {                                                                \
        const char *tmp ATTRIBUTE_UNUSED = name;                        \
    } while (0)
# endif /* __linux__ */

568
# define NONE QEMU_CAPS_LAST
569

570 571 572
    /* 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 */
573 574 575 576 577 578 579
    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");
580 581
    unsetenv("QEMU_AUDIO_DRV");
    unsetenv("SDL_AUDIODRIVER");
582

583
    DO_TEST("minimal", QEMU_CAPS_NAME);
584
    DO_TEST_PARSE_ERROR("minimal-no-memory", NONE);
585
    DO_TEST("minimal-msg-timestamp", QEMU_CAPS_NAME, QEMU_CAPS_MSG_TIMESTAMP);
586 587
    DO_TEST("minimal-s390", QEMU_CAPS_NAME);
    DO_TEST("machine-aliases1", NONE);
588
    DO_TEST("machine-aliases2", QEMU_CAPS_KVM);
589 590 591 592
    DO_TEST("machine-core-on", QEMU_CAPS_MACHINE_OPT,
            QEMU_CAPS_DUMP_GUEST_CORE);
    DO_TEST("machine-core-off", QEMU_CAPS_MACHINE_OPT,
            QEMU_CAPS_DUMP_GUEST_CORE);
593
    DO_TEST_FAILURE("machine-core-on", NONE);
594
    DO_TEST_FAILURE("machine-core-on", QEMU_CAPS_MACHINE_OPT);
L
Li Zhang 已提交
595 596
    DO_TEST("machine-usb-opt", QEMU_CAPS_MACHINE_OPT,
            QEMU_CAPS_MACHINE_USB_OPT);
597 598 599 600
    DO_TEST("machine-vmport-opt", QEMU_CAPS_MACHINE_OPT,
            QEMU_CAPS_MACHINE_VMPORT_OPT);
    DO_TEST_FAILURE("machine-xen-vmport-opt", QEMU_CAPS_MACHINE_OPT,
            QEMU_CAPS_MACHINE_VMPORT_OPT);
601
    DO_TEST("kvm", QEMU_CAPS_MACHINE_OPT);
602 603
    DO_TEST("default-kvm-host-arch", QEMU_CAPS_MACHINE_OPT);
    DO_TEST("default-qemu-host-arch", QEMU_CAPS_MACHINE_OPT);
604 605 606 607 608
    DO_TEST("boot-cdrom", NONE);
    DO_TEST("boot-network", NONE);
    DO_TEST("boot-floppy", NONE);
    DO_TEST("boot-multi", QEMU_CAPS_BOOT_MENU);
    DO_TEST("boot-menu-enable",
609
            QEMU_CAPS_BOOT_MENU, QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE);
610
    DO_TEST("boot-menu-enable",
611 612
            QEMU_CAPS_BOOT_MENU, QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE,
            QEMU_CAPS_BOOTINDEX);
613 614 615 616
    DO_TEST("boot-menu-enable-with-timeout",
            QEMU_CAPS_BOOT_MENU, QEMU_CAPS_DEVICE,
            QEMU_CAPS_DRIVE, QEMU_CAPS_SPLASH_TIMEOUT);
    DO_TEST_FAILURE("boot-menu-enable-with-timeout", QEMU_CAPS_BOOT_MENU);
617
    DO_TEST_PARSE_ERROR("boot-menu-enable-with-timeout-invalid", NONE);
618 619
    DO_TEST("boot-menu-disable", QEMU_CAPS_BOOT_MENU);
    DO_TEST("boot-menu-disable-drive",
620
            QEMU_CAPS_BOOT_MENU, QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE);
621
    DO_TEST("boot-menu-disable-drive-bootindex",
622 623
            QEMU_CAPS_BOOT_MENU, QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE,
            QEMU_CAPS_BOOTINDEX);
624 625 626
    DO_TEST_PARSE_ERROR("boot-dev+order",
            QEMU_CAPS_BOOTINDEX, QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE,
            QEMU_CAPS_VIRTIO_BLK_SCSI, QEMU_CAPS_VIRTIO_BLK_SG_IO);
627
    DO_TEST("boot-order",
628 629
            QEMU_CAPS_BOOTINDEX, QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE,
            QEMU_CAPS_VIRTIO_BLK_SCSI, QEMU_CAPS_VIRTIO_BLK_SG_IO);
630
    DO_TEST("boot-complex",
631 632
            QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_BOOT,
            QEMU_CAPS_VIRTIO_BLK_SCSI, QEMU_CAPS_VIRTIO_BLK_SG_IO);
633
    DO_TEST("boot-complex-bootindex",
634
            QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_BOOT,
635 636
            QEMU_CAPS_BOOTINDEX,
            QEMU_CAPS_VIRTIO_BLK_SCSI, QEMU_CAPS_VIRTIO_BLK_SG_IO);
637 638 639 640
    DO_TEST("boot-strict",
            QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_BOOT,
            QEMU_CAPS_BOOTINDEX, QEMU_CAPS_BOOT_STRICT,
            QEMU_CAPS_VIRTIO_BLK_SCSI, QEMU_CAPS_VIRTIO_BLK_SG_IO);
641 642 643 644 645

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

646
    DO_TEST("bios", QEMU_CAPS_DEVICE, QEMU_CAPS_SGA);
647 648
    DO_TEST("bios-nvram", QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE,
            QEMU_CAPS_DRIVE_FORMAT, QEMU_CAPS_DRIVE_READONLY);
L
Laine Stump 已提交
649
    DO_TEST("clock-utc", QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DEVICE);
650
    DO_TEST("clock-localtime", NONE);
651
    DO_TEST("clock-localtime-basis-localtime", QEMU_CAPS_RTC);
652 653
    DO_TEST("clock-variable", QEMU_CAPS_RTC);
    DO_TEST("clock-france", QEMU_CAPS_RTC);
654 655
    DO_TEST("clock-hpet-off", QEMU_CAPS_RTC, QEMU_CAPS_NO_HPET,
            QEMU_CAPS_NO_KVM_PIT);
656
    DO_TEST("clock-catchup", QEMU_CAPS_RTC, QEMU_CAPS_NO_KVM_PIT);
657 658 659
    DO_TEST("cpu-kvmclock", QEMU_CAPS_ENABLE_KVM);
    DO_TEST("cpu-host-kvmclock", QEMU_CAPS_ENABLE_KVM, QEMU_CAPS_CPU_HOST);
    DO_TEST("kvmclock", QEMU_CAPS_KVM);
660
    DO_TEST("clock-timer-hyperv-rtc", QEMU_CAPS_KVM);
661

662 663
    DO_TEST("cpu-eoi-disabled", QEMU_CAPS_ENABLE_KVM);
    DO_TEST("cpu-eoi-enabled", QEMU_CAPS_ENABLE_KVM);
664 665 666 667 668 669
    DO_TEST("controller-order", QEMU_CAPS_DRIVE, QEMU_CAPS_PCIDEVICE,
            QEMU_CAPS_KVM, QEMU_CAPS_DEVICE, QEMU_CAPS_ENABLE_KVM,
            QEMU_CAPS_BOOT_MENU, QEMU_CAPS_PIIX3_USB_UHCI,
            QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_DRIVE_AIO,
            QEMU_CAPS_CCID_PASSTHRU, QEMU_CAPS_CHARDEV,
            QEMU_CAPS_CHARDEV_SPICEVMC, QEMU_CAPS_SPICE, QEMU_CAPS_HDA_DUPLEX);
670 671
    DO_TEST("eoi-disabled", NONE);
    DO_TEST("eoi-enabled", NONE);
672 673
    DO_TEST("pv-spinlock-disabled", NONE);
    DO_TEST("pv-spinlock-enabled", NONE);
M
Martin Kletzander 已提交
674
    DO_TEST("kvmclock+eoi-disabled", QEMU_CAPS_ENABLE_KVM);
675

676
    DO_TEST("hyperv", NONE);
677
    DO_TEST("hyperv-off", NONE);
678

679 680 681
    DO_TEST("kvm-features", NONE);
    DO_TEST("kvm-features-off", NONE);

682 683 684
    DO_TEST("pmu-feature", NONE);
    DO_TEST("pmu-feature-off", NONE);

685
    DO_TEST("hugepages", QEMU_CAPS_MEM_PATH);
686 687 688 689 690 691 692
    DO_TEST("hugepages-numa", QEMU_CAPS_RTC, QEMU_CAPS_NO_KVM_PIT,
            QEMU_CAPS_DISABLE_S3, QEMU_CAPS_DISABLE_S4,
            QEMU_CAPS_DEVICE, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DRIVE,
            QEMU_CAPS_ICH9_USB_EHCI1, QEMU_CAPS_PCI_MULTIFUNCTION,
            QEMU_CAPS_SPICE, QEMU_CAPS_CHARDEV_SPICEVMC,
            QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL,
            QEMU_CAPS_HDA_DUPLEX, QEMU_CAPS_USB_REDIR,
693
            QEMU_CAPS_DEVICE_PC_DIMM,
694
            QEMU_CAPS_MEM_PATH, QEMU_CAPS_OBJECT_MEMORY_FILE);
695 696 697
    DO_TEST_LINUX("hugepages-pages", QEMU_CAPS_MEM_PATH,
                  QEMU_CAPS_OBJECT_MEMORY_RAM,
                  QEMU_CAPS_OBJECT_MEMORY_FILE);
698 699 700 701
    DO_TEST("hugepages-pages2", QEMU_CAPS_MEM_PATH, QEMU_CAPS_OBJECT_MEMORY_RAM,
            QEMU_CAPS_OBJECT_MEMORY_FILE);
    DO_TEST("hugepages-pages3", QEMU_CAPS_MEM_PATH, QEMU_CAPS_OBJECT_MEMORY_RAM,
            QEMU_CAPS_OBJECT_MEMORY_FILE);
702 703 704
    DO_TEST_LINUX("hugepages-shared", QEMU_CAPS_MEM_PATH,
                  QEMU_CAPS_OBJECT_MEMORY_RAM,
                  QEMU_CAPS_OBJECT_MEMORY_FILE);
705
    DO_TEST_PARSE_ERROR("hugepages-memaccess-invalid", NONE);
706 707
    DO_TEST_FAILURE("hugepages-pages4", QEMU_CAPS_MEM_PATH,
            QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_OBJECT_MEMORY_FILE);
708
    DO_TEST("hugepages-pages5", QEMU_CAPS_MEM_PATH);
709
    DO_TEST("hugepages-pages6", NONE);
710
    DO_TEST("nosharepages", QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_MEM_MERGE);
711
    DO_TEST("disk-cdrom", NONE);
712
    DO_TEST("disk-iscsi", NONE);
713 714
    DO_TEST("disk-cdrom-network-http", QEMU_CAPS_KVM, QEMU_CAPS_DEVICE,
            QEMU_CAPS_DRIVE);
715 716
    DO_TEST("disk-cdrom-network-https", QEMU_CAPS_KVM, QEMU_CAPS_DEVICE,
            QEMU_CAPS_DRIVE);
717 718
    DO_TEST("disk-cdrom-network-ftp", QEMU_CAPS_KVM, QEMU_CAPS_DEVICE,
            QEMU_CAPS_DRIVE);
719 720
    DO_TEST("disk-cdrom-network-ftps", QEMU_CAPS_KVM, QEMU_CAPS_DEVICE,
            QEMU_CAPS_DRIVE);
721 722
    DO_TEST("disk-cdrom-network-tftp", QEMU_CAPS_KVM, QEMU_CAPS_DEVICE,
            QEMU_CAPS_DRIVE);
723 724
    DO_TEST("disk-cdrom-empty", QEMU_CAPS_DRIVE);
    DO_TEST("disk-cdrom-tray",
725
            QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_VIRTIO_TX_ALG);
726 727 728 729
    DO_TEST("disk-cdrom-tray-no-device-cap", NONE);
    DO_TEST("disk-floppy", NONE);
    DO_TEST("disk-floppy-tray-no-device-cap", NONE);
    DO_TEST("disk-floppy-tray",
730
            QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE);
731
    DO_TEST("disk-virtio-s390", QEMU_CAPS_DRIVE,
732
            QEMU_CAPS_DEVICE, QEMU_CAPS_VIRTIO_S390);
733 734
    DO_TEST("disk-many", NONE);
    DO_TEST("disk-virtio", QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_BOOT);
735 736 737 738
    DO_TEST("disk-virtio-ccw", QEMU_CAPS_DRIVE,
            QEMU_CAPS_DEVICE, QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
    DO_TEST("disk-virtio-ccw-many", QEMU_CAPS_DRIVE,
            QEMU_CAPS_DEVICE, QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
739 740
    DO_TEST("disk-virtio-scsi-ccw", QEMU_CAPS_DRIVE, QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_DEVICE, QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
741
    DO_TEST("disk-order",
742 743
            QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE_BOOT,
            QEMU_CAPS_VIRTIO_BLK_SCSI, QEMU_CAPS_VIRTIO_BLK_SG_IO);
744 745
    DO_TEST("disk-xenvbd", QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_BOOT);
    DO_TEST("disk-drive-boot-disk",
746
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_BOOT);
747
    DO_TEST("disk-drive-boot-cdrom",
748
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_BOOT);
749
    DO_TEST("floppy-drive-fat",
750
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_BOOT, QEMU_CAPS_DRIVE_FORMAT);
751
    DO_TEST("disk-drive-fat",
752
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_BOOT, QEMU_CAPS_DRIVE_FORMAT);
753
    DO_TEST("disk-drive-readonly-disk",
754 755
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_READONLY,
            QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
756
    DO_TEST("disk-drive-readonly-no-device",
757
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_READONLY, QEMU_CAPS_NODEFCONFIG);
758
    DO_TEST("disk-drive-fmt-qcow",
759
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_BOOT, QEMU_CAPS_DRIVE_FORMAT);
760
    DO_TEST("disk-drive-shared",
761
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_FORMAT, QEMU_CAPS_DRIVE_SERIAL);
762
    DO_TEST("disk-drive-cache-v1-wt",
763
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_FORMAT);
764
    DO_TEST("disk-drive-cache-v1-wb",
765
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_FORMAT);
766
    DO_TEST("disk-drive-cache-v1-none",
767
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_FORMAT);
768
    DO_TEST("disk-drive-error-policy-stop",
769
            QEMU_CAPS_DRIVE, QEMU_CAPS_MONITOR_JSON, QEMU_CAPS_DRIVE_FORMAT);
770
    DO_TEST("disk-drive-error-policy-enospace",
771
            QEMU_CAPS_DRIVE, QEMU_CAPS_MONITOR_JSON, QEMU_CAPS_DRIVE_FORMAT);
772
    DO_TEST("disk-drive-error-policy-wreport-rignore",
773
            QEMU_CAPS_DRIVE, QEMU_CAPS_MONITOR_JSON, QEMU_CAPS_DRIVE_FORMAT);
774
    DO_TEST("disk-drive-cache-v2-wt",
775
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_CACHE_V2, QEMU_CAPS_DRIVE_FORMAT);
776
    DO_TEST("disk-drive-cache-v2-wb",
777
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_CACHE_V2, QEMU_CAPS_DRIVE_FORMAT);
778
    DO_TEST("disk-drive-cache-v2-none",
779
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_CACHE_V2, QEMU_CAPS_DRIVE_FORMAT);
780
    DO_TEST("disk-drive-cache-directsync",
781 782
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_CACHE_V2,
            QEMU_CAPS_DRIVE_CACHE_DIRECTSYNC, QEMU_CAPS_DRIVE_FORMAT);
783
    DO_TEST("disk-drive-cache-unsafe",
784 785
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_CACHE_V2,
            QEMU_CAPS_DRIVE_CACHE_UNSAFE, QEMU_CAPS_DRIVE_FORMAT);
786 787 788
    DO_TEST("disk-drive-copy-on-read",
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_CACHE_V2,
            QEMU_CAPS_DRIVE_COPY_ON_READ, QEMU_CAPS_DRIVE_FORMAT);
789
    DO_TEST("disk-drive-network-nbd",
790
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_FORMAT);
P
Paolo Bonzini 已提交
791 792
    DO_TEST("disk-drive-network-nbd-export",
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_FORMAT);
P
Paolo Bonzini 已提交
793 794 795 796
    DO_TEST("disk-drive-network-nbd-ipv6",
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_FORMAT);
    DO_TEST("disk-drive-network-nbd-ipv6-export",
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_FORMAT);
797 798
    DO_TEST("disk-drive-network-nbd-unix",
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_FORMAT);
P
Paolo Bonzini 已提交
799 800
    DO_TEST("disk-drive-network-iscsi",
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_FORMAT);
801 802
    DO_TEST("disk-drive-network-iscsi-auth",
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_FORMAT);
803 804 805 806
    DO_TEST("disk-drive-network-iscsi-lun",
            QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE_FORMAT,
            QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_VIRTIO_BLK_SG_IO, QEMU_CAPS_SCSI_BLOCK);
807 808
    DO_TEST("disk-drive-network-gluster",
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_FORMAT);
809
    DO_TEST("disk-drive-network-rbd",
810
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_FORMAT);
811
    DO_TEST("disk-drive-network-sheepdog",
812
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_FORMAT);
813
    DO_TEST("disk-drive-network-rbd-auth",
814
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_FORMAT);
815 816
    DO_TEST("disk-drive-network-rbd-ipv6",
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_FORMAT);
817
    DO_TEST_FAILURE("disk-drive-network-rbd-no-colon",
818
                    QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_FORMAT);
819
    DO_TEST("disk-drive-no-boot",
820
            QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_BOOTINDEX);
821 822
    DO_TEST_FAILURE("disk-device-lun-type-invalid",
                    QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_VIRTIO_SCSI);
823 824
    DO_TEST("disk-usb",  NONE);
    DO_TEST("disk-usb-device",
825 826
            QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_USB_STORAGE,
            QEMU_CAPS_NODEFCONFIG);
827 828 829
    DO_TEST("disk-usb-device-removable",
            QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_USB_STORAGE,
            QEMU_CAPS_USB_STORAGE_REMOVABLE, QEMU_CAPS_NODEFCONFIG);
830 831 832
    DO_TEST_FAILURE("disk-usb-pci",
                    QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE,
                    QEMU_CAPS_DEVICE_USB_STORAGE, QEMU_CAPS_NODEFCONFIG);
833
    DO_TEST("disk-scsi-device",
834 835
            QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_SCSI_LSI);
836
    DO_TEST("disk-scsi-device-auto",
837 838
            QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_SCSI_LSI);
839
    DO_TEST("disk-scsi-disk-split",
840
            QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
841
            QEMU_CAPS_SCSI_CD, QEMU_CAPS_SCSI_LSI, QEMU_CAPS_VIRTIO_SCSI);
842 843
    DO_TEST("disk-scsi-disk-wwn",
            QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
844
            QEMU_CAPS_SCSI_CD, QEMU_CAPS_SCSI_LSI, QEMU_CAPS_VIRTIO_SCSI,
845 846 847
            QEMU_CAPS_SCSI_DISK_WWN);
    DO_TEST("disk-scsi-disk-vpd",
            QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
848
            QEMU_CAPS_SCSI_CD, QEMU_CAPS_SCSI_LSI, QEMU_CAPS_VIRTIO_SCSI,
849 850 851
            QEMU_CAPS_SCSI_DISK_WWN);
    DO_TEST_FAILURE("disk-scsi-disk-vpd-build-error",
            QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
852
            QEMU_CAPS_SCSI_CD, QEMU_CAPS_SCSI_LSI, QEMU_CAPS_VIRTIO_SCSI,
853
            QEMU_CAPS_SCSI_DISK_WWN);
854
    DO_TEST("disk-scsi-vscsi",
855
            QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
856
    DO_TEST("disk-scsi-virtio-scsi",
857
            QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
858
            QEMU_CAPS_VIRTIO_SCSI);
859 860 861
    DO_TEST("disk-virtio-scsi-num_queues",
            QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_VIRTIO_SCSI);
862 863 864 865 866 867
    DO_TEST("disk-virtio-scsi-cmd_per_lun",
            QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_VIRTIO_SCSI);
    DO_TEST("disk-virtio-scsi-max_sectors",
            QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_VIRTIO_SCSI);
868 869 870
    DO_TEST("disk-scsi-megasas",
            QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_SCSI_MEGASAS);
871
    DO_TEST("disk-sata-device",
J
Jim Fehlig 已提交
872 873
            QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE,
            QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_ICH9_AHCI);
874
    DO_TEST("disk-aio",
875 876
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_AIO,
            QEMU_CAPS_DRIVE_CACHE_V2, QEMU_CAPS_DRIVE_FORMAT);
877 878
    DO_TEST("disk-source-pool",
            QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
879 880
    DO_TEST("disk-source-pool-mode",
            QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
881
    DO_TEST("disk-ioeventfd",
882
            QEMU_CAPS_DRIVE, QEMU_CAPS_VIRTIO_IOEVENTFD,
883
            QEMU_CAPS_VIRTIO_TX_ALG, QEMU_CAPS_DEVICE,
O
Osier Yang 已提交
884
            QEMU_CAPS_VIRTIO_BLK_SCSI, QEMU_CAPS_VIRTIO_BLK_SG_IO);
885
    DO_TEST("disk-copy_on_read",
O
Osier Yang 已提交
886 887
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_COPY_ON_READ,
            QEMU_CAPS_VIRTIO_TX_ALG, QEMU_CAPS_DEVICE,
888
            QEMU_CAPS_VIRTIO_BLK_SCSI, QEMU_CAPS_VIRTIO_BLK_SG_IO);
O
Osier Yang 已提交
889 890 891
    DO_TEST("disk-drive-discard",
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_DISCARD,
            QEMU_CAPS_DEVICE);
892
    DO_TEST("disk-snapshot",
893
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_CACHE_V2, QEMU_CAPS_DRIVE_FORMAT);
894
    DO_TEST("event_idx",
895 896 897
            QEMU_CAPS_DRIVE,
            QEMU_CAPS_VIRTIO_BLK_EVENT_IDX,
            QEMU_CAPS_VIRTIO_NET_EVENT_IDX,
898 899
            QEMU_CAPS_DEVICE,
            QEMU_CAPS_VIRTIO_BLK_SCSI, QEMU_CAPS_VIRTIO_BLK_SG_IO);
900
    DO_TEST("virtio-lun",
901 902 903
            QEMU_CAPS_DRIVE,
            QEMU_CAPS_DEVICE,
            QEMU_CAPS_VIRTIO_BLK_SCSI, QEMU_CAPS_VIRTIO_BLK_SG_IO);
904
    DO_TEST("disk-scsi-lun-passthrough",
905 906
            QEMU_CAPS_DRIVE,
            QEMU_CAPS_DEVICE,
907
            QEMU_CAPS_SCSI_BLOCK, QEMU_CAPS_VIRTIO_BLK_SG_IO,
908
            QEMU_CAPS_SCSI_LSI, QEMU_CAPS_VIRTIO_SCSI);
909 910 911 912 913
    DO_TEST("disk-serial",
            QEMU_CAPS_KVM,
            QEMU_CAPS_DEVICE,
            QEMU_CAPS_DRIVE,
            QEMU_CAPS_DRIVE_SERIAL);
914

915 916
    DO_TEST("graphics-vnc", QEMU_CAPS_VNC);
    DO_TEST("graphics-vnc-socket", QEMU_CAPS_VNC);
917
    DO_TEST("graphics-vnc-websocket", QEMU_CAPS_VNC, QEMU_CAPS_VNC_WEBSOCKET);
918
    DO_TEST("graphics-vnc-policy", QEMU_CAPS_VNC, QEMU_CAPS_VNC_SHARE_POLICY);
919

920 921
    driver.config->vncSASL = 1;
    VIR_FREE(driver.config->vncSASLdir);
922
    ignore_value(VIR_STRDUP(driver.config->vncSASLdir, "/root/.sasl2"));
923
    DO_TEST("graphics-vnc-sasl", QEMU_CAPS_VNC, QEMU_CAPS_VGA);
924 925
    driver.config->vncTLS = 1;
    driver.config->vncTLSx509verify = 1;
926
    DO_TEST("graphics-vnc-tls", QEMU_CAPS_VNC);
927
    driver.config->vncSASL = driver.config->vncTLSx509verify = driver.config->vncTLS = 0;
928 929
    VIR_FREE(driver.config->vncSASLdir);
    VIR_FREE(driver.config->vncTLSx509certdir);
930

931 932 933 934
    DO_TEST("graphics-sdl", NONE);
    DO_TEST("graphics-sdl-fullscreen", NONE);
    DO_TEST("nographics", QEMU_CAPS_VGA);
    DO_TEST("nographics-vga",
935
            QEMU_CAPS_VGA, QEMU_CAPS_VGA_NONE);
936
    DO_TEST("graphics-spice",
937
            QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL,
938
            QEMU_CAPS_DEVICE, QEMU_CAPS_SPICE,
939 940
            QEMU_CAPS_DEVICE_QXL,
            QEMU_CAPS_SPICE_FILE_XFER_DISABLE);
941 942 943 944 945 946 947 948
    driver.config->spiceSASL = 1;
    ignore_value(VIR_STRDUP(driver.config->spiceSASLdir, "/root/.sasl2"));
    DO_TEST("graphics-spice-sasl",
            QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL,
            QEMU_CAPS_DEVICE, QEMU_CAPS_SPICE,
            QEMU_CAPS_DEVICE_QXL);
    VIR_FREE(driver.config->spiceSASLdir);
    driver.config->spiceSASL = 0;
949
    DO_TEST("graphics-spice-agentmouse",
P
Peng Zhou 已提交
950
            QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL,
951 952 953
            QEMU_CAPS_DEVICE, QEMU_CAPS_SPICE,
            QEMU_CAPS_CHARDEV_SPICEVMC,
            QEMU_CAPS_NODEFCONFIG);
954
    DO_TEST("graphics-spice-compression",
955
            QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL,
956 957
            QEMU_CAPS_DEVICE, QEMU_CAPS_SPICE,
            QEMU_CAPS_DEVICE_QXL);
958
    DO_TEST("graphics-spice-timeout",
959
            QEMU_CAPS_KVM, QEMU_CAPS_DRIVE,
960 961 962
            QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL,
            QEMU_CAPS_DEVICE, QEMU_CAPS_SPICE,
            QEMU_CAPS_DEVICE_QXL_VGA);
963
    DO_TEST("graphics-spice-qxl-vga",
964 965
            QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL,
            QEMU_CAPS_DEVICE, QEMU_CAPS_SPICE,
966 967
            QEMU_CAPS_DEVICE_QXL_VGA,
            QEMU_CAPS_DEVICE_QXL);
968
    DO_TEST("graphics-spice-usb-redir",
969 970 971 972 973
            QEMU_CAPS_VGA, QEMU_CAPS_SPICE,
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_USB_HUB,
            QEMU_CAPS_ICH9_USB_EHCI1, QEMU_CAPS_USB_REDIR,
            QEMU_CAPS_CHARDEV_SPICEVMC);
974 975 976 977 978 979
    DO_TEST("graphics-spice-agent-file-xfer",
            QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL,
            QEMU_CAPS_DEVICE, QEMU_CAPS_SPICE,
            QEMU_CAPS_DEVICE_QXL_VGA,
            QEMU_CAPS_DEVICE_QXL,
            QEMU_CAPS_SPICE_FILE_XFER_DISABLE);
980

981 982 983
    DO_TEST("input-usbmouse", NONE);
    DO_TEST("input-usbtablet", NONE);
    DO_TEST("misc-acpi", NONE);
984 985 986 987
    DO_TEST("misc-disable-s3", QEMU_CAPS_DISABLE_S3);
    DO_TEST("misc-disable-suspends", QEMU_CAPS_DISABLE_S3, QEMU_CAPS_DISABLE_S4);
    DO_TEST("misc-enable-s4", QEMU_CAPS_DISABLE_S4);
    DO_TEST_FAILURE("misc-enable-s4", NONE);
988 989
    DO_TEST("misc-no-reboot", NONE);
    DO_TEST("misc-uuid", QEMU_CAPS_NAME, QEMU_CAPS_UUID);
990
    DO_TEST_PARSE_ERROR("vhost_queues-invalid", NONE);
M
Michele Paolino 已提交
991
    DO_TEST("net-vhostuser", QEMU_CAPS_DEVICE, QEMU_CAPS_NETDEV);
992
    DO_TEST("net-vhostuser-multiq",
J
Ján Tomko 已提交
993
            QEMU_CAPS_DEVICE, QEMU_CAPS_NETDEV, QEMU_CAPS_VHOSTUSER_MULTIQUEUE);
994
    DO_TEST_FAILURE("net-vhostuser-multiq", QEMU_CAPS_DEVICE, QEMU_CAPS_NETDEV);
995 996 997
    DO_TEST("net-user", NONE);
    DO_TEST("net-virtio", NONE);
    DO_TEST("net-virtio-device",
998
            QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_VIRTIO_TX_ALG);
999 1000
    DO_TEST("net-virtio-disable-offloads",
            QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
1001
    DO_TEST("net-virtio-netdev",
1002
            QEMU_CAPS_DEVICE, QEMU_CAPS_NETDEV, QEMU_CAPS_NODEFCONFIG);
1003
    DO_TEST("net-virtio-s390",
1004
            QEMU_CAPS_DEVICE, QEMU_CAPS_VIRTIO_S390);
1005 1006
    DO_TEST("net-virtio-ccw",
            QEMU_CAPS_DEVICE, QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
1007 1008 1009 1010 1011 1012 1013
    DO_TEST("net-eth", NONE);
    DO_TEST("net-eth-ifname", NONE);
    DO_TEST("net-eth-names", QEMU_CAPS_NET_NAME);
    DO_TEST("net-client", NONE);
    DO_TEST("net-server", NONE);
    DO_TEST("net-mcast", NONE);
    DO_TEST("net-hostdev",
1014
            QEMU_CAPS_PCIDEVICE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
1015 1016 1017 1018 1019 1020
    DO_TEST("net-hostdev-multidomain",
            QEMU_CAPS_PCIDEVICE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_HOST_PCI_MULTIDOMAIN);
    DO_TEST_FAILURE("net-hostdev-multidomain",
                    QEMU_CAPS_PCIDEVICE, QEMU_CAPS_DEVICE,
                    QEMU_CAPS_NODEFCONFIG);
1021 1022 1023
    DO_TEST("net-hostdev-vfio",
            QEMU_CAPS_PCIDEVICE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_DEVICE_VFIO_PCI);
1024 1025 1026 1027 1028 1029
    DO_TEST("net-hostdev-vfio-multidomain",
            QEMU_CAPS_PCIDEVICE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_DEVICE_VFIO_PCI, QEMU_CAPS_HOST_PCI_MULTIDOMAIN);
    DO_TEST_FAILURE("net-hostdev-vfio-multidomain",
                    QEMU_CAPS_PCIDEVICE, QEMU_CAPS_DEVICE,
                    QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DEVICE_VFIO_PCI);
1030

1031 1032 1033 1034 1035 1036 1037 1038 1039
    DO_TEST("serial-vc", NONE);
    DO_TEST("serial-pty", NONE);
    DO_TEST("serial-dev", NONE);
    DO_TEST("serial-file", NONE);
    DO_TEST("serial-unix", NONE);
    DO_TEST("serial-tcp", NONE);
    DO_TEST("serial-udp", NONE);
    DO_TEST("serial-tcp-telnet", NONE);
    DO_TEST("serial-many", NONE);
1040 1041 1042 1043 1044 1045 1046
    DO_TEST("serial-spiceport",
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE,
            QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
            QEMU_CAPS_DEVICE_QXL, QEMU_CAPS_DEVICE_QXL_VGA,
            QEMU_CAPS_SPICE, QEMU_CAPS_CHARDEV_SPICEPORT);
    DO_TEST("serial-spiceport-nospice", QEMU_CAPS_NAME);

1047 1048 1049 1050 1051
    DO_TEST("parallel-tcp", NONE);
    DO_TEST("console-compat", NONE);
    DO_TEST("console-compat-auto", NONE);

    DO_TEST("serial-vc-chardev",
1052
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
1053
    DO_TEST("serial-pty-chardev",
1054
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
1055
    DO_TEST("serial-dev-chardev",
1056
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
1057 1058
    DO_TEST("serial-dev-chardev-iobase",
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
1059
    DO_TEST("serial-file-chardev",
1060
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
1061
    DO_TEST("serial-unix-chardev",
1062
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
1063
    DO_TEST("serial-tcp-chardev",
1064
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
1065
    DO_TEST("serial-udp-chardev",
1066
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
1067
    DO_TEST("serial-tcp-telnet-chardev",
1068
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
1069
    DO_TEST("serial-many-chardev",
1070
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
1071
    DO_TEST("parallel-tcp-chardev",
1072
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
1073
    DO_TEST("parallel-parport-chardev",
1074
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
1075
    DO_TEST("console-compat-chardev",
1076
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
M
Michal Privoznik 已提交
1077 1078 1079
    DO_TEST("pci-serial-dev-chardev",
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_DEVICE_PCI_SERIAL);
1080

1081
    DO_TEST("channel-guestfwd",
1082
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
1083
    DO_TEST("channel-virtio",
1084
            QEMU_CAPS_DEVICE, QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG);
1085 1086
    DO_TEST("channel-virtio-state",
            QEMU_CAPS_DEVICE, QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG);
1087
    DO_TEST("channel-virtio-auto",
1088
            QEMU_CAPS_DEVICE, QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG);
1089 1090
    DO_TEST("channel-virtio-autoassign",
            QEMU_CAPS_DEVICE, QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG);
J
Ján Tomko 已提交
1091 1092
    DO_TEST("channel-virtio-autoadd",
            QEMU_CAPS_DEVICE, QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG);
1093
    DO_TEST("console-virtio",
1094
            QEMU_CAPS_DEVICE, QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG);
1095
    DO_TEST("console-virtio-many",
1096
            QEMU_CAPS_DEVICE, QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG);
1097
    DO_TEST("console-virtio-s390",
1098
            QEMU_CAPS_DEVICE, QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG,
1099 1100 1101 1102 1103
            QEMU_CAPS_DRIVE, QEMU_CAPS_BOOTINDEX, QEMU_CAPS_VIRTIO_S390);
    DO_TEST("console-virtio-ccw",
            QEMU_CAPS_DEVICE, QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_DRIVE, QEMU_CAPS_BOOTINDEX, QEMU_CAPS_VIRTIO_CCW,
            QEMU_CAPS_VIRTIO_S390);
1104 1105 1106
    DO_TEST("console-sclp",
            QEMU_CAPS_DEVICE, QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_DRIVE, QEMU_CAPS_VIRTIO_S390, QEMU_CAPS_SCLP_S390);
1107
    DO_TEST("channel-spicevmc",
1108 1109
            QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_SPICE, QEMU_CAPS_CHARDEV_SPICEVMC);
1110
    DO_TEST("channel-spicevmc-old",
1111 1112
            QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_SPICE, QEMU_CAPS_DEVICE_SPICEVMC);
1113 1114 1115
    DO_TEST("channel-virtio-default",
            QEMU_CAPS_DEVICE, QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_SPICE, QEMU_CAPS_CHARDEV_SPICEVMC);
1116

1117
    DO_TEST("smartcard-host",
1118 1119
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE,
            QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_CCID_EMULATED);
1120
    DO_TEST("smartcard-host-certificates",
1121 1122
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE,
            QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_CCID_EMULATED);
1123
    DO_TEST("smartcard-passthrough-tcp",
1124 1125
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE,
            QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_CCID_PASSTHRU);
1126
    DO_TEST("smartcard-passthrough-spicevmc",
1127 1128
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_CCID_PASSTHRU, QEMU_CAPS_CHARDEV_SPICEVMC);
1129
    DO_TEST("smartcard-controller",
1130 1131 1132
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE,
            QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_CCID_EMULATED);

1133
    DO_TEST("usb-controller",
1134 1135
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE,
            QEMU_CAPS_NODEFCONFIG);
1136
    DO_TEST("usb-piix3-controller",
1137
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_PIIX3_USB_UHCI,
1138
            QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_NODEFCONFIG);
1139
    DO_TEST("usb-ich9-ehci-addr",
1140 1141
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_ICH9_USB_EHCI1);
1142
    DO_TEST("input-usbmouse-addr",
1143
            QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
1144
    DO_TEST("usb-ich9-companion",
1145 1146
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_ICH9_USB_EHCI1);
1147 1148 1149
    DO_TEST_PARSE_ERROR("usb-ich9-no-companion",
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_ICH9_USB_EHCI1);
1150
    DO_TEST("usb-hub",
M
Marc-André Lureau 已提交
1151 1152
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_USB_HUB,
            QEMU_CAPS_NODEFCONFIG);
1153
    DO_TEST("usb-ports",
1154 1155
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_USB_HUB,
            QEMU_CAPS_NODEFCONFIG);
1156
    DO_TEST("usb-redir",
1157 1158
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_USB_HUB,
1159 1160
            QEMU_CAPS_ICH9_USB_EHCI1, QEMU_CAPS_USB_REDIR,
            QEMU_CAPS_SPICE, QEMU_CAPS_CHARDEV_SPICEVMC);
1161 1162 1163 1164 1165 1166
    DO_TEST("usb-redir-boot",
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_USB_HUB,
            QEMU_CAPS_ICH9_USB_EHCI1, QEMU_CAPS_USB_REDIR,
            QEMU_CAPS_SPICE, QEMU_CAPS_CHARDEV_SPICEVMC, QEMU_CAPS_BOOTINDEX,
            QEMU_CAPS_USB_REDIR_BOOTINDEX);
1167 1168 1169 1170 1171 1172
    DO_TEST("usb-redir-filter",
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_USB_HUB,
            QEMU_CAPS_ICH9_USB_EHCI1, QEMU_CAPS_USB_REDIR,
            QEMU_CAPS_SPICE, QEMU_CAPS_CHARDEV_SPICEVMC,
            QEMU_CAPS_USB_REDIR_FILTER);
1173 1174 1175 1176 1177
    DO_TEST("usb-redir-filter-version",
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_USB_REDIR,
            QEMU_CAPS_SPICE, QEMU_CAPS_CHARDEV_SPICEVMC,
            QEMU_CAPS_USB_REDIR_FILTER);
1178
    DO_TEST("usb1-usb2",
1179 1180 1181
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_PIIX3_USB_UHCI,
            QEMU_CAPS_USB_HUB, QEMU_CAPS_ICH9_USB_EHCI1);
1182 1183 1184 1185 1186 1187 1188 1189 1190 1191
    DO_TEST("usb-none",
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
    DO_TEST_PARSE_ERROR("usb-none-other",
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
    DO_TEST_PARSE_ERROR("usb-none-hub",
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_USB_HUB);
    DO_TEST_PARSE_ERROR("usb-none-usbtablet",
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);

1192

1193
    DO_TEST("smbios", QEMU_CAPS_SMBIOS_TYPE);
1194
    DO_TEST_PARSE_ERROR("smbios-date", QEMU_CAPS_SMBIOS_TYPE);
1195
    DO_TEST_PARSE_ERROR("smbios-uuid-match", QEMU_CAPS_SMBIOS_TYPE);
1196

1197 1198 1199
    DO_TEST("watchdog", NONE);
    DO_TEST("watchdog-device", QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
    DO_TEST("watchdog-dump", NONE);
1200
    DO_TEST("watchdog-injectnmi", NONE);
1201 1202 1203
    DO_TEST("watchdog-diag288",
            QEMU_CAPS_DEVICE, QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_DRIVE, QEMU_CAPS_BOOTINDEX, QEMU_CAPS_VIRTIO_S390);
1204 1205
    DO_TEST("balloon-device", QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
    DO_TEST("balloon-device-auto",
1206
            QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
1207
    DO_TEST("balloon-device-period", QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
1208 1209
    DO_TEST("sound", NONE);
    DO_TEST("sound-device",
1210
            QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
1211
            QEMU_CAPS_HDA_DUPLEX, QEMU_CAPS_HDA_MICRO,
1212 1213
            QEMU_CAPS_DEVICE_ICH9_INTEL_HDA,
            QEMU_CAPS_OBJECT_USB_AUDIO);
1214
    DO_TEST("fs9p",
1215 1216
            QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_FSDEV,
            QEMU_CAPS_FSDEV_WRITEOUT);
1217

1218 1219
    DO_TEST("hostdev-usb-address", NONE);
    DO_TEST("hostdev-usb-address-device",
1220
            QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
1221 1222 1223
    DO_TEST("hostdev-usb-address-device-boot", QEMU_CAPS_DEVICE,
            QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_BOOTINDEX,
            QEMU_CAPS_USB_HOST_BOOTINDEX);
1224 1225
    DO_TEST("hostdev-pci-address", QEMU_CAPS_PCIDEVICE);
    DO_TEST("hostdev-pci-address-device",
1226
            QEMU_CAPS_PCIDEVICE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
1227 1228 1229
    DO_TEST("hostdev-vfio",
            QEMU_CAPS_PCIDEVICE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_DEVICE_VFIO_PCI);
1230 1231 1232 1233 1234 1235
    DO_TEST("hostdev-vfio-multidomain",
            QEMU_CAPS_PCIDEVICE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_DEVICE_VFIO_PCI, QEMU_CAPS_HOST_PCI_MULTIDOMAIN);
    DO_TEST_FAILURE("hostdev-vfio-multidomain",
                    QEMU_CAPS_PCIDEVICE, QEMU_CAPS_DEVICE,
                    QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DEVICE_VFIO_PCI);
1236
    DO_TEST("pci-rom",
1237 1238
            QEMU_CAPS_PCIDEVICE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_PCI_ROMBAR);
1239

1240 1241 1242 1243 1244 1245
    DO_TEST_FULL("restore-v1", "stdio", 7, 0, QEMU_CAPS_MIGRATE_KVM_STDIO);
    DO_TEST_FULL("restore-v2", "stdio", 7, 0, QEMU_CAPS_MIGRATE_QEMU_EXEC);
    DO_TEST_FULL("restore-v2", "exec:cat", 7, 0, QEMU_CAPS_MIGRATE_QEMU_EXEC);
    DO_TEST_FULL("restore-v2-fd", "stdio", 7, 0, QEMU_CAPS_MIGRATE_QEMU_FD);
    DO_TEST_FULL("restore-v2-fd", "fd:7", 7, 0, QEMU_CAPS_MIGRATE_QEMU_FD);
    DO_TEST_FULL("migrate", "tcp:10.0.0.1:5000", -1, 0,
1246 1247
            QEMU_CAPS_MIGRATE_QEMU_TCP);

1248
    DO_TEST("qemu-ns", NONE);
1249

1250
    DO_TEST("smp", QEMU_CAPS_SMP_TOPOLOGY);
1251

J
John Ferlan 已提交
1252
    DO_TEST("iothreads", QEMU_CAPS_OBJECT_IOTHREAD);
1253 1254
    DO_TEST("iothreads-ids", QEMU_CAPS_OBJECT_IOTHREAD);
    DO_TEST("iothreads-ids-partial", QEMU_CAPS_OBJECT_IOTHREAD);
1255 1256
    DO_TEST("iothreads-disk", QEMU_CAPS_OBJECT_IOTHREAD, QEMU_CAPS_DEVICE,
            QEMU_CAPS_DRIVE);
1257 1258
    DO_TEST("iothreads-disk-virtio-ccw", QEMU_CAPS_OBJECT_IOTHREAD, QEMU_CAPS_DEVICE,
            QEMU_CAPS_DRIVE, QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
J
John Ferlan 已提交
1259

1260 1261 1262
    DO_TEST("cpu-topology1", QEMU_CAPS_SMP_TOPOLOGY);
    DO_TEST("cpu-topology2", QEMU_CAPS_SMP_TOPOLOGY);
    DO_TEST("cpu-topology3", NONE);
1263 1264 1265 1266 1267 1268 1269 1270
    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);
1271 1272
    DO_TEST("cpu-numa1", NONE);
    DO_TEST("cpu-numa2", QEMU_CAPS_SMP_TOPOLOGY);
1273
    DO_TEST("cpu-numa-no-memory-element", QEMU_CAPS_SMP_TOPOLOGY);
1274
    DO_TEST_PARSE_ERROR("cpu-numa3", NONE);
1275 1276
    DO_TEST_FAILURE("cpu-numa-disjoint", NONE);
    DO_TEST("cpu-numa-disjoint", QEMU_CAPS_NUMA);
1277 1278 1279
    DO_TEST_FAILURE("cpu-numa-memshared", QEMU_CAPS_SMP_TOPOLOGY,
                    QEMU_CAPS_OBJECT_MEMORY_RAM);
    DO_TEST_FAILURE("cpu-numa-memshared", QEMU_CAPS_SMP_TOPOLOGY);
1280
    DO_TEST("cpu-host-model", NONE);
1281
    DO_TEST("cpu-host-model-vendor", NONE);
1282
    skipLegacyCPUs = true;
1283
    DO_TEST("cpu-host-model-fallback", NONE);
1284
    DO_TEST_FAILURE("cpu-host-model-nofallback", NONE);
1285
    skipLegacyCPUs = false;
1286
    DO_TEST("cpu-host-passthrough", QEMU_CAPS_KVM, QEMU_CAPS_CPU_HOST);
1287 1288 1289
    DO_TEST_FAILURE("cpu-host-passthrough", NONE);
    DO_TEST_FAILURE("cpu-qemu-host-passthrough",
                    QEMU_CAPS_KVM, QEMU_CAPS_CPU_HOST);
1290

1291 1292 1293 1294 1295 1296 1297
    driver.caps->host.cpu = cpuHaswell;
    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);
    driver.caps->host.cpu = cpuDefault;

1298
    DO_TEST("memtune", QEMU_CAPS_NAME);
1299
    DO_TEST("memtune-unlimited", QEMU_CAPS_NAME);
1300 1301 1302
    DO_TEST("blkiotune", QEMU_CAPS_NAME);
    DO_TEST("blkiotune-device", QEMU_CAPS_NAME);
    DO_TEST("cputune", QEMU_CAPS_NAME);
1303
    DO_TEST("cputune-zero-shares", QEMU_CAPS_NAME);
1304 1305
    DO_TEST_PARSE_ERROR("cputune-iothreadsched-toomuch", QEMU_CAPS_NAME);
    DO_TEST_PARSE_ERROR("cputune-vcpusched-overlap", QEMU_CAPS_NAME);
1306 1307 1308 1309
    DO_TEST("cputune-numatune", QEMU_CAPS_SMP_TOPOLOGY,
            QEMU_CAPS_KVM,
            QEMU_CAPS_OBJECT_MEMORY_RAM,
            QEMU_CAPS_OBJECT_MEMORY_FILE);
1310

1311
    DO_TEST("numatune-memory", NONE);
1312
    DO_TEST_PARSE_ERROR("numatune-memory-invalid-nodeset", NONE);
1313 1314
    DO_TEST_LINUX("numatune-memnode", QEMU_CAPS_NUMA,
                  QEMU_CAPS_OBJECT_MEMORY_RAM);
1315 1316
    DO_TEST_FAILURE("numatune-memnode", NONE);

1317 1318
    DO_TEST_LINUX("numatune-memnode-no-memory", QEMU_CAPS_NUMA,
                  QEMU_CAPS_OBJECT_MEMORY_RAM);
1319 1320
    DO_TEST_FAILURE("numatune-memnode-no-memory", NONE);

1321
    DO_TEST("numatune-auto-nodeset-invalid", NONE);
1322 1323
    DO_TEST("numatune-auto-prefer", QEMU_CAPS_OBJECT_MEMORY_RAM,
            QEMU_CAPS_OBJECT_MEMORY_FILE);
1324 1325
    DO_TEST_FAILURE("numatune-static-nodeset-exceed-hostnode",
                    QEMU_CAPS_OBJECT_MEMORY_RAM);
1326 1327
    DO_TEST_PARSE_ERROR("numatune-memnode-nocpu", NONE);
    DO_TEST_PARSE_ERROR("numatune-memnodes-problematic", NONE);
1328 1329
    DO_TEST("numad", NONE);
    DO_TEST("numad-auto-vcpu-static-numatune", NONE);
1330
    DO_TEST_PARSE_ERROR("numad-auto-vcpu-static-numatune-no-nodeset", NONE);
1331 1332 1333 1334
    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);
    DO_TEST("blkdeviotune", QEMU_CAPS_NAME, QEMU_CAPS_DEVICE,
1335
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_IOTUNE);
1336 1337 1338
    DO_TEST("blkdeviotune-max", QEMU_CAPS_NAME, QEMU_CAPS_DEVICE,
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_IOTUNE,
            QEMU_CAPS_DRIVE_IOTUNE_MAX);
1339

1340
    DO_TEST("multifunction-pci-device",
1341
            QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
1342
            QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_SCSI_LSI);
1343

1344
    DO_TEST("monitor-json", QEMU_CAPS_DEVICE,
1345
            QEMU_CAPS_CHARDEV, QEMU_CAPS_MONITOR_JSON, QEMU_CAPS_NODEFCONFIG);
1346
    DO_TEST("no-shutdown", QEMU_CAPS_DEVICE,
1347 1348
            QEMU_CAPS_CHARDEV, QEMU_CAPS_MONITOR_JSON, QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_NO_SHUTDOWN);
1349

1350 1351 1352
    DO_TEST("seclabel-dynamic", QEMU_CAPS_NAME);
    DO_TEST("seclabel-dynamic-baselabel", QEMU_CAPS_NAME);
    DO_TEST("seclabel-dynamic-override", QEMU_CAPS_NAME);
1353
    DO_TEST("seclabel-dynamic-labelskip", QEMU_CAPS_NAME);
1354
    DO_TEST("seclabel-dynamic-relabel", QEMU_CAPS_NAME);
1355 1356
    DO_TEST("seclabel-static", QEMU_CAPS_NAME);
    DO_TEST("seclabel-static-relabel", QEMU_CAPS_NAME);
1357
    DO_TEST("seclabel-static-labelskip", QEMU_CAPS_NAME);
1358
    DO_TEST("seclabel-none", QEMU_CAPS_NAME);
1359
    DO_TEST("seclabel-dac-none", QEMU_CAPS_NAME);
1360
    DO_TEST_PARSE_ERROR("seclabel-multiple", QEMU_CAPS_NAME);
1361
    DO_TEST_PARSE_ERROR("seclabel-device-duplicates", QEMU_CAPS_NAME);
1362

1363
    DO_TEST("pseries-basic",
1364
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
1365
    DO_TEST("pseries-vio", QEMU_CAPS_DRIVE,
1366
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
1367 1368 1369 1370 1371 1372 1373 1374
    DO_TEST("pseries-usb-default", QEMU_CAPS_DRIVE,
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE,
            QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_PIIX3_USB_UHCI,
            QEMU_CAPS_PCI_OHCI, QEMU_CAPS_PCI_MULTIFUNCTION);
    DO_TEST("pseries-usb-multi", QEMU_CAPS_DRIVE,
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE,
            QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_PIIX3_USB_UHCI,
            QEMU_CAPS_PCI_OHCI, QEMU_CAPS_PCI_MULTIFUNCTION);
1375
    DO_TEST("pseries-vio-user-assigned", QEMU_CAPS_DRIVE,
1376
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
1377
    DO_TEST_ERROR("pseries-vio-address-clash", QEMU_CAPS_DRIVE,
1378
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
1379
    DO_TEST("pseries-nvram", QEMU_CAPS_DEVICE_NVRAM);
1380 1381 1382
    DO_TEST("pseries-usb-kbd", QEMU_CAPS_PCI_OHCI,
            QEMU_CAPS_DEVICE_USB_KBD, QEMU_CAPS_CHARDEV,
            QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
1383 1384
    DO_TEST("pseries-cpu-exact", QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE,
            QEMU_CAPS_NODEFCONFIG);
1385 1386
    DO_TEST("pseries-cpu-compat", QEMU_CAPS_KVM, QEMU_CAPS_CPU_HOST,
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
1387 1388
    DO_TEST("pseries-cpu-le",  QEMU_CAPS_KVM, QEMU_CAPS_CPU_HOST,
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
1389 1390
    DO_TEST("pseries-panic-missing",
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
1391 1392 1393 1394
    DO_TEST("pseries-panic-no-address",
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
    DO_TEST_FAILURE("pseries-panic-address",
                    QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
1395
    DO_TEST("disk-ide-drive-split",
1396 1397
            QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_IDE_CD);
1398 1399 1400
    DO_TEST("disk-ide-wwn",
            QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_IDE_CD,
            QEMU_CAPS_DRIVE_SERIAL, QEMU_CAPS_IDE_DRIVE_WWN);
1401

1402
    DO_TEST("disk-geometry", QEMU_CAPS_DRIVE);
V
Viktor Mihajlovski 已提交
1403
    DO_TEST("disk-blockio",
1404
            QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
V
Viktor Mihajlovski 已提交
1405
            QEMU_CAPS_IDE_CD, QEMU_CAPS_BLOCKIO);
1406

1407 1408 1409
    DO_TEST("video-device-pciaddr-default",
            QEMU_CAPS_KVM, QEMU_CAPS_VNC,
            QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
1410 1411
            QEMU_CAPS_DEVICE_QXL, QEMU_CAPS_DEVICE_QXL_VGA,
            QEMU_CAPS_DEVICE_PCI_BRIDGE);
1412 1413 1414 1415 1416 1417 1418 1419 1420
    DO_TEST("video-vga-nodevice", QEMU_CAPS_VGA);
    DO_TEST("video-vga-device", QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_VGA,
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
    DO_TEST("video-vga-device-vgamem", QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_VGA,
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY, QEMU_CAPS_VGA_VGAMEM);
    DO_TEST("video-qxl-nodevice", QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL);
    DO_TEST("video-qxl-device", QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_QXL_VGA,
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
    DO_TEST("video-qxl-device-vgamem", QEMU_CAPS_DEVICE,
1421 1422
            QEMU_CAPS_DEVICE_QXL_VGA, QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
            QEMU_CAPS_QXL_VGA_VGAMEM);
1423 1424 1425 1426 1427
    DO_TEST_FAILURE("video-qxl-sec-nodevice", QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL);
    DO_TEST("video-qxl-sec-device", QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_QXL_VGA,
            QEMU_CAPS_DEVICE_QXL, QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
    DO_TEST("video-qxl-sec-device-vgamem", QEMU_CAPS_DEVICE,
            QEMU_CAPS_DEVICE_QXL_VGA, QEMU_CAPS_DEVICE_QXL,
1428 1429
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY, QEMU_CAPS_QXL_VGA_VGAMEM,
            QEMU_CAPS_QXL_VGAMEM);
1430
    DO_TEST_PARSE_ERROR("video-invalid", NONE);
1431

1432 1433
    DO_TEST("virtio-rng-default", QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_VIRTIO_RNG,
            QEMU_CAPS_OBJECT_RNG_RANDOM);
1434 1435 1436 1437
    DO_TEST("virtio-rng-random", QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_VIRTIO_RNG,
            QEMU_CAPS_OBJECT_RNG_RANDOM);
    DO_TEST("virtio-rng-egd", QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_VIRTIO_RNG,
            QEMU_CAPS_OBJECT_RNG_EGD);
1438 1439
    DO_TEST("virtio-rng-multiple", QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_VIRTIO_RNG,
            QEMU_CAPS_OBJECT_RNG_EGD, QEMU_CAPS_OBJECT_RNG_RANDOM);
1440 1441
    DO_TEST_PARSE_ERROR("virtio-rng-egd-crash", QEMU_CAPS_DEVICE,
            QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_EGD);
1442 1443 1444 1445 1446
    DO_TEST("virtio-rng-ccw",
            QEMU_CAPS_DEVICE, QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_DRIVE, QEMU_CAPS_BOOTINDEX, QEMU_CAPS_VIRTIO_CCW,
            QEMU_CAPS_VIRTIO_S390, QEMU_CAPS_DEVICE_VIRTIO_RNG,
            QEMU_CAPS_OBJECT_RNG_RANDOM);
1447

1448
    DO_TEST("s390-allow-bogus-usb-none",
1449 1450 1451 1452
            QEMU_CAPS_DEVICE, QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_DRIVE, QEMU_CAPS_BOOTINDEX, QEMU_CAPS_VIRTIO_S390,
            QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM);

1453
    DO_TEST("s390-allow-bogus-usb-controller",
1454 1455 1456 1457
            QEMU_CAPS_DEVICE, QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_DRIVE, QEMU_CAPS_BOOTINDEX, QEMU_CAPS_VIRTIO_S390,
            QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM);

O
Olivia Yin 已提交
1458
    DO_TEST("ppc-dtb", QEMU_CAPS_KVM, QEMU_CAPS_DTB);
1459
    DO_TEST("ppce500-serial", QEMU_CAPS_KVM, QEMU_CAPS_DEVICE, QEMU_CAPS_CHARDEV);
O
Olivia Yin 已提交
1460

1461 1462
    DO_TEST("tpm-passthrough", QEMU_CAPS_DEVICE,
            QEMU_CAPS_DEVICE_TPM_PASSTHROUGH, QEMU_CAPS_DEVICE_TPM_TIS);
1463 1464
    DO_TEST_PARSE_ERROR("tpm-no-backend-invalid", QEMU_CAPS_DEVICE,
                        QEMU_CAPS_DEVICE_TPM_PASSTHROUGH, QEMU_CAPS_DEVICE_TPM_TIS);
1465

1466 1467
    DO_TEST("pci-autoadd-addr", QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_PCI_BRIDGE);
    DO_TEST("pci-autoadd-idx", QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_PCI_BRIDGE);
1468 1469
    DO_TEST("pci-many",
            QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE_PCI_BRIDGE);
1470 1471
    DO_TEST("pci-bridge-many-disks",
            QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE_PCI_BRIDGE);
L
Laine Stump 已提交
1472
    DO_TEST("pcie-root",
1473
            QEMU_CAPS_ICH9_AHCI,
1474 1475 1476 1477 1478
            QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE);
    DO_TEST("q35",
            QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
1479
            QEMU_CAPS_DRIVE, QEMU_CAPS_ICH9_AHCI,
1480 1481
            QEMU_CAPS_VGA, QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
            QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL);
1482

1483 1484 1485 1486 1487 1488 1489 1490
    DO_TEST("hostdev-scsi-lsi", QEMU_CAPS_DRIVE,
            QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE,
            QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI,
            QEMU_CAPS_DEVICE_SCSI_GENERIC);
    DO_TEST("hostdev-scsi-virtio-scsi", QEMU_CAPS_DRIVE,
            QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE,
            QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_DEVICE_SCSI_GENERIC);
O
Osier Yang 已提交
1491 1492 1493 1494
    DO_TEST("hostdev-scsi-readonly", QEMU_CAPS_DRIVE,
            QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE,
            QEMU_CAPS_DRIVE_READONLY, QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE_SCSI_GENERIC);
1495 1496 1497 1498 1499
    DO_TEST("hostdev-scsi-virtio-scsi", QEMU_CAPS_DRIVE,
            QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE,
            QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_DEVICE_SCSI_GENERIC,
            QEMU_CAPS_DEVICE_SCSI_GENERIC_BOOTINDEX);
J
John Ferlan 已提交
1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515
    DO_TEST("hostdev-scsi-lsi-iscsi", QEMU_CAPS_DRIVE,
            QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE,
            QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI,
            QEMU_CAPS_DEVICE_SCSI_GENERIC);
    DO_TEST("hostdev-scsi-lsi-iscsi-auth", QEMU_CAPS_DRIVE,
            QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE,
            QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI,
            QEMU_CAPS_DEVICE_SCSI_GENERIC);
    DO_TEST("hostdev-scsi-virtio-iscsi", QEMU_CAPS_DRIVE,
            QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE,
            QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_DEVICE_SCSI_GENERIC);
    DO_TEST("hostdev-scsi-virtio-iscsi-auth", QEMU_CAPS_DRIVE,
            QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE,
            QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_DEVICE_SCSI_GENERIC);
1516

1517 1518 1519 1520 1521
    DO_TEST("mlock-on", QEMU_CAPS_MLOCK);
    DO_TEST_FAILURE("mlock-on", NONE);
    DO_TEST("mlock-off", QEMU_CAPS_MLOCK);
    DO_TEST("mlock-unsupported", NONE);

1522 1523
    DO_TEST_PARSE_ERROR("pci-bridge-negative-index-invalid",
                        QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_PCI_BRIDGE);
J
Ján Tomko 已提交
1524 1525 1526 1527 1528 1529
    DO_TEST_PARSE_ERROR("pci-bridge-duplicate-index",
                        QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_PCI_BRIDGE);
    DO_TEST_PARSE_ERROR("pci-root-nonzero-index",
                        QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_PCI_BRIDGE);
    DO_TEST_PARSE_ERROR("pci-root-address",
                        QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_PCI_BRIDGE);
1530

1531 1532 1533 1534
    DO_TEST("hotplug-base",
            QEMU_CAPS_KVM, QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE,
            QEMU_CAPS_VIRTIO_SCSI);

1535 1536 1537 1538 1539 1540 1541 1542 1543 1544
    DO_TEST("pcihole64", QEMU_CAPS_DEVICE, QEMU_CAPS_I440FX_PCI_HOLE64_SIZE);
    DO_TEST_FAILURE("pcihole64-none", QEMU_CAPS_DEVICE);
    DO_TEST("pcihole64-q35",
            QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
            QEMU_CAPS_DRIVE, QEMU_CAPS_ICH9_AHCI,
            QEMU_CAPS_VGA, QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
            QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL,
            QEMU_CAPS_Q35_PCI_HOLE64_SIZE);

1545 1546
    DO_TEST("arm-vexpressa9-nodevs",
            QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DTB);
1547 1548 1549
    DO_TEST("arm-vexpressa9-basic",
            QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DTB,
            QEMU_CAPS_DRIVE);
1550 1551 1552 1553
    DO_TEST("arm-vexpressa9-virtio",
            QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DTB,
            QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE_VIRTIO_MMIO,
            QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM);
1554 1555 1556 1557
    DO_TEST("arm-virt-virtio",
            QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DTB,
            QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE_VIRTIO_MMIO,
            QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM);
1558

1559 1560 1561 1562
    DO_TEST("aarch64-virt-virtio",
            QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DTB,
            QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE_VIRTIO_MMIO,
            QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM);
1563 1564 1565 1566
    DO_TEST("aarch64-aavmf-virtio-mmio",
            QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DTB,
            QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE_VIRTIO_MMIO,
            QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM);
1567 1568 1569
    DO_TEST("aarch64-virt-default-nic",
            QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_DEVICE_VIRTIO_MMIO);
1570 1571 1572
    DO_TEST("aarch64-cpu-passthrough", QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE,
            QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DEVICE_VIRTIO_MMIO,
            QEMU_CAPS_CPU_HOST, QEMU_CAPS_KVM);
M
Michal Privoznik 已提交
1573 1574
    DO_TEST("aarch64-gic", QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE,
            QEMU_CAPS_KVM);
1575

1576 1577 1578 1579 1580 1581 1582 1583 1584
    driver.caps->host.cpu->arch = VIR_ARCH_AARCH64;
    DO_TEST("aarch64-kvm-32-on-64", QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE,
            QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DEVICE_VIRTIO_MMIO,
            QEMU_CAPS_KVM, QEMU_CAPS_CPU_HOST, QEMU_CAPS_CPU_AARCH64_OFF);
    DO_TEST_FAILURE("aarch64-kvm-32-on-64", QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE,
            QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DEVICE_VIRTIO_MMIO,
            QEMU_CAPS_KVM, QEMU_CAPS_CPU_HOST);
    driver.caps->host.cpu->arch = cpuDefault->arch;

1585 1586 1587 1588 1589
    DO_TEST("kvm-pit-device", QEMU_CAPS_KVM_PIT_TICK_POLICY);
    DO_TEST("kvm-pit-delay", QEMU_CAPS_NO_KVM_PIT);
    DO_TEST("kvm-pit-device", QEMU_CAPS_NO_KVM_PIT,
            QEMU_CAPS_KVM_PIT_TICK_POLICY);

H
Hu Tao 已提交
1590 1591 1592
    DO_TEST("panic", QEMU_CAPS_DEVICE_PANIC,
            QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);

1593 1594 1595
    DO_TEST("panic-no-address", QEMU_CAPS_DEVICE_PANIC,
            QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);

1596 1597
    DO_TEST("fips-enabled", QEMU_CAPS_ENABLE_FIPS);

1598 1599 1600
    DO_TEST("shmem", QEMU_CAPS_PCIDEVICE,
            QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_IVSHMEM);
    DO_TEST_FAILURE("shmem", NONE);
1601 1602 1603 1604
    DO_TEST_FAILURE("shmem-invalid-size", QEMU_CAPS_PCIDEVICE,
                    QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_IVSHMEM);
    DO_TEST_FAILURE("shmem-small-size", QEMU_CAPS_PCIDEVICE,
                    QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_IVSHMEM);
1605
    DO_TEST_PARSE_ERROR("shmem-msi-only", NONE);
1606
    DO_TEST("cpu-host-passthrough-features", QEMU_CAPS_KVM, QEMU_CAPS_CPU_HOST);
1607

1608 1609 1610
    DO_TEST_FAILURE("memory-hotplug-nonuma", QEMU_CAPS_DEVICE_PC_DIMM);
    DO_TEST_FAILURE("memory-hotplug", NONE);
    DO_TEST("memory-hotplug", QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_NUMA);
1611
    DO_TEST("memory-hotplug-dimm", QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_NUMA,
1612
            QEMU_CAPS_DEVICE, QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_OBJECT_MEMORY_FILE);
1613
    DO_TEST("memory-hotplug-dimm-addr", QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_NUMA,
1614
            QEMU_CAPS_DEVICE, QEMU_CAPS_OBJECT_MEMORY_FILE);
1615

1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696
    DO_TEST("machine-aeskeywrap-on-caps",
            QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_AES_KEY_WRAP,
            QEMU_CAPS_DEA_KEY_WRAP, QEMU_CAPS_DRIVE,
            QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE,
            QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
    DO_TEST_FAILURE("machine-aeskeywrap-on-caps", QEMU_CAPS_MACHINE_OPT,
                    QEMU_CAPS_DRIVE, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE,
                    QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
    DO_TEST_FAILURE("machine-aeskeywrap-on-caps", NONE);

    DO_TEST("machine-aeskeywrap-on-cap",
            QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_AES_KEY_WRAP,
            QEMU_CAPS_DRIVE, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE,
            QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
    DO_TEST_FAILURE("machine-aeskeywrap-on-cap", QEMU_CAPS_MACHINE_OPT,
                    QEMU_CAPS_DRIVE, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE,
                    QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
    DO_TEST_FAILURE("machine-aeskeywrap-on-cap", NONE);

    DO_TEST("machine-aeskeywrap-off-caps",
            QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_AES_KEY_WRAP, QEMU_CAPS_DEA_KEY_WRAP,
            QEMU_CAPS_DRIVE, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE,
            QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
    DO_TEST_FAILURE("machine-aeskeywrap-off-caps", QEMU_CAPS_MACHINE_OPT,
                    QEMU_CAPS_DRIVE, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE,
                    QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
    DO_TEST_FAILURE("machine-aeskeywrap-off-caps", NONE);

    DO_TEST("machine-aeskeywrap-off-cap",
            QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_AES_KEY_WRAP, QEMU_CAPS_DRIVE,
            QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE,
            QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
    DO_TEST_FAILURE("machine-aeskeywrap-off-cap", QEMU_CAPS_MACHINE_OPT,
                    QEMU_CAPS_DRIVE, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE,
                    QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
    DO_TEST_FAILURE("machine-aeskeywrap-off-cap", NONE);

    DO_TEST("machine-deakeywrap-on-caps",
            QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_AES_KEY_WRAP, QEMU_CAPS_DEA_KEY_WRAP,
            QEMU_CAPS_DRIVE, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE,
            QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
    DO_TEST_FAILURE("machine-deakeywrap-on-caps", QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_DRIVE,
                    QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE,
                    QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
    DO_TEST_FAILURE("machine-deakeywrap-on-caps", NONE);

    DO_TEST("machine-deakeywrap-on-cap",
            QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_DEA_KEY_WRAP, QEMU_CAPS_DRIVE,
            QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE,
            QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
    DO_TEST_FAILURE("machine-deakeywrap-on-cap", QEMU_CAPS_MACHINE_OPT,
                    QEMU_CAPS_DRIVE, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE,
                    QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
    DO_TEST_FAILURE("machine-deakeywrap-on-cap", NONE);

    DO_TEST("machine-deakeywrap-off-caps",
            QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_AES_KEY_WRAP, QEMU_CAPS_DEA_KEY_WRAP,
            QEMU_CAPS_DRIVE, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE,
            QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
    DO_TEST_FAILURE("machine-deakeywrap-off-caps", QEMU_CAPS_MACHINE_OPT,
                    QEMU_CAPS_DRIVE, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE,
                    QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
    DO_TEST_FAILURE("machine-deakeywrap-off-caps", NONE);

    DO_TEST("machine-deakeywrap-off-cap",
            QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_DEA_KEY_WRAP, QEMU_CAPS_DRIVE,
            QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE,
            QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
    DO_TEST_FAILURE("machine-deakeywrap-off-cap", QEMU_CAPS_MACHINE_OPT,
                    QEMU_CAPS_DRIVE, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE,
                    QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
    DO_TEST_FAILURE("machine-deakeywrap-off-cap", NONE);

    DO_TEST("machine-keywrap-none-caps",
            QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_AES_KEY_WRAP, QEMU_CAPS_DEA_KEY_WRAP,
            QEMU_CAPS_DRIVE, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE,
            QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
    DO_TEST("machine-keywrap-none",
            QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_DRIVE, QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_DEVICE, QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);

1697
    virObjectUnref(driver.config);
1698
    virObjectUnref(driver.caps);
1699
    virObjectUnref(driver.xmlopt);
1700

1701
    return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
1702 1703
}

1704
VIRT_TEST_MAIN_PRELOAD(mymain, abs_builddir "/.libs/qemuxml2argvmock.so")
1705

1706 1707
#else

1708 1709 1710 1711
int main(void)
{
    return EXIT_AM_SKIP;
}
1712 1713

#endif /* WITH_QEMU */