qemuxml2argvtest.c 74.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
# include "qemu/qemu_alias.h"
18 19
# include "qemu/qemu_capabilities.h"
# include "qemu/qemu_command.h"
M
Matthias Bolte 已提交
20
# include "qemu/qemu_domain.h"
21
# include "qemu/qemu_migration.h"
22
# include "qemu/qemu_process.h"
23
# include "datatypes.h"
24
# include "conf/storage_conf.h"
25
# include "cpu/cpu_map.h"
26
# include "virstring.h"
27
# include "storage/storage_driver.h"
28
# include "virmock.h"
29

30
# include "testutilsqemu.h"
31

32 33
# define VIR_FROM_THIS VIR_FROM_QEMU

34
static const char *abs_top_srcdir;
35
static virQEMUDriver driver;
36

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

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

59 60 61
    if (virUUIDGenerate(uuid) < 0)
        return NULL;

62
    return virGetSecret(conn, uuid, usageType, usageID);
63 64 65
}

static virSecretDriver fakeSecretDriver = {
66 67 68 69 70 71 72 73 74
    .connectNumOfSecrets = NULL,
    .connectListSecrets = NULL,
    .secretLookupByUUID = NULL,
    .secretLookupByUsage = fakeSecretLookupByUsage,
    .secretDefineXML = NULL,
    .secretGetXMLDesc = NULL,
    .secretSetValue = NULL,
    .secretGetValue = fakeSecretGetValue,
    .secretUndefine = NULL,
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 101 102 103

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

104
 cleanup:
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 138 139 140
    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);

141
 cleanup:
142 143 144
    virStringFreeList(volinfo);
    return ret;

145
 fallback:
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 201 202 203
    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;
    }

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

244
typedef enum {
245 246 247 248
    FLAG_EXPECT_FAILURE     = 1 << 0,
    FLAG_EXPECT_PARSE_ERROR = 1 << 1,
    FLAG_JSON               = 1 << 2,
    FLAG_FIPS               = 1 << 3,
249 250
} virQemuXML2ArgvTestFlags;

251
static int testCompareXMLToArgvFiles(const char *xml,
E
Eric Blake 已提交
252
                                     const char *cmdline,
253
                                     virQEMUCapsPtr extraFlags,
254
                                     const char *migrateURI,
255 256
                                     virQemuXML2ArgvTestFlags flags,
                                     unsigned int parseFlags)
257
{
258
    char *actualargv = NULL;
E
Eric Blake 已提交
259
    int ret = -1;
260
    virDomainObjPtr vm = NULL;
261
    virDomainChrSourceDef monitor_chr;
262
    virConnectPtr conn;
J
Jiri Denemark 已提交
263
    char *log = NULL;
E
Eric Blake 已提交
264
    virCommandPtr cmd = NULL;
265
    size_t i;
266
    qemuDomainObjPrivatePtr priv = NULL;
267 268

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

273 274 275 276 277 278
    if (!(vm = virDomainObjNew(driver.xmlopt)))
        goto out;

    if (!(vm->def = virDomainDefParseFile(xml, driver.caps, driver.xmlopt,
                                          (VIR_DOMAIN_DEF_PARSE_INACTIVE |
                                           parseFlags)))) {
P
Pavel Hrdina 已提交
279
        if (flags & FLAG_EXPECT_PARSE_ERROR)
280
            goto ok;
281
        goto out;
282
    }
283
    priv = vm->privateData;
284

P
Pavel Hrdina 已提交
285 286 287
    if (virBitmapParse("0-3", '\0', &priv->autoNodeset, 4) < 0)
        goto out;

288
    if (!virDomainDefCheckABIStability(vm->def, vm->def)) {
289
        VIR_TEST_DEBUG("ABI stability check failed on %s", xml);
290 291 292
        goto out;
    }

293
    vm->def->id = -1;
294

295

296
    memset(&monitor_chr, 0, sizeof(monitor_chr));
297
    if (qemuProcessPrepareMonitorChr(&monitor_chr, priv->libDir) < 0)
298
        goto out;
299

300 301
    virQEMUCapsSetList(extraFlags,
                       QEMU_CAPS_NO_ACPI,
302
                       QEMU_CAPS_DEVICE,
303
                       QEMU_CAPS_LAST);
304

305 306 307 308
    if (STREQ(vm->def->os.machine, "pc") &&
        STREQ(vm->def->emulator, "/usr/bin/qemu-system-x86_64")) {
        VIR_FREE(vm->def->os.machine);
        if (VIR_STRDUP(vm->def->os.machine, "pc-0.11") < 0)
309 310
            goto out;
    }
311

312
    virQEMUCapsFilterByMachineType(extraFlags, vm->def->os.machine);
313

314 315
    log = virtTestLogContentAndReset();
    VIR_FREE(log);
316
    virResetLastError();
J
Jiri Denemark 已提交
317

318 319
    if (vm->def->os.arch == VIR_ARCH_X86_64 ||
        vm->def->os.arch == VIR_ARCH_I686) {
320
        virQEMUCapsSet(extraFlags, QEMU_CAPS_PCI_MULTIBUS);
321 322
    }

323 324
    for (i = 0; i < vm->def->nhostdevs; i++) {
        virDomainHostdevDefPtr hostdev = vm->def->hostdevs[i];
325 326 327 328 329 330 331 332

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

P
Pavel Hrdina 已提交
333 334 335
    if (!(cmd = qemuProcessCreatePretendCmd(conn, &driver, vm, migrateURI,
                                            (flags & FLAG_FIPS), false,
                                            VIR_QEMU_PROCESS_START_COLD))) {
P
Pavel Hrdina 已提交
336 337
        if (flags & FLAG_EXPECT_FAILURE)
            goto ok;
338
        goto out;
J
Jiri Denemark 已提交
339 340
    }

E
Eric Blake 已提交
341
    if (!(actualargv = virCommandToString(cmd)))
342
        goto out;
E
Eric Blake 已提交
343

C
Cole Robinson 已提交
344
    if (virtTestCompareToFile(actualargv, cmdline) < 0)
345
        goto out;
346

P
Pavel Hrdina 已提交
347 348
    ret = 0;

349
 ok:
350
    if (ret == 0 && flags & FLAG_EXPECT_FAILURE) {
P
Pavel Hrdina 已提交
351 352 353 354 355
        ret = -1;
        VIR_TEST_DEBUG("Error expected but there wasn't any.\n");
        goto out;
    }
    if (!virtTestOOMActive()) {
356
        if (flags & FLAG_EXPECT_FAILURE) {
P
Pavel Hrdina 已提交
357 358 359
            if ((log = virtTestLogContentAndReset()))
                VIR_TEST_DEBUG("Got expected error: \n%s", log);
        }
360
        virResetLastError();
P
Pavel Hrdina 已提交
361
        ret = 0;
362 363
    }

364
 out:
365 366
    VIR_FREE(log);
    VIR_FREE(actualargv);
E
Eric Blake 已提交
367
    virCommandFree(cmd);
368
    virObjectUnref(vm);
369
    virObjectUnref(conn);
370 371 372 373
    return ret;
}


374 375
struct testInfo {
    const char *name;
376
    virQEMUCapsPtr extraFlags;
377
    const char *migrateFrom;
378
    int migrateFd;
379
    unsigned int flags;
380
    unsigned int parseFlags;
381 382
};

383 384 385 386
static int
testCompareXMLToArgvHelper(const void *data)
{
    int result = -1;
387
    const struct testInfo *info = data;
388 389
    char *xml = NULL;
    char *args = NULL;
390
    unsigned int flags = info->flags;
391 392 393
    char *migrateURI = NULL;

    if (info->migrateFrom &&
394 395
        !(migrateURI = qemuMigrationIncomingURI(info->migrateFrom,
                                                info->migrateFd)))
396
        goto cleanup;
397 398 399 400 401 402 403

    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;

404
    if (virQEMUCapsGet(info->extraFlags, QEMU_CAPS_MONITOR_JSON))
405 406
        flags |= FLAG_JSON;

407 408 409
    if (virQEMUCapsGet(info->extraFlags, QEMU_CAPS_ENABLE_FIPS))
        flags |= FLAG_FIPS;

410 411
    if (qemuTestCapsCacheInsert(driver.qemuCapsCache, info->name,
                                info->extraFlags) < 0)
P
Pavel Fedin 已提交
412 413
        goto cleanup;

414
    result = testCompareXMLToArgvFiles(xml, args, info->extraFlags,
415
                                       migrateURI, flags, info->parseFlags);
416

417
 cleanup:
418
    VIR_FREE(migrateURI);
419 420
    VIR_FREE(xml);
    VIR_FREE(args);
421
    return result;
422 423 424
}


425
static int
426
testAddCPUModels(virQEMUCapsPtr caps, bool skipLegacy)
427 428 429 430
{
    const char *newModels[] = {
        "Opteron_G3", "Opteron_G2", "Opteron_G1",
        "Nehalem", "Penryn", "Conroe",
431
        "Haswell-noTSX", "Haswell",
432 433 434 435 436 437 438 439
    };
    const char *legacyModels[] = {
        "n270", "athlon", "pentium3", "pentium2", "pentium",
        "486", "coreduo", "kvm32", "qemu32", "kvm64",
        "core2duo", "phenom", "qemu64",
    };
    size_t i;

440
    for (i = 0; i < ARRAY_CARDINALITY(newModels); i++) {
441
        if (virQEMUCapsAddCPUDefinition(caps, newModels[i]) < 0)
442 443 444 445
            return -1;
    }
    if (skipLegacy)
        return 0;
446
    for (i = 0; i < ARRAY_CARDINALITY(legacyModels); i++) {
447
        if (virQEMUCapsAddCPUDefinition(caps, legacyModels[i]) < 0)
448 449 450 451 452
            return -1;
    }
    return 0;
}

453

454
static int
E
Eric Blake 已提交
455
mymain(void)
456 457
{
    int ret = 0;
458
    bool skipLegacyCPUs = false;
459

460 461
    abs_top_srcdir = getenv("abs_top_srcdir");
    if (!abs_top_srcdir)
462
        abs_top_srcdir = abs_srcdir "/..";
463

464 465 466 467 468 469 470 471 472 473
    /* 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;
    }

474
    if (qemuTestDriverInit(&driver) < 0)
475
        return EXIT_FAILURE;
476 477

    driver.privileged = true;
478

479
    VIR_FREE(driver.config->vncTLSx509certdir);
480
    if (VIR_STRDUP_QUIET(driver.config->vncTLSx509certdir, "/etc/pki/libvirt-vnc") < 0)
481 482
        return EXIT_FAILURE;
    VIR_FREE(driver.config->spiceTLSx509certdir);
483
    if (VIR_STRDUP_QUIET(driver.config->spiceTLSx509certdir, "/etc/pki/libvirt-spice") < 0)
484 485
        return EXIT_FAILURE;

486
    VIR_FREE(driver.config->stateDir);
487
    if (VIR_STRDUP_QUIET(driver.config->stateDir, "/nowhere") < 0)
488
        return EXIT_FAILURE;
489
    VIR_FREE(driver.config->hugetlbfs);
490
    if (VIR_ALLOC_N(driver.config->hugetlbfs, 2) < 0)
491
        return EXIT_FAILURE;
492 493 494
    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)
495
        return EXIT_FAILURE;
496 497
    driver.config->hugetlbfs[0].size = 2048;
    driver.config->hugetlbfs[0].deflt = true;
498
    driver.config->hugetlbfs[1].size = 1048576;
499
    driver.config->spiceTLS = 1;
500
    if (VIR_STRDUP_QUIET(driver.config->spicePassword, "123456") < 0)
501
        return EXIT_FAILURE;
502

503 504
# define DO_TEST_FULL(name, migrateFrom, migrateFd, flags,              \
                      parseFlags, ...)                                  \
505
    do {                                                                \
506
        static struct testInfo info = {                                 \
507
            name, NULL, migrateFrom, migrateFd, (flags), parseFlags     \
J
Jiri Denemark 已提交
508
        };                                                              \
509
        if (!(info.extraFlags = virQEMUCapsNew()))                      \
510
            return EXIT_FAILURE;                                        \
511 512
        if (testAddCPUModels(info.extraFlags, skipLegacyCPUs) < 0)      \
            return EXIT_FAILURE;                                        \
513
        virQEMUCapsSetList(info.extraFlags, __VA_ARGS__, QEMU_CAPS_LAST);\
514
        if (virtTestRun("QEMU XML-2-ARGV " name,                        \
515
                        testCompareXMLToArgvHelper, &info) < 0)         \
516
            ret = -1;                                                   \
517
        virObjectUnref(info.extraFlags);                                \
518 519
    } while (0)

520
# define DO_TEST(name, ...)                                             \
521
    DO_TEST_FULL(name, NULL, -1, 0, 0, __VA_ARGS__)
522

523
# define DO_TEST_FAILURE(name, ...)                                     \
524
    DO_TEST_FULL(name, NULL, -1, FLAG_EXPECT_FAILURE, 0, __VA_ARGS__)
525 526 527

# define DO_TEST_PARSE_ERROR(name, ...)                                 \
    DO_TEST_FULL(name, NULL, -1,                                        \
528
                 FLAG_EXPECT_PARSE_ERROR | FLAG_EXPECT_FAILURE,         \
529 530
                 0, __VA_ARGS__)

531 532
# define DO_TEST_PARSE_FLAGS_ERROR(name, parseFlags, ...)               \
    DO_TEST_FULL(name, NULL, -1,                                        \
533
                 FLAG_EXPECT_PARSE_ERROR | FLAG_EXPECT_FAILURE,         \
534
                 parseFlags, __VA_ARGS__)
535

536
# define DO_TEST_LINUX(name, ...)                                       \
537
    DO_TEST_LINUX_FULL(name, NULL, -1, 0, 0, __VA_ARGS__)
538

539 540 541 542 543 544
# 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. */
545 546
#  define DO_TEST_LINUX_FULL(name, ...)                                 \
    DO_TEST_FULL(name, __VA_ARGS__)
547
# else  /* __linux__ */
548
#  define DO_TEST_LINUX_FULL(name, ...)                                 \
549 550 551 552 553
    do {                                                                \
        const char *tmp ATTRIBUTE_UNUSED = name;                        \
    } while (0)
# endif /* __linux__ */

554
# define NONE QEMU_CAPS_LAST
555

556 557 558
    /* 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 */
559 560 561 562 563 564 565
    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");
566 567
    unsetenv("QEMU_AUDIO_DRV");
    unsetenv("SDL_AUDIODRIVER");
568

569
    DO_TEST("minimal", NONE);
570
    DO_TEST_PARSE_ERROR("minimal-no-memory", NONE);
571
    DO_TEST("minimal-msg-timestamp", QEMU_CAPS_MSG_TIMESTAMP);
572
    DO_TEST("machine-aliases1", NONE);
573
    DO_TEST("machine-aliases2", QEMU_CAPS_KVM);
574 575 576 577
    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);
578
    DO_TEST_FAILURE("machine-core-on", NONE);
579
    DO_TEST_FAILURE("machine-core-on", QEMU_CAPS_MACHINE_OPT);
L
Li Zhang 已提交
580 581
    DO_TEST("machine-usb-opt", QEMU_CAPS_MACHINE_OPT,
            QEMU_CAPS_MACHINE_USB_OPT);
582 583
    DO_TEST("machine-vmport-opt", QEMU_CAPS_MACHINE_OPT,
            QEMU_CAPS_MACHINE_VMPORT_OPT);
584
    DO_TEST("kvm", QEMU_CAPS_MACHINE_OPT);
585 586
    DO_TEST("default-kvm-host-arch", QEMU_CAPS_MACHINE_OPT);
    DO_TEST("default-qemu-host-arch", QEMU_CAPS_MACHINE_OPT);
587 588 589
    DO_TEST("boot-cdrom", NONE);
    DO_TEST("boot-network", NONE);
    DO_TEST("boot-floppy", NONE);
590
    DO_TEST("boot-floppy-q35",
591
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
592
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
593
            QEMU_CAPS_ICH9_AHCI);
594
    DO_TEST("bootindex-floppy-q35",
595
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
596
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
597
            QEMU_CAPS_ICH9_AHCI, QEMU_CAPS_BOOT_MENU,
598
            QEMU_CAPS_BOOTINDEX);
599 600
    DO_TEST("boot-multi", QEMU_CAPS_BOOT_MENU);
    DO_TEST("boot-menu-enable",
601
            QEMU_CAPS_BOOT_MENU);
602
    DO_TEST("boot-menu-enable",
603
            QEMU_CAPS_BOOT_MENU,
604
            QEMU_CAPS_BOOTINDEX);
605
    DO_TEST("boot-menu-enable-with-timeout",
606
            QEMU_CAPS_BOOT_MENU,
607
            QEMU_CAPS_SPLASH_TIMEOUT);
608
    DO_TEST_FAILURE("boot-menu-enable-with-timeout", QEMU_CAPS_BOOT_MENU);
609
    DO_TEST_PARSE_ERROR("boot-menu-enable-with-timeout-invalid", NONE);
610 611
    DO_TEST("boot-menu-disable", QEMU_CAPS_BOOT_MENU);
    DO_TEST("boot-menu-disable-drive",
612
            QEMU_CAPS_BOOT_MENU);
613
    DO_TEST("boot-menu-disable-drive-bootindex",
614
            QEMU_CAPS_BOOT_MENU,
615
            QEMU_CAPS_BOOTINDEX);
616
    DO_TEST_PARSE_ERROR("boot-dev+order",
617
            QEMU_CAPS_BOOTINDEX,
618
            QEMU_CAPS_VIRTIO_BLK_SCSI, QEMU_CAPS_VIRTIO_BLK_SG_IO);
619
    DO_TEST("boot-order",
620
            QEMU_CAPS_BOOTINDEX,
621
            QEMU_CAPS_VIRTIO_BLK_SCSI, QEMU_CAPS_VIRTIO_BLK_SG_IO);
622
    DO_TEST("boot-complex",
623
            QEMU_CAPS_DRIVE_BOOT,
624
            QEMU_CAPS_VIRTIO_BLK_SCSI, QEMU_CAPS_VIRTIO_BLK_SG_IO);
625
    DO_TEST("boot-complex-bootindex",
626
            QEMU_CAPS_DRIVE_BOOT,
627 628
            QEMU_CAPS_BOOTINDEX,
            QEMU_CAPS_VIRTIO_BLK_SCSI, QEMU_CAPS_VIRTIO_BLK_SG_IO);
629
    DO_TEST("boot-strict",
630
            QEMU_CAPS_DRIVE_BOOT,
631 632
            QEMU_CAPS_BOOTINDEX, QEMU_CAPS_BOOT_STRICT,
            QEMU_CAPS_VIRTIO_BLK_SCSI, QEMU_CAPS_VIRTIO_BLK_SG_IO);
633 634 635 636 637

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

638 639
    DO_TEST("bios", QEMU_CAPS_SGA);
    DO_TEST("bios-nvram",
640
            QEMU_CAPS_DRIVE_READONLY);
641
    DO_TEST("clock-utc", QEMU_CAPS_NODEFCONFIG);
642
    DO_TEST("clock-localtime", NONE);
643
    DO_TEST("clock-localtime-basis-localtime", QEMU_CAPS_RTC);
644 645
    DO_TEST("clock-variable", QEMU_CAPS_RTC);
    DO_TEST("clock-france", QEMU_CAPS_RTC);
646 647
    DO_TEST("clock-hpet-off", QEMU_CAPS_RTC, QEMU_CAPS_NO_HPET,
            QEMU_CAPS_NO_KVM_PIT);
648
    DO_TEST("clock-catchup", QEMU_CAPS_RTC, QEMU_CAPS_NO_KVM_PIT);
649 650 651
    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);
652
    DO_TEST("clock-timer-hyperv-rtc", QEMU_CAPS_KVM);
653

654 655
    DO_TEST("cpu-eoi-disabled", QEMU_CAPS_ENABLE_KVM);
    DO_TEST("cpu-eoi-enabled", QEMU_CAPS_ENABLE_KVM);
656
    DO_TEST("controller-order", QEMU_CAPS_PCIDEVICE,
657
            QEMU_CAPS_KVM, QEMU_CAPS_ENABLE_KVM,
658 659 660 661
            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);
662 663
    DO_TEST("eoi-disabled", NONE);
    DO_TEST("eoi-enabled", NONE);
664 665
    DO_TEST("pv-spinlock-disabled", NONE);
    DO_TEST("pv-spinlock-enabled", NONE);
M
Martin Kletzander 已提交
666
    DO_TEST("kvmclock+eoi-disabled", QEMU_CAPS_ENABLE_KVM);
667

668
    DO_TEST("hyperv", NONE);
669
    DO_TEST("hyperv-off", NONE);
670
    DO_TEST("hyperv-panic", NONE);
671

672 673 674
    DO_TEST("kvm-features", NONE);
    DO_TEST("kvm-features-off", NONE);

675 676 677
    DO_TEST("pmu-feature", NONE);
    DO_TEST("pmu-feature-off", NONE);

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

874 875
    DO_TEST("graphics-vnc", QEMU_CAPS_VNC);
    DO_TEST("graphics-vnc-socket", QEMU_CAPS_VNC);
876
    DO_TEST("graphics-vnc-websocket", QEMU_CAPS_VNC, QEMU_CAPS_VNC_WEBSOCKET);
877
    DO_TEST("graphics-vnc-policy", QEMU_CAPS_VNC, QEMU_CAPS_VNC_SHARE_POLICY);
P
Pavel Hrdina 已提交
878
    DO_TEST("graphics-vnc-no-listen-attr", QEMU_CAPS_VNC);
879

880 881
    driver.config->vncSASL = 1;
    VIR_FREE(driver.config->vncSASLdir);
882
    ignore_value(VIR_STRDUP(driver.config->vncSASLdir, "/root/.sasl2"));
883
    DO_TEST("graphics-vnc-sasl", QEMU_CAPS_VNC);
884 885
    driver.config->vncTLS = 1;
    driver.config->vncTLSx509verify = 1;
886
    DO_TEST("graphics-vnc-tls", QEMU_CAPS_VNC);
887
    driver.config->vncSASL = driver.config->vncTLSx509verify = driver.config->vncTLS = 0;
888 889
    VIR_FREE(driver.config->vncSASLdir);
    VIR_FREE(driver.config->vncTLSx509certdir);
890

891 892
    DO_TEST("graphics-sdl", QEMU_CAPS_SDL);
    DO_TEST("graphics-sdl-fullscreen", QEMU_CAPS_SDL);
893
    DO_TEST("nographics", NONE);
894
    DO_TEST("nographics-vga",
895
            QEMU_CAPS_VGA_NONE);
896
    DO_TEST("graphics-spice",
897
            QEMU_CAPS_VGA_QXL,
898
            QEMU_CAPS_SPICE,
899 900
            QEMU_CAPS_DEVICE_QXL,
            QEMU_CAPS_SPICE_FILE_XFER_DISABLE);
901 902
    DO_TEST("graphics-spice-no-args",
            QEMU_CAPS_SPICE);
903 904 905
    driver.config->spiceSASL = 1;
    ignore_value(VIR_STRDUP(driver.config->spiceSASLdir, "/root/.sasl2"));
    DO_TEST("graphics-spice-sasl",
906
            QEMU_CAPS_VGA_QXL,
907
            QEMU_CAPS_SPICE,
908 909 910
            QEMU_CAPS_DEVICE_QXL);
    VIR_FREE(driver.config->spiceSASLdir);
    driver.config->spiceSASL = 0;
911
    DO_TEST("graphics-spice-agentmouse",
912
            QEMU_CAPS_VGA_QXL,
913
            QEMU_CAPS_SPICE,
914 915
            QEMU_CAPS_CHARDEV_SPICEVMC,
            QEMU_CAPS_NODEFCONFIG);
916
    DO_TEST("graphics-spice-compression",
917
            QEMU_CAPS_VGA_QXL,
918
            QEMU_CAPS_SPICE,
919
            QEMU_CAPS_DEVICE_QXL);
920
    DO_TEST("graphics-spice-timeout",
921
            QEMU_CAPS_KVM,
922
            QEMU_CAPS_VGA_QXL,
923
            QEMU_CAPS_SPICE,
924
            QEMU_CAPS_DEVICE_QXL_VGA);
925
    DO_TEST("graphics-spice-qxl-vga",
926
            QEMU_CAPS_VGA_QXL,
927
            QEMU_CAPS_SPICE,
928 929
            QEMU_CAPS_DEVICE_QXL_VGA,
            QEMU_CAPS_DEVICE_QXL);
930
    DO_TEST("graphics-spice-usb-redir",
931
            QEMU_CAPS_SPICE,
932
            QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG,
933 934 935
            QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_USB_HUB,
            QEMU_CAPS_ICH9_USB_EHCI1, QEMU_CAPS_USB_REDIR,
            QEMU_CAPS_CHARDEV_SPICEVMC);
936
    DO_TEST("graphics-spice-agent-file-xfer",
937
            QEMU_CAPS_VGA_QXL,
938
            QEMU_CAPS_SPICE,
939 940 941
            QEMU_CAPS_DEVICE_QXL_VGA,
            QEMU_CAPS_DEVICE_QXL,
            QEMU_CAPS_SPICE_FILE_XFER_DISABLE);
942

943 944 945
    DO_TEST("input-usbmouse", NONE);
    DO_TEST("input-usbtablet", NONE);
    DO_TEST("misc-acpi", NONE);
946 947 948
    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);
949
    DO_TEST_FAILURE("misc-enable-s4", NONE);
950
    DO_TEST("misc-no-reboot", NONE);
951
    DO_TEST("misc-uuid", NONE);
952
    DO_TEST_PARSE_ERROR("vhost_queues-invalid", NONE);
953
    DO_TEST("net-vhostuser", QEMU_CAPS_NETDEV);
954
    DO_TEST("net-vhostuser-multiq",
955 956
            QEMU_CAPS_NETDEV, QEMU_CAPS_VHOSTUSER_MULTIQUEUE);
    DO_TEST_FAILURE("net-vhostuser-multiq", QEMU_CAPS_NETDEV);
957 958 959
    DO_TEST("net-user", NONE);
    DO_TEST("net-virtio", NONE);
    DO_TEST("net-virtio-device",
960
            QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_VIRTIO_TX_ALG);
961
    DO_TEST("net-virtio-disable-offloads",
962
            QEMU_CAPS_NODEFCONFIG);
963
    DO_TEST("net-virtio-netdev",
964
            QEMU_CAPS_NETDEV, QEMU_CAPS_NODEFCONFIG);
965
    DO_TEST("net-virtio-s390",
966
            QEMU_CAPS_VIRTIO_S390);
967
    DO_TEST("net-virtio-ccw",
968
            QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
969 970
    DO_TEST("net-eth", NONE);
    DO_TEST("net-eth-ifname", NONE);
971
    DO_TEST("net-eth-names", NONE);
972 973 974
    DO_TEST("net-client", NONE);
    DO_TEST("net-server", NONE);
    DO_TEST("net-mcast", NONE);
975
    DO_TEST("net-udp", NONE);
976
    DO_TEST("net-hostdev",
977
            QEMU_CAPS_PCIDEVICE, QEMU_CAPS_NODEFCONFIG);
978
    DO_TEST("net-hostdev-multidomain",
979
            QEMU_CAPS_PCIDEVICE, QEMU_CAPS_NODEFCONFIG,
980 981
            QEMU_CAPS_HOST_PCI_MULTIDOMAIN);
    DO_TEST_FAILURE("net-hostdev-multidomain",
982
                    QEMU_CAPS_PCIDEVICE,
983
                    QEMU_CAPS_NODEFCONFIG);
984
    DO_TEST("net-hostdev-vfio",
985
            QEMU_CAPS_PCIDEVICE, QEMU_CAPS_NODEFCONFIG,
986
            QEMU_CAPS_DEVICE_VFIO_PCI);
987
    DO_TEST("net-hostdev-vfio-multidomain",
988
            QEMU_CAPS_PCIDEVICE, QEMU_CAPS_NODEFCONFIG,
989 990
            QEMU_CAPS_DEVICE_VFIO_PCI, QEMU_CAPS_HOST_PCI_MULTIDOMAIN);
    DO_TEST_FAILURE("net-hostdev-vfio-multidomain",
991
                    QEMU_CAPS_PCIDEVICE,
992
                    QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DEVICE_VFIO_PCI);
993

994 995 996 997
    DO_TEST("serial-vc", NONE);
    DO_TEST("serial-pty", NONE);
    DO_TEST("serial-dev", NONE);
    DO_TEST("serial-file", NONE);
998 999
    DO_TEST("serial-file-log", QEMU_CAPS_CHARDEV, QEMU_CAPS_CHARDEV_FILE_APPEND,
            QEMU_CAPS_CHARDEV_LOGFILE);
1000 1001 1002 1003 1004
    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);
1005
    DO_TEST("serial-spiceport",
1006
            QEMU_CAPS_CHARDEV,
1007 1008 1009
            QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
            QEMU_CAPS_DEVICE_QXL, QEMU_CAPS_DEVICE_QXL_VGA,
            QEMU_CAPS_SPICE, QEMU_CAPS_CHARDEV_SPICEPORT);
1010
    DO_TEST("serial-spiceport-nospice", NONE);
1011

1012 1013 1014 1015 1016
    DO_TEST("parallel-tcp", NONE);
    DO_TEST("console-compat", NONE);
    DO_TEST("console-compat-auto", NONE);

    DO_TEST("serial-vc-chardev",
1017
            QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG);
1018
    DO_TEST("serial-pty-chardev",
1019
            QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG);
1020
    DO_TEST("serial-dev-chardev",
1021
            QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG);
1022
    DO_TEST("serial-dev-chardev-iobase",
1023
            QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG);
1024
    DO_TEST("serial-file-chardev",
1025
            QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG,
1026
            QEMU_CAPS_CHARDEV_FILE_APPEND);
1027
    DO_TEST("serial-unix-chardev",
1028
            QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG);
1029
    DO_TEST("serial-tcp-chardev",
1030
            QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG);
1031
    DO_TEST("serial-udp-chardev",
1032
            QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG);
1033
    DO_TEST("serial-tcp-telnet-chardev",
1034
            QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG);
1035
    DO_TEST("serial-many-chardev",
1036
            QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG);
1037
    DO_TEST("parallel-tcp-chardev",
1038
            QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG);
1039
    DO_TEST("parallel-parport-chardev",
1040
            QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG);
1041
    DO_TEST("console-compat-chardev",
1042
            QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG);
M
Michal Privoznik 已提交
1043
    DO_TEST("pci-serial-dev-chardev",
1044
            QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG,
M
Michal Privoznik 已提交
1045
            QEMU_CAPS_DEVICE_PCI_SERIAL);
1046

1047
    DO_TEST("channel-guestfwd",
1048
            QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG);
1049
    DO_TEST("channel-virtio",
1050
            QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG);
1051
    DO_TEST("channel-virtio-state",
1052
            QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG);
1053
    DO_TEST("channel-virtio-auto",
1054
            QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG);
1055
    DO_TEST("channel-virtio-autoassign",
1056
            QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG);
J
Ján Tomko 已提交
1057
    DO_TEST("channel-virtio-autoadd",
1058
            QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG);
1059
    DO_TEST("console-virtio",
1060
            QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG);
1061
    DO_TEST("console-virtio-many",
1062
            QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG);
1063
    DO_TEST("console-virtio-s390",
1064
            QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG,
1065
            QEMU_CAPS_BOOTINDEX, QEMU_CAPS_VIRTIO_S390);
1066
    DO_TEST("console-virtio-ccw",
1067
            QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG,
1068
            QEMU_CAPS_BOOTINDEX, QEMU_CAPS_VIRTIO_CCW,
1069
            QEMU_CAPS_VIRTIO_S390);
1070
    DO_TEST("console-sclp",
1071
            QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG,
1072
            QEMU_CAPS_VIRTIO_S390, QEMU_CAPS_SCLP_S390);
1073
    DO_TEST("channel-spicevmc",
1074
            QEMU_CAPS_NODEFCONFIG,
1075
            QEMU_CAPS_SPICE, QEMU_CAPS_CHARDEV_SPICEVMC);
1076
    DO_TEST("channel-spicevmc-old",
1077
            QEMU_CAPS_NODEFCONFIG,
1078
            QEMU_CAPS_SPICE, QEMU_CAPS_DEVICE_SPICEVMC);
1079
    DO_TEST("channel-virtio-default",
1080
            QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG,
1081
            QEMU_CAPS_SPICE, QEMU_CAPS_CHARDEV_SPICEVMC);
1082
    DO_TEST("channel-virtio-unix",
1083
            QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG);
1084

1085
    DO_TEST("smartcard-host",
1086
            QEMU_CAPS_CHARDEV,
1087
            QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_CCID_EMULATED);
1088
    DO_TEST("smartcard-host-certificates",
1089
            QEMU_CAPS_CHARDEV,
1090
            QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_CCID_EMULATED);
1091
    DO_TEST("smartcard-passthrough-tcp",
1092
            QEMU_CAPS_CHARDEV,
1093
            QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_CCID_PASSTHRU);
1094
    DO_TEST("smartcard-passthrough-spicevmc",
1095
            QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG,
1096
            QEMU_CAPS_CCID_PASSTHRU, QEMU_CAPS_CHARDEV_SPICEVMC);
1097
    DO_TEST("smartcard-controller",
1098
            QEMU_CAPS_CHARDEV,
1099 1100
            QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_CCID_EMULATED);

1101
    DO_TEST("usb-controller",
1102
            QEMU_CAPS_CHARDEV,
1103
            QEMU_CAPS_NODEFCONFIG);
1104
    DO_TEST("usb-piix3-controller",
1105
            QEMU_CAPS_CHARDEV, QEMU_CAPS_PIIX3_USB_UHCI,
1106
            QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_NODEFCONFIG);
1107
    DO_TEST("usb-ich9-ehci-addr",
1108
            QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG,
1109
            QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_ICH9_USB_EHCI1);
1110
    DO_TEST("input-usbmouse-addr",
1111
            QEMU_CAPS_NODEFCONFIG);
1112
    DO_TEST("usb-ich9-companion",
1113
            QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG,
1114
            QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_ICH9_USB_EHCI1);
1115
    DO_TEST_PARSE_ERROR("usb-ich9-no-companion",
1116
            QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG,
1117
            QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_ICH9_USB_EHCI1);
1118
    DO_TEST("usb-hub",
1119
            QEMU_CAPS_CHARDEV, QEMU_CAPS_USB_HUB,
M
Marc-André Lureau 已提交
1120
            QEMU_CAPS_NODEFCONFIG);
1121
    DO_TEST("usb-ports",
1122
            QEMU_CAPS_CHARDEV, QEMU_CAPS_USB_HUB,
1123
            QEMU_CAPS_NODEFCONFIG);
1124
    DO_TEST("usb-redir",
1125
            QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG,
1126
            QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_USB_HUB,
1127 1128
            QEMU_CAPS_ICH9_USB_EHCI1, QEMU_CAPS_USB_REDIR,
            QEMU_CAPS_SPICE, QEMU_CAPS_CHARDEV_SPICEVMC);
1129
    DO_TEST("usb-redir-boot",
1130
            QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG,
1131 1132 1133 1134
            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);
1135
    DO_TEST("usb-redir-filter",
1136
            QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG,
1137 1138 1139 1140
            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);
1141
    DO_TEST("usb-redir-filter-version",
1142
            QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG,
1143 1144 1145
            QEMU_CAPS_USB_REDIR,
            QEMU_CAPS_SPICE, QEMU_CAPS_CHARDEV_SPICEVMC,
            QEMU_CAPS_USB_REDIR_FILTER);
1146
    DO_TEST("usb1-usb2",
1147
            QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG,
1148 1149
            QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_PIIX3_USB_UHCI,
            QEMU_CAPS_USB_HUB, QEMU_CAPS_ICH9_USB_EHCI1);
1150
    DO_TEST("usb-none",
1151
            QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG);
1152
    DO_TEST_PARSE_ERROR("usb-none-other",
1153
            QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG);
1154
    DO_TEST_PARSE_ERROR("usb-none-hub",
1155
            QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG,
1156 1157
            QEMU_CAPS_USB_HUB);
    DO_TEST_PARSE_ERROR("usb-none-usbtablet",
1158
            QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG);
1159
    DO_TEST("usb-controller-default-q35",
1160
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
1161 1162 1163
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, QEMU_CAPS_PCI_OHCI,
            QEMU_CAPS_PIIX3_USB_UHCI, QEMU_CAPS_NEC_USB_XHCI);
    DO_TEST_FAILURE("usb-controller-default-unavailable-q35",
1164
                    QEMU_CAPS_DEVICE_PCI_BRIDGE,
1165 1166 1167
                    QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, QEMU_CAPS_PCI_OHCI,
                    QEMU_CAPS_NEC_USB_XHCI);
    DO_TEST("usb-controller-explicit-q35",
1168
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
1169 1170 1171
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, QEMU_CAPS_PCI_OHCI,
            QEMU_CAPS_PIIX3_USB_UHCI, QEMU_CAPS_NEC_USB_XHCI);
    DO_TEST_FAILURE("usb-controller-explicit-unavailable-q35",
1172
                    QEMU_CAPS_DEVICE_PCI_BRIDGE,
1173 1174
                    QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, QEMU_CAPS_PCI_OHCI,
                    QEMU_CAPS_PIIX3_USB_UHCI);
1175

1176
    DO_TEST("smbios", QEMU_CAPS_SMBIOS_TYPE);
1177
    DO_TEST_PARSE_ERROR("smbios-date", QEMU_CAPS_SMBIOS_TYPE);
1178
    DO_TEST_PARSE_ERROR("smbios-uuid-match", QEMU_CAPS_SMBIOS_TYPE);
1179

1180
    DO_TEST("watchdog", NONE);
1181
    DO_TEST("watchdog-device", QEMU_CAPS_NODEFCONFIG);
1182
    DO_TEST("watchdog-dump", NONE);
1183
    DO_TEST("watchdog-injectnmi", NONE);
1184
    DO_TEST("watchdog-diag288",
1185
            QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG,
1186
            QEMU_CAPS_BOOTINDEX, QEMU_CAPS_VIRTIO_S390);
1187 1188
    DO_TEST("balloon-device", QEMU_CAPS_NODEFCONFIG);
    DO_TEST("balloon-device-deflate", QEMU_CAPS_NODEFCONFIG,
1189
            QEMU_CAPS_VIRTIO_BALLOON_AUTODEFLATE);
1190
    DO_TEST("balloon-ccw-deflate", QEMU_CAPS_NODEFCONFIG,
1191
            QEMU_CAPS_VIRTIO_BALLOON_AUTODEFLATE);
1192
    DO_TEST("balloon-mmio-deflate", QEMU_CAPS_NODEFCONFIG,
1193 1194
            QEMU_CAPS_DTB, QEMU_CAPS_DEVICE_VIRTIO_MMIO,
            QEMU_CAPS_VIRTIO_BALLOON_AUTODEFLATE);
1195
    DO_TEST("balloon-device-deflate-off", QEMU_CAPS_NODEFCONFIG,
1196
            QEMU_CAPS_VIRTIO_BALLOON_AUTODEFLATE);
1197
    DO_TEST("balloon-device-auto",
1198 1199
            QEMU_CAPS_NODEFCONFIG);
    DO_TEST("balloon-device-period", QEMU_CAPS_NODEFCONFIG);
1200 1201
    DO_TEST("sound", NONE);
    DO_TEST("sound-device",
1202
            QEMU_CAPS_NODEFCONFIG,
1203
            QEMU_CAPS_HDA_DUPLEX, QEMU_CAPS_HDA_MICRO,
1204 1205
            QEMU_CAPS_DEVICE_ICH9_INTEL_HDA,
            QEMU_CAPS_OBJECT_USB_AUDIO);
1206
    DO_TEST("fs9p",
1207
            QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_FSDEV,
1208
            QEMU_CAPS_FSDEV_WRITEOUT);
1209
    DO_TEST("fs9p-ccw",
1210
            QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_FSDEV,
1211
            QEMU_CAPS_FSDEV_WRITEOUT,
1212
            QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
1213

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

1236 1237 1238 1239
    DO_TEST_FULL("restore-v2", "exec:cat", 7, 0, 0, NONE);
    DO_TEST_FULL("restore-v2-fd", "stdio", 7, 0, 0, NONE);
    DO_TEST_FULL("restore-v2-fd", "fd:7", 7, 0, 0, NONE);
    DO_TEST_FULL("migrate", "tcp:10.0.0.1:5000", -1, 0, 0, NONE);
1240

1241
    DO_TEST_LINUX_FULL("migrate-numa-unaligned", "stdio", 7, 0, 0,
1242
                       QEMU_CAPS_NUMA,
1243 1244
                       QEMU_CAPS_OBJECT_MEMORY_RAM);

1245
    DO_TEST("qemu-ns", NONE);
1246
    DO_TEST("qemu-ns-no-env", NONE);
1247

1248
    DO_TEST("smp", QEMU_CAPS_SMP_TOPOLOGY);
1249

J
John Ferlan 已提交
1250
    DO_TEST("iothreads", QEMU_CAPS_OBJECT_IOTHREAD);
1251 1252
    DO_TEST("iothreads-ids", QEMU_CAPS_OBJECT_IOTHREAD);
    DO_TEST("iothreads-ids-partial", QEMU_CAPS_OBJECT_IOTHREAD);
1253
    DO_TEST_FAILURE("iothreads-nocap", NONE);
1254 1255
    DO_TEST("iothreads-disk", QEMU_CAPS_OBJECT_IOTHREAD);
    DO_TEST("iothreads-disk-virtio-ccw", QEMU_CAPS_OBJECT_IOTHREAD,
1256
            QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
J
John Ferlan 已提交
1257

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

1289 1290 1291 1292 1293 1294 1295
    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;

1296 1297 1298 1299 1300 1301 1302 1303
    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);
1304
    DO_TEST("cputune-numatune", QEMU_CAPS_SMP_TOPOLOGY,
1305
            QEMU_CAPS_KVM,
1306
            QEMU_CAPS_OBJECT_IOTHREAD,
1307 1308
            QEMU_CAPS_OBJECT_MEMORY_RAM,
            QEMU_CAPS_OBJECT_MEMORY_FILE);
1309

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

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

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

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

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

1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360
    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);
1361

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

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

1406 1407
    DO_TEST("video-device-pciaddr-default",
            QEMU_CAPS_KVM, QEMU_CAPS_VNC,
1408
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
1409 1410
            QEMU_CAPS_DEVICE_QXL, QEMU_CAPS_DEVICE_QXL_VGA,
            QEMU_CAPS_DEVICE_PCI_BRIDGE);
1411
    DO_TEST("video-vga-nodevice", NONE);
1412
    DO_TEST("video-vga-device", QEMU_CAPS_DEVICE_VGA,
1413
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
1414
    DO_TEST("video-vga-device-vgamem", QEMU_CAPS_DEVICE_VGA,
1415
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY, QEMU_CAPS_VGA_VGAMEM);
1416
    DO_TEST("video-qxl-nodevice", QEMU_CAPS_VGA_QXL);
1417
    DO_TEST("video-qxl-device", QEMU_CAPS_DEVICE_QXL_VGA,
1418
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
1419
    DO_TEST("video-qxl-device-vgamem",
1420 1421
            QEMU_CAPS_DEVICE_QXL_VGA, QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
            QEMU_CAPS_QXL_VGA_VGAMEM);
1422
    DO_TEST_FAILURE("video-qxl-sec-nodevice", QEMU_CAPS_VGA_QXL);
1423
    DO_TEST("video-qxl-sec-device", QEMU_CAPS_DEVICE_QXL_VGA,
1424
            QEMU_CAPS_DEVICE_QXL, QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
1425
    DO_TEST("video-qxl-sec-device-vgamem",
1426
            QEMU_CAPS_DEVICE_QXL_VGA, QEMU_CAPS_DEVICE_QXL,
1427 1428
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY, QEMU_CAPS_QXL_VGA_VGAMEM,
            QEMU_CAPS_QXL_VGAMEM);
M
Marc-André Lureau 已提交
1429
    DO_TEST("video-virtio-gpu-device",
1430
            QEMU_CAPS_DEVICE_VIRTIO_GPU,
M
Marc-André Lureau 已提交
1431
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
1432
    DO_TEST("video-virtio-gpu-virgl",
1433
            QEMU_CAPS_DEVICE_VIRTIO_GPU,
1434 1435
            QEMU_CAPS_DEVICE_VIRTIO_GPU_VIRGL,
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
1436 1437 1438 1439 1440 1441
    DO_TEST("video-virtio-gpu-spice-gl",
            QEMU_CAPS_DEVICE_VIRTIO_GPU,
            QEMU_CAPS_DEVICE_VIRTIO_GPU_VIRGL,
            QEMU_CAPS_SPICE,
            QEMU_CAPS_SPICE_GL,
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
1442
    DO_TEST_PARSE_ERROR("video-invalid", NONE);
1443

1444
    DO_TEST("virtio-rng-default", QEMU_CAPS_DEVICE_VIRTIO_RNG,
1445
            QEMU_CAPS_OBJECT_RNG_RANDOM);
1446
    DO_TEST("virtio-rng-random", QEMU_CAPS_DEVICE_VIRTIO_RNG,
1447
            QEMU_CAPS_OBJECT_RNG_RANDOM);
1448
    DO_TEST("virtio-rng-egd", QEMU_CAPS_DEVICE_VIRTIO_RNG,
1449
            QEMU_CAPS_OBJECT_RNG_EGD);
1450
    DO_TEST("virtio-rng-multiple", QEMU_CAPS_DEVICE_VIRTIO_RNG,
1451
            QEMU_CAPS_OBJECT_RNG_EGD, QEMU_CAPS_OBJECT_RNG_RANDOM);
1452
    DO_TEST_PARSE_ERROR("virtio-rng-egd-crash",
1453
            QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_EGD);
1454
    DO_TEST("virtio-rng-ccw",
1455
            QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG,
1456
            QEMU_CAPS_BOOTINDEX, QEMU_CAPS_VIRTIO_CCW,
1457 1458
            QEMU_CAPS_VIRTIO_S390, QEMU_CAPS_DEVICE_VIRTIO_RNG,
            QEMU_CAPS_OBJECT_RNG_RANDOM);
1459

1460
    DO_TEST("s390-allow-bogus-usb-none",
1461
            QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG,
1462
            QEMU_CAPS_BOOTINDEX, QEMU_CAPS_VIRTIO_S390,
1463 1464
            QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM);

1465
    DO_TEST("s390-allow-bogus-usb-controller",
1466
            QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG,
1467
            QEMU_CAPS_BOOTINDEX, QEMU_CAPS_VIRTIO_S390,
1468 1469
            QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM);

O
Olivia Yin 已提交
1470
    DO_TEST("ppc-dtb", QEMU_CAPS_KVM, QEMU_CAPS_DTB);
1471
    DO_TEST("ppce500-serial", QEMU_CAPS_KVM, QEMU_CAPS_CHARDEV);
O
Olivia Yin 已提交
1472

1473
    DO_TEST("tpm-passthrough",
1474
            QEMU_CAPS_DEVICE_TPM_PASSTHROUGH, QEMU_CAPS_DEVICE_TPM_TIS);
1475
    DO_TEST_PARSE_ERROR("tpm-no-backend-invalid",
1476
                        QEMU_CAPS_DEVICE_TPM_PASSTHROUGH, QEMU_CAPS_DEVICE_TPM_TIS);
1477

1478

1479 1480 1481 1482
    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);
1483

1484 1485
    DO_TEST("pci-autoadd-addr", QEMU_CAPS_DEVICE_PCI_BRIDGE);
    DO_TEST("pci-autoadd-idx", QEMU_CAPS_DEVICE_PCI_BRIDGE);
1486
    DO_TEST("pci-many",
1487
            QEMU_CAPS_DEVICE_PCI_BRIDGE);
1488
    DO_TEST("pci-bridge-many-disks",
1489
            QEMU_CAPS_DEVICE_PCI_BRIDGE);
L
Laine Stump 已提交
1490
    DO_TEST("pcie-root",
1491
            QEMU_CAPS_ICH9_AHCI,
1492
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
1493 1494
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE);
    DO_TEST("q35",
1495
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
1496
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
1497
            QEMU_CAPS_ICH9_AHCI,
1498
            QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_ICH9_USB_EHCI1,
1499 1500
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
            QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL);
1501
    DO_TEST("q35-pm-disable",
1502
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
1503 1504 1505 1506
            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",
1507
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
1508 1509
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, QEMU_CAPS_ICH9_AHCI,
            QEMU_CAPS_PIIX_DISABLE_S3, QEMU_CAPS_PIIX_DISABLE_S4);
1510
    DO_TEST("q35-usb2",
1511
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
1512 1513 1514 1515 1516 1517
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
            QEMU_CAPS_ICH9_AHCI,
            QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_ICH9_USB_EHCI1,
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
            QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL);
    DO_TEST("q35-usb2-multi",
1518
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
1519 1520 1521 1522 1523 1524
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
            QEMU_CAPS_ICH9_AHCI,
            QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_ICH9_USB_EHCI1,
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
            QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL);
    DO_TEST("q35-usb2-reorder",
1525
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
1526 1527 1528 1529 1530
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
            QEMU_CAPS_ICH9_AHCI,
            QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_ICH9_USB_EHCI1,
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
            QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL);
1531
    DO_TEST("pcie-root-port",
1532
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
1533 1534
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_IOH3420,
1535
            QEMU_CAPS_ICH9_AHCI,
1536 1537
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
            QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL);
1538

1539
    DO_TEST_FAILURE("pcie-root-port-too-many",
1540
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
1541 1542
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_IOH3420,
1543
            QEMU_CAPS_ICH9_AHCI,
1544 1545
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
            QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL);
1546

1547
    DO_TEST("pcie-switch-upstream-port",
1548
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
1549 1550 1551
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_IOH3420,
            QEMU_CAPS_DEVICE_X3130_UPSTREAM,
1552
            QEMU_CAPS_ICH9_AHCI,
1553 1554
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
            QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL);
1555
    DO_TEST("pcie-switch-downstream-port",
1556
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
1557 1558 1559 1560
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_IOH3420,
            QEMU_CAPS_DEVICE_X3130_UPSTREAM,
            QEMU_CAPS_DEVICE_XIO3130_DOWNSTREAM,
1561
            QEMU_CAPS_ICH9_AHCI,
1562 1563
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
            QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL);
1564

1565 1566 1567 1568 1569 1570 1571 1572 1573 1574
    DO_TEST("pci-expander-bus",
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_PXB);
    DO_TEST_PARSE_ERROR("pci-expander-bus-bad-node",
                        QEMU_CAPS_DEVICE_PCI_BRIDGE,
                        QEMU_CAPS_DEVICE_PXB);
    DO_TEST_PARSE_ERROR("pci-expander-bus-bad-machine",
                        QEMU_CAPS_DEVICE_PCI_BRIDGE,
                        QEMU_CAPS_DEVICE_PXB);

1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589
    DO_TEST("pcie-expander-bus",
            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_DEVICE_PXB_PCIE);
    DO_TEST_PARSE_ERROR("pcie-expander-bus-bad-machine",
                        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_DEVICE_PXB_PCIE);

1590
    DO_TEST("hostdev-scsi-lsi",
1591 1592
            QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI,
            QEMU_CAPS_DEVICE_SCSI_GENERIC);
1593
    DO_TEST("hostdev-scsi-virtio-scsi",
1594 1595
            QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_DEVICE_SCSI_GENERIC);
1596
    DO_TEST("hostdev-scsi-readonly",
O
Osier Yang 已提交
1597 1598
            QEMU_CAPS_DRIVE_READONLY, QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE_SCSI_GENERIC);
1599
    DO_TEST("hostdev-scsi-virtio-scsi",
1600 1601 1602
            QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_DEVICE_SCSI_GENERIC,
            QEMU_CAPS_DEVICE_SCSI_GENERIC_BOOTINDEX);
1603
    DO_TEST("hostdev-scsi-lsi-iscsi",
J
John Ferlan 已提交
1604 1605
            QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI,
            QEMU_CAPS_DEVICE_SCSI_GENERIC);
1606
    DO_TEST("hostdev-scsi-lsi-iscsi-auth",
J
John Ferlan 已提交
1607 1608
            QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI,
            QEMU_CAPS_DEVICE_SCSI_GENERIC);
1609
    DO_TEST("hostdev-scsi-virtio-iscsi",
J
John Ferlan 已提交
1610 1611
            QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_DEVICE_SCSI_GENERIC);
1612
    DO_TEST("hostdev-scsi-virtio-iscsi-auth",
J
John Ferlan 已提交
1613 1614
            QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_DEVICE_SCSI_GENERIC);
1615

1616 1617 1618 1619 1620
    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);

1621
    DO_TEST_PARSE_ERROR("pci-bridge-negative-index-invalid",
1622
                        QEMU_CAPS_DEVICE_PCI_BRIDGE);
J
Ján Tomko 已提交
1623
    DO_TEST_PARSE_ERROR("pci-bridge-duplicate-index",
1624
                        QEMU_CAPS_DEVICE_PCI_BRIDGE);
J
Ján Tomko 已提交
1625
    DO_TEST_PARSE_ERROR("pci-root-nonzero-index",
1626
                        QEMU_CAPS_DEVICE_PCI_BRIDGE);
J
Ján Tomko 已提交
1627
    DO_TEST_PARSE_ERROR("pci-root-address",
1628
                        QEMU_CAPS_DEVICE_PCI_BRIDGE);
1629

1630
    DO_TEST("hotplug-base",
1631
            QEMU_CAPS_KVM, QEMU_CAPS_VIRTIO_SCSI);
1632

1633 1634
    DO_TEST("pcihole64", QEMU_CAPS_I440FX_PCI_HOLE64_SIZE);
    DO_TEST_FAILURE("pcihole64-none", NONE);
1635
    DO_TEST("pcihole64-q35",
1636
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
1637
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
1638
            QEMU_CAPS_ICH9_AHCI,
1639
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
1640 1641 1642
            QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL,
            QEMU_CAPS_Q35_PCI_HOLE64_SIZE);

1643
    DO_TEST("arm-vexpressa9-nodevs",
1644
            QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DTB);
1645
    DO_TEST("arm-vexpressa9-basic",
1646
            QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DTB);
1647
    DO_TEST("arm-vexpressa9-virtio",
1648
            QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DTB,
1649
            QEMU_CAPS_DEVICE_VIRTIO_MMIO,
1650
            QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM);
1651
    DO_TEST("arm-virt-virtio",
1652
            QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DTB,
1653
            QEMU_CAPS_DEVICE_VIRTIO_MMIO,
1654
            QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM);
1655

1656
    DO_TEST("aarch64-virt-virtio",
1657
            QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DTB,
1658
            QEMU_CAPS_DEVICE_VIRTIO_MMIO,
1659
            QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM);
1660 1661 1662 1663 1664 1665

    /* 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",
1666
            QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DTB,
1667 1668 1669 1670 1671 1672
            QEMU_CAPS_DEVICE_VIRTIO_MMIO,
            QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM,
            QEMU_CAPS_OBJECT_GPEX, QEMU_CAPS_DEVICE_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE);
    DO_TEST("aarch64-virt-2.6-virtio-pci-default",
            QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DTB,
1673
            QEMU_CAPS_DEVICE_VIRTIO_MMIO,
1674 1675 1676
            QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM,
            QEMU_CAPS_OBJECT_GPEX, QEMU_CAPS_DEVICE_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE);
1677 1678 1679
    /* Example of using virtio-pci with no explicit PCI controller
       but with manual PCI addresses */
    DO_TEST("aarch64-virtio-pci-manual-addresses",
1680
            QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DTB,
1681
            QEMU_CAPS_DEVICE_VIRTIO_MMIO,
1682 1683 1684
            QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM,
            QEMU_CAPS_OBJECT_GPEX, QEMU_CAPS_DEVICE_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, QEMU_CAPS_VIRTIO_SCSI);
1685
    DO_TEST("aarch64-aavmf-virtio-mmio",
1686
            QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DTB,
1687
            QEMU_CAPS_DEVICE_VIRTIO_MMIO,
1688
            QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM);
1689
    DO_TEST("aarch64-virt-default-nic",
1690
            QEMU_CAPS_NODEFCONFIG,
1691
            QEMU_CAPS_DEVICE_VIRTIO_MMIO);
1692
    DO_TEST("aarch64-cpu-passthrough",
1693 1694
            QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DEVICE_VIRTIO_MMIO,
            QEMU_CAPS_CPU_HOST, QEMU_CAPS_KVM);
1695 1696 1697 1698 1699 1700 1701 1702 1703 1704
    DO_TEST("aarch64-gic-none",
            QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_CPU_HOST,
            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
    DO_TEST("aarch64-gic-none",
            QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_CPU_HOST);
    DO_TEST("aarch64-gic-default",
            QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_CPU_HOST,
            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
    DO_TEST("aarch64-gic-default",
            QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_CPU_HOST);
1705 1706
    DO_TEST("aarch64-gic-v2",
            QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_CPU_HOST,
1707
            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
1708 1709
    DO_TEST("aarch64-gic-v2",
            QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_CPU_HOST);
1710 1711 1712 1713 1714
    DO_TEST("aarch64-gic-v3",
            QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_CPU_HOST,
            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
    DO_TEST_FAILURE("aarch64-gic-v3",
            QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_CPU_HOST);
1715
    DO_TEST("aarch64-gic-host",
1716 1717
            QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_CPU_HOST,
            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
1718
    DO_TEST_FAILURE("aarch64-gic-host",
1719
            QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_CPU_HOST);
1720
    DO_TEST_PARSE_ERROR("aarch64-gic-invalid",
1721 1722
            QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_CPU_HOST,
            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
1723
    DO_TEST_FAILURE("aarch64-gic-not-virt",
1724 1725
            QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_CPU_HOST,
            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
1726
    DO_TEST_FAILURE("aarch64-gic-not-arm",
1727 1728
            QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_CPU_HOST,
            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
1729

1730
    driver.caps->host.cpu->arch = VIR_ARCH_AARCH64;
1731
    DO_TEST("aarch64-kvm-32-on-64",
1732 1733
            QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DEVICE_VIRTIO_MMIO,
            QEMU_CAPS_KVM, QEMU_CAPS_CPU_HOST, QEMU_CAPS_CPU_AARCH64_OFF);
1734
    DO_TEST_FAILURE("aarch64-kvm-32-on-64",
1735 1736 1737 1738
            QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DEVICE_VIRTIO_MMIO,
            QEMU_CAPS_KVM, QEMU_CAPS_CPU_HOST);
    driver.caps->host.cpu->arch = cpuDefault->arch;

1739 1740 1741 1742 1743
    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 已提交
1744
    DO_TEST("panic", QEMU_CAPS_DEVICE_PANIC,
1745
            QEMU_CAPS_NODEFCONFIG);
D
Dmitry Andreev 已提交
1746
    DO_TEST("panic-double", QEMU_CAPS_DEVICE_PANIC,
1747
            QEMU_CAPS_NODEFCONFIG);
H
Hu Tao 已提交
1748

1749
    DO_TEST("panic-no-address", QEMU_CAPS_DEVICE_PANIC,
1750
            QEMU_CAPS_NODEFCONFIG);
1751

1752 1753
    DO_TEST("fips-enabled", QEMU_CAPS_ENABLE_FIPS);

1754
    DO_TEST("shmem", QEMU_CAPS_PCIDEVICE,
1755
            QEMU_CAPS_DEVICE_IVSHMEM);
1756
    DO_TEST_FAILURE("shmem", NONE);
1757
    DO_TEST_FAILURE("shmem-invalid-size", QEMU_CAPS_PCIDEVICE,
1758
                    QEMU_CAPS_DEVICE_IVSHMEM);
1759
    DO_TEST_FAILURE("shmem-invalid-address", QEMU_CAPS_PCIDEVICE,
1760
                    QEMU_CAPS_DEVICE_IVSHMEM);
1761
    DO_TEST_FAILURE("shmem-small-size", QEMU_CAPS_PCIDEVICE,
1762
                    QEMU_CAPS_DEVICE_IVSHMEM);
1763
    DO_TEST_PARSE_ERROR("shmem-msi-only", NONE);
1764
    DO_TEST("cpu-host-passthrough-features", QEMU_CAPS_KVM, QEMU_CAPS_CPU_HOST);
1765

1766
    DO_TEST_FAILURE("memory-align-fail", NONE);
1767 1768 1769
    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);
1770
    DO_TEST("memory-hotplug-dimm", QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_NUMA,
1771
            QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_OBJECT_MEMORY_FILE);
1772
    DO_TEST("memory-hotplug-dimm-addr", QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_NUMA,
1773
            QEMU_CAPS_OBJECT_MEMORY_FILE);
1774
    DO_TEST("memory-hotplug-ppc64-nonuma", QEMU_CAPS_KVM, QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_NUMA,
1775
            QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_OBJECT_MEMORY_FILE);
1776

1777 1778
    DO_TEST("machine-aeskeywrap-on-caps",
            QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_AES_KEY_WRAP,
1779
            QEMU_CAPS_DEA_KEY_WRAP,
1780
            QEMU_CAPS_VIRTIO_SCSI,
1781 1782
            QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
    DO_TEST_FAILURE("machine-aeskeywrap-on-caps", QEMU_CAPS_MACHINE_OPT,
1783
                    QEMU_CAPS_VIRTIO_SCSI,
1784 1785 1786 1787 1788
                    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,
1789
            QEMU_CAPS_VIRTIO_SCSI,
1790 1791
            QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
    DO_TEST_FAILURE("machine-aeskeywrap-on-cap", QEMU_CAPS_MACHINE_OPT,
1792
                    QEMU_CAPS_VIRTIO_SCSI,
1793 1794 1795 1796 1797
                    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,
1798
            QEMU_CAPS_VIRTIO_SCSI,
1799 1800
            QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
    DO_TEST_FAILURE("machine-aeskeywrap-off-caps", QEMU_CAPS_MACHINE_OPT,
1801
                    QEMU_CAPS_VIRTIO_SCSI,
1802 1803 1804 1805
                    QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
    DO_TEST_FAILURE("machine-aeskeywrap-off-caps", NONE);

    DO_TEST("machine-aeskeywrap-off-cap",
1806
            QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_AES_KEY_WRAP,
1807
            QEMU_CAPS_VIRTIO_SCSI,
1808 1809
            QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
    DO_TEST_FAILURE("machine-aeskeywrap-off-cap", QEMU_CAPS_MACHINE_OPT,
1810
                    QEMU_CAPS_VIRTIO_SCSI,
1811 1812 1813 1814 1815
                    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,
1816
            QEMU_CAPS_VIRTIO_SCSI,
1817
            QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
1818
    DO_TEST_FAILURE("machine-deakeywrap-on-caps", QEMU_CAPS_MACHINE_OPT,
1819
                    QEMU_CAPS_VIRTIO_SCSI,
1820 1821 1822 1823
                    QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
    DO_TEST_FAILURE("machine-deakeywrap-on-caps", NONE);

    DO_TEST("machine-deakeywrap-on-cap",
1824
            QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_DEA_KEY_WRAP,
1825
            QEMU_CAPS_VIRTIO_SCSI,
1826 1827
            QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
    DO_TEST_FAILURE("machine-deakeywrap-on-cap", QEMU_CAPS_MACHINE_OPT,
1828
                    QEMU_CAPS_VIRTIO_SCSI,
1829 1830 1831 1832 1833
                    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,
1834
            QEMU_CAPS_VIRTIO_SCSI,
1835 1836
            QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
    DO_TEST_FAILURE("machine-deakeywrap-off-caps", QEMU_CAPS_MACHINE_OPT,
1837
                    QEMU_CAPS_VIRTIO_SCSI,
1838 1839 1840 1841
                    QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
    DO_TEST_FAILURE("machine-deakeywrap-off-caps", NONE);

    DO_TEST("machine-deakeywrap-off-cap",
1842
            QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_DEA_KEY_WRAP,
1843
            QEMU_CAPS_VIRTIO_SCSI,
1844 1845
            QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
    DO_TEST_FAILURE("machine-deakeywrap-off-cap", QEMU_CAPS_MACHINE_OPT,
1846
                    QEMU_CAPS_VIRTIO_SCSI,
1847 1848 1849 1850 1851
                    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,
1852
            QEMU_CAPS_VIRTIO_SCSI,
1853 1854
            QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
    DO_TEST("machine-keywrap-none",
1855
            QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_VIRTIO_SCSI,
1856
            QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
1857

J
Jiri Denemark 已提交
1858 1859 1860 1861 1862 1863 1864
    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);

1865
    DO_TEST("virtio-input", QEMU_CAPS_VIRTIO_KEYBOARD,
1866
            QEMU_CAPS_VIRTIO_MOUSE, QEMU_CAPS_VIRTIO_TABLET);
1867
    DO_TEST("virtio-input-passthrough", QEMU_CAPS_VIRTIO_INPUT_HOST);
1868

1869
    DO_TEST("ppc64-usb-controller",
1870
            QEMU_CAPS_PCI_OHCI);
1871
    DO_TEST("ppc64-usb-controller-legacy",
1872
            QEMU_CAPS_PIIX3_USB_UHCI);
1873

1874 1875 1876 1877
    DO_TEST_PARSE_FLAGS_ERROR("missing-machine",
                              VIR_DOMAIN_DEF_PARSE_SKIP_OSTYPE_CHECKS,
                              NONE);

M
Marc-André Lureau 已提交
1878 1879
    DO_TEST("debug-threads", QEMU_CAPS_NAME_DEBUG_THREADS);

1880 1881
    DO_TEST("master-key", QEMU_CAPS_OBJECT_SECRET);

1882
    qemuTestDriverFree(&driver);
1883

1884
    return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
1885 1886
}

1887
VIRT_TEST_MAIN_PRELOAD(mymain, abs_builddir "/.libs/qemuxml2argvmock.so")
1888

1889 1890
#else

1891 1892 1893 1894
int main(void)
{
    return EXIT_AM_SKIP;
}
1895 1896

#endif /* WITH_QEMU */