qemuxml2argvtest.c 118.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
# define __QEMU_CAPSPRIV_H_ALLOW__
31
# include "qemu/qemu_capspriv.h"
32
# undef __QEMU_CAPSPRIV_H_ALLOW__
33

34
# include "testutilsqemu.h"
35

36 37
# define VIR_FROM_THIS VIR_FROM_QEMU

38
static const char *abs_top_srcdir;
39
static virQEMUDriver driver;
40

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

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

73 74 75
    if (virUUIDGenerate(uuid) < 0)
        return NULL;

76
    return virGetSecret(conn, uuid, usageType, usageID);
77 78
}

79 80 81 82 83 84 85
static virSecretPtr
fakeSecretLookupByUUID(virConnectPtr conn,
                       const unsigned char *uuid)
{
    return virGetSecret(conn, uuid, 0, "");
}

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

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

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

125
 cleanup:
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161
    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);

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

166
 fallback:
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217
    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;

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

225
 cleanup:
226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242
    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
243
 * qemu command line.
244 245 246
 *
 * There are a few "magic" values to pass to these functions:
 *
247 248
 * 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
249 250 251
 * 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
252
 * pattern VOLUME_TYPE+VOLUME_PATH can be used to simulate a volume in a pool.
253 254 255 256 257 258 259 260 261 262 263 264
 * 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,
};

265
typedef enum {
266 267 268 269
    FLAG_EXPECT_FAILURE     = 1 << 0,
    FLAG_EXPECT_PARSE_ERROR = 1 << 1,
    FLAG_JSON               = 1 << 2,
    FLAG_FIPS               = 1 << 3,
270 271
} virQemuXML2ArgvTestFlags;

272 273 274 275 276 277 278
struct testInfo {
    const char *name;
    virQEMUCapsPtr qemuCaps;
    const char *migrateFrom;
    int migrateFd;
    unsigned int flags;
    unsigned int parseFlags;
279
    bool skipLegacyCPUs;
280
    virDomainObjPtr vm;
281 282
};

283 284 285 286

static int
testAddCPUModels(virQEMUCapsPtr caps, bool skipLegacy)
{
287 288
    virArch arch = virQEMUCapsGetArch(caps);
    const char *x86Models[] = {
289 290 291 292
        "Opteron_G3", "Opteron_G2", "Opteron_G1",
        "Nehalem", "Penryn", "Conroe",
        "Haswell-noTSX", "Haswell",
    };
293
    const char *x86LegacyModels[] = {
294 295 296 297
        "n270", "athlon", "pentium3", "pentium2", "pentium",
        "486", "coreduo", "kvm32", "qemu32", "kvm64",
        "core2duo", "phenom", "qemu64",
    };
298 299 300 301 302 303
    const char *armModels[] = {
        "cortex-a9", "cortex-a8", "cortex-a57", "cortex-a53",
    };
    const char *ppc64Models[] = {
        "POWER8", "POWER7",
    };
304 305 306
    const char *s390xModels[] = {
        "z990", "zEC12", "z13",
    };
307

308
    if (ARCH_IS_X86(arch)) {
309
        if (virQEMUCapsAddCPUDefinitions(caps, VIR_DOMAIN_VIRT_KVM, x86Models,
310 311
                                         ARRAY_CARDINALITY(x86Models),
                                         VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0 ||
312
            virQEMUCapsAddCPUDefinitions(caps, VIR_DOMAIN_VIRT_QEMU, x86Models,
313 314
                                         ARRAY_CARDINALITY(x86Models),
                                         VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0)
315 316
            return -1;

317 318 319
        if (!skipLegacy) {
            if (virQEMUCapsAddCPUDefinitions(caps, VIR_DOMAIN_VIRT_KVM,
                                             x86LegacyModels,
320 321
                                             ARRAY_CARDINALITY(x86LegacyModels),
                                             VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0 ||
322 323
                virQEMUCapsAddCPUDefinitions(caps, VIR_DOMAIN_VIRT_QEMU,
                                             x86LegacyModels,
324 325
                                             ARRAY_CARDINALITY(x86LegacyModels),
                                             VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0)
326 327
                return -1;
        }
328
    } else if (ARCH_IS_ARM(arch)) {
329
        if (virQEMUCapsAddCPUDefinitions(caps, VIR_DOMAIN_VIRT_KVM, armModels,
330 331
                                         ARRAY_CARDINALITY(armModels),
                                         VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0 ||
332
            virQEMUCapsAddCPUDefinitions(caps, VIR_DOMAIN_VIRT_QEMU, armModels,
333 334
                                         ARRAY_CARDINALITY(armModels),
                                         VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0)
335 336
            return -1;
    } else if (ARCH_IS_PPC64(arch)) {
337
        if (virQEMUCapsAddCPUDefinitions(caps, VIR_DOMAIN_VIRT_KVM, ppc64Models,
338 339
                                         ARRAY_CARDINALITY(ppc64Models),
                                         VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0 ||
340
            virQEMUCapsAddCPUDefinitions(caps, VIR_DOMAIN_VIRT_QEMU, ppc64Models,
341 342
                                         ARRAY_CARDINALITY(ppc64Models),
                                         VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0)
343
            return -1;
344 345 346 347 348
    } else if (ARCH_IS_S390(arch)) {
        if (virQEMUCapsAddCPUDefinitions(caps, VIR_DOMAIN_VIRT_KVM, s390xModels,
                                         ARRAY_CARDINALITY(s390xModels),
                                         VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0)
            return -1;
349
    }
350 351 352 353 354 355

    return 0;
}


static int
356 357
testInitQEMUCaps(struct testInfo *info,
                 int gic)
358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373
{
    int ret = -1;

    if (!(info->qemuCaps = virQEMUCapsNew()))
        goto cleanup;

    if (testQemuCapsSetGIC(info->qemuCaps, gic) < 0)
        goto cleanup;

    ret = 0;

 cleanup:
    return ret;
}


374 375
static int
testUpdateQEMUCaps(const struct testInfo *info,
376 377
                   virDomainObjPtr vm,
                   virCapsPtr caps)
378 379 380
{
    int ret = -1;

381 382 383
    if (!caps)
        goto cleanup;

384 385
    virQEMUCapsSetArch(info->qemuCaps, vm->def->os.arch);

386 387
    virQEMUCapsInitQMPBasicArch(info->qemuCaps);

388 389 390
    if (testAddCPUModels(info->qemuCaps, info->skipLegacyCPUs) < 0)
        goto cleanup;

391 392 393 394
    virQEMUCapsInitHostCPUModel(info->qemuCaps, caps->host.arch,
                                VIR_DOMAIN_VIRT_KVM);
    virQEMUCapsInitHostCPUModel(info->qemuCaps, caps->host.arch,
                                VIR_DOMAIN_VIRT_QEMU);
395

396 397 398 399 400 401 402 403 404
    virQEMUCapsFilterByMachineType(info->qemuCaps, vm->def->os.machine);

    ret = 0;

 cleanup:
    return ret;
}


405
static int
406
testCompareXMLToStartupXML(const void *data)
407
{
408
    const struct testInfo *info = data;
409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438
    unsigned int format_flags = VIR_DOMAIN_DEF_FORMAT_SECURE;
    char *xml = NULL;
    char *actual = NULL;
    int ret = -1;

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

    if (!virFileExists(xml)) {
        ret = EXIT_AM_SKIP;
        goto cleanup;
    }

    if (!(actual = virDomainDefFormat(info->vm->def, NULL, format_flags)))
        goto cleanup;

    ret = virTestCompareToFile(actual, xml);

 cleanup:
    VIR_FREE(xml);
    VIR_FREE(actual);
    return ret;
}


static int
testCompareXMLToArgv(const void *data)
{
    struct testInfo *info = (void *) data;
439 440 441
    char *xml = NULL;
    char *args = NULL;
    char *migrateURI = NULL;
442
    char *actualargv = NULL;
443 444
    unsigned int flags = info->flags;
    unsigned int parseFlags = info->parseFlags;
E
Eric Blake 已提交
445
    int ret = -1;
446
    virDomainObjPtr vm = NULL;
447
    virDomainChrSourceDef monitor_chr;
448
    virConnectPtr conn;
J
Jiri Denemark 已提交
449
    char *log = NULL;
E
Eric Blake 已提交
450
    virCommandPtr cmd = NULL;
451
    size_t i;
452
    qemuDomainObjPrivatePtr priv = NULL;
453

454 455
    memset(&monitor_chr, 0, sizeof(monitor_chr));

456
    if (!(conn = virGetConnect()))
457
        goto cleanup;
458

459
    conn->secretDriver = &fakeSecretDriver;
460
    conn->storageDriver = &fakeStorageDriver;
461

462 463 464
    virSetConnectSecret(conn);
    virSetConnectStorage(conn);

465 466 467 468 469 470
    if (virQEMUCapsGet(info->qemuCaps, QEMU_CAPS_MONITOR_JSON))
        flags |= FLAG_JSON;

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

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

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

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

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

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

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

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

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

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

514
    if (testUpdateQEMUCaps(info, vm, driver.caps) < 0)
515
        goto cleanup;
516

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

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

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

531
    if (!(cmd = qemuProcessCreatePretendCmd(&driver, vm, migrateURI,
P
Pavel Hrdina 已提交
532 533
                                            (flags & FLAG_FIPS), false,
                                            VIR_QEMU_PROCESS_START_COLD))) {
P
Pavel Hrdina 已提交
534 535
        if (flags & FLAG_EXPECT_FAILURE)
            goto ok;
536
        goto cleanup;
J
Jiri Denemark 已提交
537
    }
538 539 540 541
    if (flags & FLAG_EXPECT_FAILURE) {
        VIR_TEST_DEBUG("passed instead of expected failure");
        goto cleanup;
    }
J
Jiri Denemark 已提交
542

E
Eric Blake 已提交
543
    if (!(actualargv = virCommandToString(cmd)))
544
        goto cleanup;
E
Eric Blake 已提交
545

546
    if (virTestCompareToFile(actualargv, args) < 0)
547
        goto cleanup;
548

P
Pavel Hrdina 已提交
549 550
    ret = 0;

551
 ok:
552
    if (ret == 0 && flags & FLAG_EXPECT_FAILURE) {
P
Pavel Hrdina 已提交
553 554
        ret = -1;
        VIR_TEST_DEBUG("Error expected but there wasn't any.\n");
555
        goto cleanup;
P
Pavel Hrdina 已提交
556
    }
557
    if (!virTestOOMActive()) {
558
        if (flags & FLAG_EXPECT_FAILURE) {
559
            if ((log = virTestLogContentAndReset()))
P
Pavel Hrdina 已提交
560 561
                VIR_TEST_DEBUG("Got expected error: \n%s", log);
        }
562
        virResetLastError();
P
Pavel Hrdina 已提交
563
        ret = 0;
564 565
    }

566 567 568
    if (!(flags & FLAG_EXPECT_FAILURE) && ret == 0)
        VIR_STEAL_PTR(info->vm, vm);

569
 cleanup:
570 571
    VIR_FREE(log);
    VIR_FREE(actualargv);
572
    virDomainChrSourceDefClear(&monitor_chr);
E
Eric Blake 已提交
573
    virCommandFree(cmd);
574
    virObjectUnref(vm);
575 576
    virSetConnectSecret(NULL);
    virSetConnectStorage(NULL);
577
    virObjectUnref(conn);
578
    VIR_FREE(migrateURI);
579 580
    VIR_FREE(xml);
    VIR_FREE(args);
581
    return ret;
582 583
}

A
Andrea Bolognani 已提交
584
# define FAKEROOTDIRTEMPLATE abs_builddir "/fakerootdir-XXXXXX"
585

586
static int
E
Eric Blake 已提交
587
mymain(void)
588 589
{
    int ret = 0;
A
Andrea Bolognani 已提交
590
    char *fakerootdir;
591
    bool skipLegacyCPUs = false;
592

A
Andrea Bolognani 已提交
593 594 595 596 597 598 599 600 601 602 603 604
    if (VIR_STRDUP_QUIET(fakerootdir, FAKEROOTDIRTEMPLATE) < 0) {
        fprintf(stderr, "Out of memory\n");
        abort();
    }

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

    setenv("LIBVIRT_FAKE_ROOT_DIR", fakerootdir, 1);

605 606
    abs_top_srcdir = getenv("abs_top_srcdir");
    if (!abs_top_srcdir)
607
        abs_top_srcdir = abs_srcdir "/..";
608

609 610 611 612 613 614 615 616 617 618
    /* 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;
    }

619
    if (qemuTestDriverInit(&driver) < 0)
620
        return EXIT_FAILURE;
621 622

    driver.privileged = true;
623

624 625 626
    VIR_FREE(driver.config->defaultTLSx509certdir);
    if (VIR_STRDUP_QUIET(driver.config->defaultTLSx509certdir, "/etc/pki/qemu") < 0)
        return EXIT_FAILURE;
627
    VIR_FREE(driver.config->vncTLSx509certdir);
628
    if (VIR_STRDUP_QUIET(driver.config->vncTLSx509certdir, "/etc/pki/libvirt-vnc") < 0)
629 630
        return EXIT_FAILURE;
    VIR_FREE(driver.config->spiceTLSx509certdir);
631
    if (VIR_STRDUP_QUIET(driver.config->spiceTLSx509certdir, "/etc/pki/libvirt-spice") < 0)
632
        return EXIT_FAILURE;
633 634 635
    VIR_FREE(driver.config->chardevTLSx509certdir);
    if (VIR_STRDUP_QUIET(driver.config->chardevTLSx509certdir, "/etc/pki/libvirt-chardev") < 0)
        return EXIT_FAILURE;
636 637 638
    VIR_FREE(driver.config->vxhsTLSx509certdir);
    if (VIR_STRDUP_QUIET(driver.config->vxhsTLSx509certdir, "/etc/pki/libvirt-vxhs") < 0)
        return EXIT_FAILURE;
639

640
    VIR_FREE(driver.config->hugetlbfs);
641
    if (VIR_ALLOC_N(driver.config->hugetlbfs, 2) < 0)
642
        return EXIT_FAILURE;
643 644 645
    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)
646
        return EXIT_FAILURE;
647 648
    driver.config->hugetlbfs[0].size = 2048;
    driver.config->hugetlbfs[0].deflt = true;
649
    driver.config->hugetlbfs[1].size = 1048576;
650
    driver.config->spiceTLS = 1;
651
    if (VIR_STRDUP_QUIET(driver.config->spicePassword, "123456") < 0)
652
        return EXIT_FAILURE;
653 654 655
    VIR_FREE(driver.config->memoryBackingDir);
    if (VIR_STRDUP_QUIET(driver.config->memoryBackingDir, "/var/lib/libvirt/qemu/ram") < 0)
        return EXIT_FAILURE;
656

657 658 659 660 661
# define DO_TEST_FULL(name, migrateFrom, migrateFd, flags, \
                      parseFlags, gic, ...) \
    do { \
        static struct testInfo info = { \
            name, NULL, migrateFrom, migrateFd, (flags), parseFlags, \
662
            false, NULL \
663 664 665 666 667 668 669 670
        }; \
        info.skipLegacyCPUs = skipLegacyCPUs; \
        if (testInitQEMUCaps(&info, gic) < 0) \
            return EXIT_FAILURE; \
        virQEMUCapsSetList(info.qemuCaps, __VA_ARGS__, QEMU_CAPS_LAST); \
        if (virTestRun("QEMU XML-2-ARGV " name, \
                       testCompareXMLToArgv, &info) < 0) \
            ret = -1; \
671 672 673
        if (info.vm && virTestRun("QEMU XML-2-startup-XML " name, \
                                  testCompareXMLToStartupXML, &info) < 0) \
            ret = -1; \
674
        virObjectUnref(info.qemuCaps); \
675
        virObjectUnref(info.vm); \
676 677
    } while (0)

678
# define DO_TEST(name, ...) \
679
    DO_TEST_FULL(name, NULL, -1, 0, 0, GIC_NONE, __VA_ARGS__)
680

681
# define DO_TEST_GIC(name, gic, ...) \
682 683
    DO_TEST_FULL(name, NULL, -1, 0, 0, gic, __VA_ARGS__)

684 685
# define DO_TEST_FAILURE(name, ...) \
    DO_TEST_FULL(name, NULL, -1, FLAG_EXPECT_FAILURE, \
686
                 0, GIC_NONE, __VA_ARGS__)
687

688 689 690
# define DO_TEST_PARSE_ERROR(name, ...) \
    DO_TEST_FULL(name, NULL, -1, \
                 FLAG_EXPECT_PARSE_ERROR | FLAG_EXPECT_FAILURE, \
691
                 0, GIC_NONE, __VA_ARGS__)
692

693 694 695
# define DO_TEST_PARSE_FLAGS_ERROR(name, parseFlags, ...) \
    DO_TEST_FULL(name, NULL, -1, \
                 FLAG_EXPECT_PARSE_ERROR | FLAG_EXPECT_FAILURE, \
696
                 parseFlags, GIC_NONE, __VA_ARGS__)
697

698
# define DO_TEST_LINUX(name, ...) \
699
    DO_TEST_LINUX_FULL(name, NULL, -1, 0, 0, GIC_NONE, __VA_ARGS__)
700

701 702 703 704 705 706
# 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. */
707
#  define DO_TEST_LINUX_FULL(name, ...) \
708
    DO_TEST_FULL(name, __VA_ARGS__)
709
# else  /* __linux__ */
710 711 712
#  define DO_TEST_LINUX_FULL(name, ...) \
    do { \
        const char *tmp ATTRIBUTE_UNUSED = name; \
713 714 715
    } while (0)
# endif /* __linux__ */

716
# define NONE QEMU_CAPS_LAST
717

718 719 720
    /* 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 */
721 722 723 724 725 726 727
    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");
728 729
    unsetenv("QEMU_AUDIO_DRV");
    unsetenv("SDL_AUDIODRIVER");
730

731
    DO_TEST("minimal", NONE);
732
    DO_TEST_PARSE_ERROR("minimal-no-memory", NONE);
733
    DO_TEST("minimal-msg-timestamp", QEMU_CAPS_MSG_TIMESTAMP);
734
    DO_TEST("machine-aliases1", NONE);
735
    DO_TEST("machine-aliases2", QEMU_CAPS_KVM);
736 737
    DO_TEST("machine-core-on", QEMU_CAPS_MACHINE_OPT,
            QEMU_CAPS_DUMP_GUEST_CORE);
738
    driver.config->dumpGuestCore = true;
739 740
    DO_TEST("machine-core-off", QEMU_CAPS_MACHINE_OPT,
            QEMU_CAPS_DUMP_GUEST_CORE);
741 742 743
    driver.config->dumpGuestCore = false;
    DO_TEST("machine-core-cfg-off", QEMU_CAPS_MACHINE_OPT,
            QEMU_CAPS_DUMP_GUEST_CORE);
744
    DO_TEST_FAILURE("machine-core-on", NONE);
745
    DO_TEST_FAILURE("machine-core-on", QEMU_CAPS_MACHINE_OPT);
M
Michal Privoznik 已提交
746 747 748
    DO_TEST("machine-smm-opt",
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
749
            QEMU_CAPS_DEVICE_IOH3420,
M
Michal Privoznik 已提交
750 751 752 753
            QEMU_CAPS_ICH9_AHCI,
            QEMU_CAPS_MACHINE_OPT,
            QEMU_CAPS_MACHINE_SMM_OPT,
            QEMU_CAPS_VIRTIO_SCSI);
L
Li Zhang 已提交
754 755
    DO_TEST("machine-usb-opt", QEMU_CAPS_MACHINE_OPT,
            QEMU_CAPS_MACHINE_USB_OPT);
756 757
    DO_TEST("machine-vmport-opt", QEMU_CAPS_MACHINE_OPT,
            QEMU_CAPS_MACHINE_VMPORT_OPT);
758
    DO_TEST("kvm", QEMU_CAPS_MACHINE_OPT);
759 760
    DO_TEST("default-kvm-host-arch", QEMU_CAPS_MACHINE_OPT);
    DO_TEST("default-qemu-host-arch", QEMU_CAPS_MACHINE_OPT);
761
    DO_TEST("x86-kvm-32-on-64", QEMU_CAPS_MACHINE_OPT);
762 763 764
    DO_TEST("boot-cdrom", NONE);
    DO_TEST("boot-network", NONE);
    DO_TEST("boot-floppy", NONE);
765
    DO_TEST("boot-floppy-q35",
766
            QEMU_CAPS_DEVICE_IOH3420,
767
            QEMU_CAPS_ICH9_AHCI);
768
    DO_TEST("bootindex-floppy-q35",
769
            QEMU_CAPS_DEVICE_IOH3420,
770
            QEMU_CAPS_ICH9_AHCI, QEMU_CAPS_BOOT_MENU,
771
            QEMU_CAPS_BOOTINDEX);
772 773
    DO_TEST("boot-multi", QEMU_CAPS_BOOT_MENU);
    DO_TEST("boot-menu-enable",
774
            QEMU_CAPS_BOOT_MENU);
775
    DO_TEST("boot-menu-enable-bootindex",
776
            QEMU_CAPS_BOOT_MENU,
777
            QEMU_CAPS_BOOTINDEX);
778
    DO_TEST("boot-menu-enable-with-timeout",
779
            QEMU_CAPS_BOOT_MENU,
780
            QEMU_CAPS_SPLASH_TIMEOUT);
781
    DO_TEST_FAILURE("boot-menu-enable-with-timeout", QEMU_CAPS_BOOT_MENU);
782
    DO_TEST_PARSE_ERROR("boot-menu-enable-with-timeout-invalid", NONE);
783 784
    DO_TEST("boot-menu-disable", QEMU_CAPS_BOOT_MENU);
    DO_TEST("boot-menu-disable-drive",
785
            QEMU_CAPS_BOOT_MENU);
786
    DO_TEST("boot-menu-disable-drive-bootindex",
787
            QEMU_CAPS_BOOT_MENU,
788
            QEMU_CAPS_BOOTINDEX);
789
    DO_TEST_PARSE_ERROR("boot-dev+order",
790
            QEMU_CAPS_BOOTINDEX,
791
            QEMU_CAPS_VIRTIO_BLK_SCSI);
792
    DO_TEST("boot-order",
793
            QEMU_CAPS_BOOTINDEX,
794
            QEMU_CAPS_VIRTIO_BLK_SCSI);
795
    DO_TEST("boot-complex",
796
            QEMU_CAPS_DRIVE_BOOT,
797
            QEMU_CAPS_VIRTIO_BLK_SCSI);
798
    DO_TEST("boot-complex-bootindex",
799
            QEMU_CAPS_DRIVE_BOOT,
800
            QEMU_CAPS_BOOTINDEX,
801
            QEMU_CAPS_VIRTIO_BLK_SCSI);
802
    DO_TEST("boot-strict",
803
            QEMU_CAPS_DRIVE_BOOT,
804
            QEMU_CAPS_BOOTINDEX, QEMU_CAPS_BOOT_STRICT,
805
            QEMU_CAPS_VIRTIO_BLK_SCSI);
806 807 808 809 810

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

811
    DO_TEST("bios",
812
            QEMU_CAPS_DEVICE_ISA_SERIAL,
813
            QEMU_CAPS_SGA);
J
Ján Tomko 已提交
814
    DO_TEST("bios-nvram", NONE);
M
Michal Privoznik 已提交
815 816 817
    DO_TEST("bios-nvram-secure",
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
818
            QEMU_CAPS_DEVICE_IOH3420,
M
Michal Privoznik 已提交
819 820 821 822
            QEMU_CAPS_ICH9_AHCI,
            QEMU_CAPS_MACHINE_OPT,
            QEMU_CAPS_MACHINE_SMM_OPT,
            QEMU_CAPS_VIRTIO_SCSI);
823 824 825 826 827 828 829

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

830
    DO_TEST("clock-utc", QEMU_CAPS_NODEFCONFIG);
831
    DO_TEST("clock-localtime", NONE);
832
    DO_TEST("clock-localtime-basis-localtime", QEMU_CAPS_RTC);
833 834
    DO_TEST("clock-variable", QEMU_CAPS_RTC);
    DO_TEST("clock-france", QEMU_CAPS_RTC);
835 836
    DO_TEST("clock-hpet-off", QEMU_CAPS_RTC);
    DO_TEST("clock-catchup", QEMU_CAPS_RTC);
837
    DO_TEST("cpu-kvmclock", QEMU_CAPS_ENABLE_KVM);
A
Andrea Bolognani 已提交
838
    DO_TEST("cpu-host-kvmclock", QEMU_CAPS_ENABLE_KVM);
839
    DO_TEST("kvmclock", QEMU_CAPS_KVM);
840
    DO_TEST("clock-timer-hyperv-rtc", QEMU_CAPS_KVM);
841

842 843
    DO_TEST("cpu-eoi-disabled", QEMU_CAPS_ENABLE_KVM);
    DO_TEST("cpu-eoi-enabled", QEMU_CAPS_ENABLE_KVM);
J
Ján Tomko 已提交
844
    DO_TEST("controller-order",
845 846 847 848 849 850 851 852 853 854 855
            QEMU_CAPS_KVM,
            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_SPICEVMC,
            QEMU_CAPS_SPICE,
            QEMU_CAPS_HDA_DUPLEX,
            QEMU_CAPS_USB_HUB,
856
            QEMU_CAPS_DEVICE_ISA_SERIAL,
857
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
858 859
    DO_TEST("eoi-disabled", NONE);
    DO_TEST("eoi-enabled", NONE);
860 861
    DO_TEST("pv-spinlock-disabled", NONE);
    DO_TEST("pv-spinlock-enabled", NONE);
M
Martin Kletzander 已提交
862
    DO_TEST("kvmclock+eoi-disabled", QEMU_CAPS_ENABLE_KVM);
863

864
    DO_TEST("hyperv", NONE);
865
    DO_TEST("hyperv-off", NONE);
866
    DO_TEST("hyperv-panic", NONE);
867

868 869 870
    DO_TEST("kvm-features", NONE);
    DO_TEST("kvm-features-off", NONE);

871 872 873
    DO_TEST("pmu-feature", NONE);
    DO_TEST("pmu-feature-off", NONE);

874
    DO_TEST("hugepages", QEMU_CAPS_MEM_PATH);
875
    DO_TEST("hugepages-numa", QEMU_CAPS_RTC,
876
            QEMU_CAPS_PIIX_DISABLE_S3, QEMU_CAPS_PIIX_DISABLE_S4,
877
            QEMU_CAPS_VIRTIO_SCSI,
878 879
            QEMU_CAPS_ICH9_USB_EHCI1, QEMU_CAPS_PCI_MULTIFUNCTION,
            QEMU_CAPS_SPICE, QEMU_CAPS_CHARDEV_SPICEVMC,
880
            QEMU_CAPS_DEVICE_QXL,
881
            QEMU_CAPS_HDA_DUPLEX, QEMU_CAPS_USB_REDIR,
882
            QEMU_CAPS_DEVICE_PC_DIMM,
883
            QEMU_CAPS_MEM_PATH, QEMU_CAPS_OBJECT_MEMORY_FILE);
884 885 886
    DO_TEST_LINUX("hugepages-pages", QEMU_CAPS_MEM_PATH,
                  QEMU_CAPS_OBJECT_MEMORY_RAM,
                  QEMU_CAPS_OBJECT_MEMORY_FILE);
887 888 889 890
    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);
891 892 893
    DO_TEST_LINUX("hugepages-shared", QEMU_CAPS_MEM_PATH,
                  QEMU_CAPS_OBJECT_MEMORY_RAM,
                  QEMU_CAPS_OBJECT_MEMORY_FILE);
894
    DO_TEST_PARSE_ERROR("hugepages-memaccess-invalid", NONE);
895 896
    DO_TEST_FAILURE("hugepages-pages4", QEMU_CAPS_MEM_PATH,
            QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_OBJECT_MEMORY_FILE);
897
    DO_TEST("hugepages-pages5", QEMU_CAPS_MEM_PATH);
898
    DO_TEST("hugepages-pages6", NONE);
899 900
    DO_TEST("hugepages-pages7", QEMU_CAPS_MEM_PATH,
            QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_OBJECT_MEMORY_FILE);
901 902 903
    DO_TEST("hugepages-memaccess", QEMU_CAPS_OBJECT_MEMORY_FILE,
            QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_DEVICE_PC_DIMM,
            QEMU_CAPS_NUMA);
904 905 906
    DO_TEST("hugepages-memaccess2", QEMU_CAPS_OBJECT_MEMORY_FILE,
            QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_DEVICE_PC_DIMM,
            QEMU_CAPS_NUMA);
907 908 909
    DO_TEST_FAILURE("hugepages-memaccess3", QEMU_CAPS_MEM_PATH,
            QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_OBJECT_MEMORY_FILE,
            QEMU_CAPS_VIRTIO_SCSI);
910
    DO_TEST("nosharepages", QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_MEM_MERGE);
911
    DO_TEST("disk-cdrom", NONE);
912
    DO_TEST("disk-iscsi", NONE);
913 914 915 916 917
    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);
918
    DO_TEST("disk-cdrom-empty", NONE);
919
    DO_TEST("disk-cdrom-tray",
920
            QEMU_CAPS_VIRTIO_TX_ALG);
921 922
    DO_TEST("disk-cdrom-tray-no-device-cap", NONE);
    DO_TEST("disk-floppy", NONE);
923 924
    DO_TEST_FAILURE("disk-floppy-pseries",
                    QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE);
925
    DO_TEST("disk-floppy-tray-no-device-cap", NONE);
926
    DO_TEST("disk-floppy-tray", NONE);
927
    DO_TEST("disk-virtio-s390",
928
            QEMU_CAPS_VIRTIO_S390);
929
    DO_TEST("disk-many", NONE);
930 931
    DO_TEST("disk-virtio", QEMU_CAPS_DRIVE_BOOT);
    DO_TEST("disk-virtio-ccw",
932
            QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
933
    DO_TEST("disk-virtio-ccw-many",
934
            QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
935
    DO_TEST("disk-virtio-scsi-ccw", QEMU_CAPS_VIRTIO_SCSI,
936
            QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
937
    DO_TEST("disk-order",
938
            QEMU_CAPS_DRIVE_BOOT, QEMU_CAPS_VIRTIO_BLK_SCSI);
L
Lin Ma 已提交
939 940
    DO_TEST("disk-virtio-drive-queues",
            QEMU_CAPS_VIRTIO_BLK_NUM_QUEUES);
941
    DO_TEST("disk-drive-boot-disk",
942
            QEMU_CAPS_DRIVE_BOOT);
943
    DO_TEST("disk-drive-boot-cdrom",
944
            QEMU_CAPS_DRIVE_BOOT);
945
    DO_TEST("floppy-drive-fat",
946
            QEMU_CAPS_DRIVE_BOOT);
947
    DO_TEST("disk-drive-readonly-disk",
948
            QEMU_CAPS_NODEFCONFIG);
949
    DO_TEST("disk-drive-readonly-no-device",
J
Ján Tomko 已提交
950
            QEMU_CAPS_NODEFCONFIG);
951
    DO_TEST("disk-drive-fmt-qcow",
952
            QEMU_CAPS_DRIVE_BOOT);
953
    DO_TEST_PARSE_ERROR("disk-drive-fmt-cow", QEMU_CAPS_DRIVE_BOOT);
954
    DO_TEST_PARSE_ERROR("disk-drive-fmt-dir", QEMU_CAPS_DRIVE_BOOT);
955
    DO_TEST_PARSE_ERROR("disk-drive-fmt-iso", QEMU_CAPS_DRIVE_BOOT);
956
    DO_TEST("disk-drive-shared",
957
            QEMU_CAPS_DRIVE_SERIAL);
958
    DO_TEST_PARSE_ERROR("disk-drive-shared-qcow", NONE);
959 960
    DO_TEST("disk-drive-shared-locking",
            QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DISK_SHARE_RW);
961
    DO_TEST("disk-drive-error-policy-stop",
962
            QEMU_CAPS_MONITOR_JSON);
963
    DO_TEST("disk-drive-error-policy-enospace",
964
            QEMU_CAPS_MONITOR_JSON);
965
    DO_TEST("disk-drive-error-policy-wreport-rignore",
966 967 968 969
            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);
970
    DO_TEST("disk-drive-cache-directsync",
971
            QEMU_CAPS_DRIVE_CACHE_DIRECTSYNC);
972
    DO_TEST("disk-drive-cache-unsafe",
973
            QEMU_CAPS_DRIVE_CACHE_UNSAFE);
974
    DO_TEST("disk-drive-copy-on-read",
975 976 977 978 979 980 981 982
            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);
983 984
    DO_TEST_PARSE_ERROR("disk-drive-network-iscsi-auth-secrettype-invalid", NONE);
    DO_TEST_PARSE_ERROR("disk-drive-network-iscsi-auth-wrong-secrettype", NONE);
985
    DO_TEST_PARSE_ERROR("disk-drive-network-source-auth-both", NONE);
986 987
    DO_TEST("disk-drive-network-iscsi-lun",
            QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_VIRTIO_SCSI,
988
            QEMU_CAPS_SCSI_BLOCK);
989 990
    DO_TEST("disk-drive-network-gluster",
            QEMU_CAPS_GLUSTER_DEBUG_LEVEL);
991 992 993
    DO_TEST("disk-drive-network-rbd", NONE);
    DO_TEST("disk-drive-network-sheepdog", NONE);
    DO_TEST("disk-drive-network-rbd-auth", NONE);
994
    DO_TEST("disk-drive-network-source-auth", NONE);
995
# ifdef HAVE_GNUTLS_CIPHER_ENCRYPT
996
    DO_TEST("disk-drive-network-rbd-auth-AES",
997
            QEMU_CAPS_OBJECT_SECRET, QEMU_CAPS_VIRTIO_SCSI);
998
# endif
999 1000
    DO_TEST("disk-drive-network-rbd-ipv6", NONE);
    DO_TEST_FAILURE("disk-drive-network-rbd-no-colon", NONE);
1001
    DO_TEST("disk-drive-network-vxhs", QEMU_CAPS_VXHS);
1002 1003 1004 1005 1006
    driver.config->vxhsTLS = 1;
    DO_TEST("disk-drive-network-tlsx509-vxhs", QEMU_CAPS_VXHS,
            QEMU_CAPS_OBJECT_TLS_CREDS_X509);
    driver.config->vxhsTLS = 0;
    VIR_FREE(driver.config->vxhsTLSx509certdir);
1007
    DO_TEST("disk-drive-no-boot",
1008
            QEMU_CAPS_BOOTINDEX);
1009
    DO_TEST_PARSE_ERROR("disk-device-lun-type-invalid",
1010 1011
                        QEMU_CAPS_VIRTIO_SCSI);
    DO_TEST_FAILURE("disk-usb-nosupport", NONE);
1012
    DO_TEST("disk-usb-device",
1013
            QEMU_CAPS_DEVICE_USB_STORAGE,
1014
            QEMU_CAPS_NODEFCONFIG);
1015
    DO_TEST("disk-usb-device-removable",
1016
            QEMU_CAPS_DEVICE_USB_STORAGE,
1017
            QEMU_CAPS_USB_STORAGE_REMOVABLE, QEMU_CAPS_NODEFCONFIG);
1018 1019
    DO_TEST_FAILURE("disk-usb-pci",
                    QEMU_CAPS_DEVICE_USB_STORAGE, QEMU_CAPS_NODEFCONFIG);
1020
    DO_TEST("disk-scsi-device",
1021
            QEMU_CAPS_NODEFCONFIG,
1022
            QEMU_CAPS_SCSI_LSI);
1023
    DO_TEST("disk-scsi-device-auto",
1024
            QEMU_CAPS_NODEFCONFIG,
1025
            QEMU_CAPS_SCSI_LSI);
1026
    DO_TEST("disk-scsi-disk-split",
1027
            QEMU_CAPS_NODEFCONFIG,
1028
            QEMU_CAPS_SCSI_CD, QEMU_CAPS_SCSI_LSI, QEMU_CAPS_VIRTIO_SCSI);
1029
    DO_TEST("disk-scsi-disk-wwn",
1030
            QEMU_CAPS_NODEFCONFIG,
1031
            QEMU_CAPS_SCSI_CD, QEMU_CAPS_SCSI_LSI, QEMU_CAPS_VIRTIO_SCSI,
1032 1033
            QEMU_CAPS_SCSI_DISK_WWN);
    DO_TEST("disk-scsi-disk-vpd",
1034
            QEMU_CAPS_NODEFCONFIG,
1035
            QEMU_CAPS_SCSI_CD, QEMU_CAPS_SCSI_LSI, QEMU_CAPS_VIRTIO_SCSI,
1036 1037
            QEMU_CAPS_SCSI_DISK_WWN);
    DO_TEST_FAILURE("disk-scsi-disk-vpd-build-error",
1038
            QEMU_CAPS_NODEFCONFIG,
1039
            QEMU_CAPS_SCSI_CD, QEMU_CAPS_SCSI_LSI, QEMU_CAPS_VIRTIO_SCSI,
1040
            QEMU_CAPS_SCSI_DISK_WWN);
1041
    DO_TEST("disk-scsi-vscsi",
1042
            QEMU_CAPS_NODEFCONFIG);
1043
    DO_TEST("disk-scsi-virtio-scsi",
1044
            QEMU_CAPS_NODEFCONFIG,
1045
            QEMU_CAPS_VIRTIO_SCSI);
1046
    DO_TEST("disk-virtio-scsi-num_queues",
1047
            QEMU_CAPS_NODEFCONFIG,
1048
            QEMU_CAPS_VIRTIO_SCSI);
1049
    DO_TEST("disk-virtio-scsi-cmd_per_lun",
1050
            QEMU_CAPS_NODEFCONFIG,
1051 1052
            QEMU_CAPS_VIRTIO_SCSI);
    DO_TEST("disk-virtio-scsi-max_sectors",
1053
            QEMU_CAPS_NODEFCONFIG,
1054
            QEMU_CAPS_VIRTIO_SCSI);
1055
    DO_TEST("disk-virtio-scsi-ioeventfd",
1056
            QEMU_CAPS_NODEFCONFIG,
1057
            QEMU_CAPS_VIRTIO_IOEVENTFD, QEMU_CAPS_VIRTIO_SCSI);
1058
    DO_TEST("disk-scsi-megasas",
1059
            QEMU_CAPS_NODEFCONFIG,
1060
            QEMU_CAPS_SCSI_MEGASAS);
1061 1062 1063 1064
    DO_TEST("disk-scsi-mptsas1068",
            QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_SCSI_MPTSAS1068,
            QEMU_CAPS_SCSI_DISK_WWN);
1065
    DO_TEST("disk-sata-device",
J
Jim Fehlig 已提交
1066
            QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_ICH9_AHCI);
1067
    DO_TEST("disk-aio",
1068
            QEMU_CAPS_DRIVE_AIO);
1069
    DO_TEST("disk-source-pool",
1070
            QEMU_CAPS_NODEFCONFIG);
1071
    DO_TEST("disk-source-pool-mode",
1072
            QEMU_CAPS_NODEFCONFIG);
1073
    DO_TEST("disk-ioeventfd",
1074
            QEMU_CAPS_VIRTIO_IOEVENTFD,
1075
            QEMU_CAPS_VIRTIO_TX_ALG,
1076
            QEMU_CAPS_VIRTIO_BLK_SCSI);
1077
    DO_TEST("disk-copy_on_read",
1078
            QEMU_CAPS_DRIVE_COPY_ON_READ,
1079
            QEMU_CAPS_VIRTIO_TX_ALG,
1080
            QEMU_CAPS_VIRTIO_BLK_SCSI);
O
Osier Yang 已提交
1081
    DO_TEST("disk-drive-discard",
1082
            QEMU_CAPS_DRIVE_DISCARD);
1083 1084 1085
    DO_TEST("disk-drive-detect-zeroes",
            QEMU_CAPS_DRIVE_DISCARD,
            QEMU_CAPS_DRIVE_DETECT_ZEROES);
1086
    DO_TEST("disk-snapshot", NONE);
1087 1088 1089
    DO_TEST_PARSE_ERROR("disk-same-targets",
                        QEMU_CAPS_SCSI_LSI,
                        QEMU_CAPS_DEVICE_USB_STORAGE, QEMU_CAPS_NODEFCONFIG);
1090 1091 1092 1093 1094 1095 1096 1097
    DO_TEST_PARSE_ERROR("disk-drive-address-conflict",
                        QEMU_CAPS_ICH9_AHCI);
    DO_TEST_PARSE_ERROR("disk-hostdev-scsi-address-conflict",
                        QEMU_CAPS_VIRTIO_SCSI,
                        QEMU_CAPS_DEVICE_SCSI_GENERIC);
    DO_TEST_PARSE_ERROR("hostdevs-drive-address-conflict",
                        QEMU_CAPS_VIRTIO_SCSI,
                        QEMU_CAPS_DEVICE_SCSI_GENERIC);
1098
    DO_TEST("event_idx",
1099 1100
            QEMU_CAPS_VIRTIO_BLK_EVENT_IDX,
            QEMU_CAPS_VIRTIO_NET_EVENT_IDX,
1101
            QEMU_CAPS_VIRTIO_BLK_SCSI);
1102
    DO_TEST("virtio-lun",
1103
            QEMU_CAPS_VIRTIO_BLK_SCSI);
1104
    DO_TEST("disk-scsi-lun-passthrough",
1105
            QEMU_CAPS_SCSI_BLOCK,
1106
            QEMU_CAPS_SCSI_LSI, QEMU_CAPS_VIRTIO_SCSI);
1107 1108 1109
    DO_TEST("disk-serial",
            QEMU_CAPS_KVM,
            QEMU_CAPS_DRIVE_SERIAL);
1110 1111 1112 1113 1114 1115 1116 1117
    DO_TEST_PARSE_ERROR("disk-fdc-incompatible-address",
                        NONE);
    DO_TEST_PARSE_ERROR("disk-ide-incompatible-address",
                        NONE);
    DO_TEST_PARSE_ERROR("disk-sata-incompatible-address",
                        QEMU_CAPS_ICH9_AHCI);
    DO_TEST_PARSE_ERROR("disk-scsi-incompatible-address",
                        QEMU_CAPS_VIRTIO_SCSI);
1118

1119 1120 1121 1122 1123 1124 1125 1126 1127 1128
    DO_TEST("graphics-vnc", QEMU_CAPS_VNC, QEMU_CAPS_DEVICE_CIRRUS_VGA);
    DO_TEST("graphics-vnc-socket", QEMU_CAPS_VNC, QEMU_CAPS_DEVICE_CIRRUS_VGA);
    DO_TEST("graphics-vnc-websocket", QEMU_CAPS_VNC, QEMU_CAPS_VNC_WEBSOCKET,
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
    DO_TEST("graphics-vnc-policy", QEMU_CAPS_VNC, QEMU_CAPS_VNC_SHARE_POLICY,
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
    DO_TEST("graphics-vnc-no-listen-attr", QEMU_CAPS_VNC,
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
    DO_TEST("graphics-vnc-remove-generated-socket", QEMU_CAPS_VNC,
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
1129
    driver.config->vncAutoUnixSocket = true;
1130 1131
    DO_TEST("graphics-vnc-auto-socket-cfg", QEMU_CAPS_VNC,
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
1132
    driver.config->vncAutoUnixSocket = false;
1133 1134 1135 1136
    DO_TEST("graphics-vnc-socket", QEMU_CAPS_VNC, QEMU_CAPS_DEVICE_CIRRUS_VGA);
    DO_TEST("graphics-vnc-auto-socket", QEMU_CAPS_VNC,
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
    DO_TEST("graphics-vnc-none", QEMU_CAPS_VNC, QEMU_CAPS_DEVICE_CIRRUS_VGA);
1137 1138
    DO_TEST("graphics-vnc-socket-new-cmdline", QEMU_CAPS_VNC,
            QEMU_CAPS_DEVICE_CIRRUS_VGA, QEMU_CAPS_VNC_MULTI_SERVERS);
1139

1140 1141
    driver.config->vncSASL = 1;
    VIR_FREE(driver.config->vncSASLdir);
1142
    ignore_value(VIR_STRDUP(driver.config->vncSASLdir, "/root/.sasl2"));
1143
    DO_TEST("graphics-vnc-sasl", QEMU_CAPS_VNC, QEMU_CAPS_DEVICE_CIRRUS_VGA);
1144 1145
    driver.config->vncTLS = 1;
    driver.config->vncTLSx509verify = 1;
1146
    DO_TEST("graphics-vnc-tls", QEMU_CAPS_VNC, QEMU_CAPS_DEVICE_CIRRUS_VGA);
1147
    driver.config->vncSASL = driver.config->vncTLSx509verify = driver.config->vncTLS = 0;
1148 1149
    VIR_FREE(driver.config->vncSASLdir);
    VIR_FREE(driver.config->vncTLSx509certdir);
1150

1151 1152 1153
    DO_TEST("graphics-sdl", QEMU_CAPS_SDL, QEMU_CAPS_DEVICE_VGA);
    DO_TEST("graphics-sdl-fullscreen", QEMU_CAPS_SDL,
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
1154
    DO_TEST("nographics", NONE);
P
Paolo Bonzini 已提交
1155 1156
    DO_TEST("nographics-display",
            QEMU_CAPS_DISPLAY);
1157
    DO_TEST("nographics-vga",
1158
            QEMU_CAPS_VGA_NONE);
1159
    DO_TEST("graphics-spice",
1160
            QEMU_CAPS_SPICE,
1161 1162
            QEMU_CAPS_DEVICE_QXL,
            QEMU_CAPS_SPICE_FILE_XFER_DISABLE);
1163
    DO_TEST("graphics-spice-no-args",
1164
            QEMU_CAPS_SPICE, QEMU_CAPS_DEVICE_CIRRUS_VGA);
1165 1166 1167
    driver.config->spiceSASL = 1;
    ignore_value(VIR_STRDUP(driver.config->spiceSASLdir, "/root/.sasl2"));
    DO_TEST("graphics-spice-sasl",
1168
            QEMU_CAPS_SPICE,
1169 1170 1171
            QEMU_CAPS_DEVICE_QXL);
    VIR_FREE(driver.config->spiceSASLdir);
    driver.config->spiceSASL = 0;
1172
    DO_TEST("graphics-spice-agentmouse",
1173
            QEMU_CAPS_DEVICE_QXL,
1174
            QEMU_CAPS_SPICE,
1175
            QEMU_CAPS_CHARDEV_SPICEVMC,
1176 1177
            QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
1178
    DO_TEST("graphics-spice-compression",
1179
            QEMU_CAPS_SPICE,
1180
            QEMU_CAPS_DEVICE_QXL);
1181
    DO_TEST("graphics-spice-timeout",
1182
            QEMU_CAPS_KVM,
1183
            QEMU_CAPS_SPICE,
1184 1185
            QEMU_CAPS_DEVICE_QXL,
            QEMU_CAPS_DEVICE_VGA);
1186
    DO_TEST("graphics-spice-qxl-vga",
1187
            QEMU_CAPS_SPICE,
1188
            QEMU_CAPS_DEVICE_QXL);
1189
    DO_TEST("graphics-spice-usb-redir",
1190
            QEMU_CAPS_SPICE,
1191 1192 1193 1194 1195 1196 1197
            QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_PCI_MULTIFUNCTION,
            QEMU_CAPS_USB_HUB,
            QEMU_CAPS_ICH9_USB_EHCI1,
            QEMU_CAPS_USB_REDIR,
            QEMU_CAPS_CHARDEV_SPICEVMC,
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
1198
    DO_TEST("graphics-spice-agent-file-xfer",
1199
            QEMU_CAPS_SPICE,
1200 1201
            QEMU_CAPS_DEVICE_QXL,
            QEMU_CAPS_SPICE_FILE_XFER_DISABLE);
1202 1203
    DO_TEST("graphics-spice-socket",
            QEMU_CAPS_SPICE,
1204 1205
            QEMU_CAPS_SPICE_UNIX,
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
1206 1207
    DO_TEST("graphics-spice-auto-socket",
            QEMU_CAPS_SPICE,
1208 1209
            QEMU_CAPS_SPICE_UNIX,
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
1210 1211 1212
    driver.config->spiceAutoUnixSocket = true;
    DO_TEST("graphics-spice-auto-socket-cfg",
            QEMU_CAPS_SPICE,
1213 1214
            QEMU_CAPS_SPICE_UNIX,
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
1215
    driver.config->spiceAutoUnixSocket = false;
1216

1217 1218 1219
    DO_TEST("input-usbmouse", NONE);
    DO_TEST("input-usbtablet", NONE);
    DO_TEST("misc-acpi", NONE);
1220 1221 1222
    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);
1223
    DO_TEST_FAILURE("misc-enable-s4", NONE);
1224
    DO_TEST("misc-no-reboot", NONE);
1225
    DO_TEST("misc-uuid", NONE);
1226
    DO_TEST_PARSE_ERROR("vhost_queues-invalid", NONE);
1227
    DO_TEST("net-vhostuser", QEMU_CAPS_NETDEV);
1228
    DO_TEST("net-vhostuser-multiq",
1229 1230
            QEMU_CAPS_NETDEV, QEMU_CAPS_VHOSTUSER_MULTIQUEUE);
    DO_TEST_FAILURE("net-vhostuser-multiq", QEMU_CAPS_NETDEV);
1231 1232 1233
    DO_TEST_FAILURE("net-vhostuser-fail",
                    QEMU_CAPS_NETDEV,
                    QEMU_CAPS_VHOSTUSER_MULTIQUEUE);
1234
    DO_TEST("net-user", NONE);
1235
    DO_TEST("net-user-addr", QEMU_CAPS_NETDEV);
1236 1237
    DO_TEST("net-virtio", NONE);
    DO_TEST("net-virtio-device",
1238
            QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_VIRTIO_TX_ALG);
1239
    DO_TEST("net-virtio-disable-offloads",
1240
            QEMU_CAPS_NODEFCONFIG);
1241
    DO_TEST("net-virtio-netdev",
1242
            QEMU_CAPS_NETDEV, QEMU_CAPS_NODEFCONFIG);
1243
    DO_TEST("net-virtio-s390",
1244
            QEMU_CAPS_VIRTIO_S390);
1245
    DO_TEST("net-virtio-ccw",
1246
            QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
1247 1248 1249
    DO_TEST("net-virtio-rxtxqueuesize",
            QEMU_CAPS_VIRTIO_NET_RX_QUEUE_SIZE,
            QEMU_CAPS_VIRTIO_NET_TX_QUEUE_SIZE);
1250
    DO_TEST_PARSE_ERROR("net-virtio-rxqueuesize-invalid-size", NONE);
1251 1252
    DO_TEST("net-eth", NONE);
    DO_TEST("net-eth-ifname", NONE);
1253
    DO_TEST("net-eth-names", NONE);
1254
    DO_TEST("net-eth-hostip", NONE);
1255 1256 1257
    DO_TEST("net-client", NONE);
    DO_TEST("net-server", NONE);
    DO_TEST("net-mcast", NONE);
1258
    DO_TEST("net-udp", NONE);
1259
    DO_TEST("net-hostdev",
J
Ján Tomko 已提交
1260
            QEMU_CAPS_NODEFCONFIG);
1261
    DO_TEST("net-hostdev-multidomain",
J
Ján Tomko 已提交
1262
            QEMU_CAPS_NODEFCONFIG,
1263 1264 1265
            QEMU_CAPS_HOST_PCI_MULTIDOMAIN);
    DO_TEST_FAILURE("net-hostdev-multidomain",
                    QEMU_CAPS_NODEFCONFIG);
1266
    DO_TEST("net-hostdev-vfio",
J
Ján Tomko 已提交
1267
            QEMU_CAPS_NODEFCONFIG,
1268
            QEMU_CAPS_DEVICE_VFIO_PCI);
1269
    DO_TEST("net-hostdev-vfio-multidomain",
J
Ján Tomko 已提交
1270
            QEMU_CAPS_NODEFCONFIG,
1271 1272 1273
            QEMU_CAPS_DEVICE_VFIO_PCI, QEMU_CAPS_HOST_PCI_MULTIDOMAIN);
    DO_TEST_FAILURE("net-hostdev-vfio-multidomain",
                    QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DEVICE_VFIO_PCI);
1274 1275 1276 1277
    DO_TEST_FAILURE("net-hostdev-fail",
                    QEMU_CAPS_NODEFCONFIG,
                    QEMU_CAPS_DEVICE_VFIO_PCI);

1278

1279 1280
    DO_TEST("serial-file-log",
            QEMU_CAPS_CHARDEV_FILE_APPEND,
1281
            QEMU_CAPS_DEVICE_ISA_SERIAL,
1282
            QEMU_CAPS_CHARDEV_LOGFILE);
1283
    DO_TEST("serial-spiceport",
1284 1285
            QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
1286
            QEMU_CAPS_DEVICE_QXL,
1287
            QEMU_CAPS_SPICE,
1288
            QEMU_CAPS_DEVICE_ISA_SERIAL,
1289
            QEMU_CAPS_CHARDEV_SPICEPORT);
1290
    DO_TEST("serial-spiceport-nospice", NONE);
1291

1292 1293 1294 1295
    DO_TEST("console-compat",
            QEMU_CAPS_DEVICE_ISA_SERIAL);
    DO_TEST("console-compat-auto",
            QEMU_CAPS_DEVICE_ISA_SERIAL);
1296 1297

    DO_TEST("serial-vc-chardev",
1298
            QEMU_CAPS_DEVICE_ISA_SERIAL,
1299
            QEMU_CAPS_NODEFCONFIG);
1300
    DO_TEST("serial-pty-chardev",
1301
            QEMU_CAPS_DEVICE_ISA_SERIAL,
1302
            QEMU_CAPS_NODEFCONFIG);
1303
    DO_TEST("serial-dev-chardev",
1304
            QEMU_CAPS_DEVICE_ISA_SERIAL,
1305
            QEMU_CAPS_NODEFCONFIG);
1306
    DO_TEST("serial-dev-chardev-iobase",
1307
            QEMU_CAPS_DEVICE_ISA_SERIAL,
1308
            QEMU_CAPS_NODEFCONFIG);
1309
    DO_TEST("serial-file-chardev",
1310
            QEMU_CAPS_NODEFCONFIG,
1311
            QEMU_CAPS_DEVICE_ISA_SERIAL,
1312
            QEMU_CAPS_CHARDEV_FILE_APPEND);
1313
    DO_TEST("serial-unix-chardev",
1314
            QEMU_CAPS_DEVICE_ISA_SERIAL,
1315
            QEMU_CAPS_NODEFCONFIG);
1316
    DO_TEST("serial-tcp-chardev",
1317
            QEMU_CAPS_DEVICE_ISA_SERIAL,
1318
            QEMU_CAPS_NODEFCONFIG);
1319
    DO_TEST("serial-udp-chardev",
1320
            QEMU_CAPS_DEVICE_ISA_SERIAL,
1321
            QEMU_CAPS_NODEFCONFIG);
1322
    DO_TEST("serial-tcp-telnet-chardev",
1323
            QEMU_CAPS_DEVICE_ISA_SERIAL,
1324
            QEMU_CAPS_NODEFCONFIG);
1325 1326
    driver.config->chardevTLS = 1;
    DO_TEST("serial-tcp-tlsx509-chardev",
1327
            QEMU_CAPS_NODEFCONFIG,
1328
            QEMU_CAPS_DEVICE_ISA_SERIAL,
1329
            QEMU_CAPS_OBJECT_TLS_CREDS_X509);
1330 1331
    driver.config->chardevTLSx509verify = 1;
    DO_TEST("serial-tcp-tlsx509-chardev-verify",
1332
            QEMU_CAPS_NODEFCONFIG,
1333
            QEMU_CAPS_DEVICE_ISA_SERIAL,
1334 1335
            QEMU_CAPS_OBJECT_TLS_CREDS_X509);
    driver.config->chardevTLSx509verify = 0;
1336
    DO_TEST("serial-tcp-tlsx509-chardev-notls",
1337
            QEMU_CAPS_NODEFCONFIG,
1338
            QEMU_CAPS_DEVICE_ISA_SERIAL,
1339
            QEMU_CAPS_OBJECT_TLS_CREDS_X509);
1340 1341 1342 1343 1344 1345 1346 1347
    VIR_FREE(driver.config->chardevTLSx509certdir);
    if (VIR_STRDUP_QUIET(driver.config->chardevTLSx509certdir, "/etc/pki/libvirt-chardev") < 0)
        return EXIT_FAILURE;
    if (VIR_STRDUP_QUIET(driver.config->chardevTLSx509secretUUID,
                         "6fd3f62d-9fe7-4a4e-a869-7acd6376d8ea") < 0)
        return EXIT_FAILURE;
# ifdef HAVE_GNUTLS_CIPHER_ENCRYPT
    DO_TEST("serial-tcp-tlsx509-secret-chardev",
1348
            QEMU_CAPS_NODEFCONFIG,
1349
            QEMU_CAPS_OBJECT_SECRET,
1350
            QEMU_CAPS_DEVICE_ISA_SERIAL,
1351 1352 1353
            QEMU_CAPS_OBJECT_TLS_CREDS_X509);
# else
    DO_TEST_FAILURE("serial-tcp-tlsx509-secret-chardev",
1354
                    QEMU_CAPS_NODEFCONFIG,
1355
                    QEMU_CAPS_OBJECT_SECRET,
1356
                    QEMU_CAPS_DEVICE_ISA_SERIAL,
1357 1358
                    QEMU_CAPS_OBJECT_TLS_CREDS_X509);
# endif
1359 1360
    driver.config->chardevTLS = 0;
    VIR_FREE(driver.config->chardevTLSx509certdir);
1361
    DO_TEST("serial-many-chardev",
1362
            QEMU_CAPS_DEVICE_ISA_SERIAL,
1363
            QEMU_CAPS_NODEFCONFIG);
1364
    DO_TEST("parallel-tcp-chardev",
1365
            QEMU_CAPS_NODEFCONFIG);
1366
    DO_TEST("parallel-parport-chardev",
1367
            QEMU_CAPS_NODEFCONFIG);
1368
    DO_TEST("console-compat-chardev",
1369
            QEMU_CAPS_DEVICE_ISA_SERIAL,
1370
            QEMU_CAPS_NODEFCONFIG);
M
Michal Privoznik 已提交
1371
    DO_TEST("pci-serial-dev-chardev",
1372
            QEMU_CAPS_NODEFCONFIG,
M
Michal Privoznik 已提交
1373
            QEMU_CAPS_DEVICE_PCI_SERIAL);
1374

1375
    DO_TEST("channel-guestfwd",
1376
            QEMU_CAPS_NODEFCONFIG);
1377
    DO_TEST("channel-virtio",
1378
            QEMU_CAPS_NODEFCONFIG);
1379
    DO_TEST("channel-virtio-state",
1380
            QEMU_CAPS_NODEFCONFIG);
1381
    DO_TEST("channel-virtio-auto",
1382
            QEMU_CAPS_NODEFCONFIG);
1383
    DO_TEST("channel-virtio-autoassign",
1384
            QEMU_CAPS_NODEFCONFIG);
J
Ján Tomko 已提交
1385
    DO_TEST("channel-virtio-autoadd",
1386
            QEMU_CAPS_NODEFCONFIG);
1387
    DO_TEST("console-virtio",
1388
            QEMU_CAPS_NODEFCONFIG);
1389
    DO_TEST("console-virtio-many",
1390
            QEMU_CAPS_DEVICE_ISA_SERIAL,
1391
            QEMU_CAPS_NODEFCONFIG);
1392
    DO_TEST("console-virtio-s390",
1393 1394 1395
            QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_BOOTINDEX,
            QEMU_CAPS_VIRTIO_S390);
1396
    DO_TEST("console-virtio-ccw",
1397 1398 1399
            QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_BOOTINDEX,
            QEMU_CAPS_VIRTIO_CCW,
1400
            QEMU_CAPS_VIRTIO_S390);
1401
    DO_TEST("console-sclp",
1402 1403
            QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_VIRTIO_S390,
1404
            QEMU_CAPS_DEVICE_SCLPCONSOLE);
1405
    DO_TEST("channel-spicevmc",
1406
            QEMU_CAPS_NODEFCONFIG,
1407 1408
            QEMU_CAPS_SPICE,
            QEMU_CAPS_CHARDEV_SPICEVMC,
1409
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
1410
    DO_TEST("channel-spicevmc-old",
1411
            QEMU_CAPS_NODEFCONFIG,
1412 1413
            QEMU_CAPS_SPICE,
            QEMU_CAPS_DEVICE_SPICEVMC,
1414
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
1415
    DO_TEST("channel-virtio-default",
1416 1417 1418
            QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_SPICE,
            QEMU_CAPS_CHARDEV_SPICEVMC);
1419
    DO_TEST("channel-virtio-unix",
1420
            QEMU_CAPS_NODEFCONFIG);
1421

1422
    DO_TEST("smartcard-host",
1423 1424
            QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_CCID_EMULATED);
1425
    DO_TEST("smartcard-host-certificates",
1426 1427
            QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_CCID_EMULATED);
1428
    DO_TEST("smartcard-passthrough-tcp",
1429 1430
            QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_CCID_PASSTHRU);
1431
    DO_TEST("smartcard-passthrough-spicevmc",
1432 1433 1434
            QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_CCID_PASSTHRU,
            QEMU_CAPS_CHARDEV_SPICEVMC);
1435
    DO_TEST("smartcard-controller",
1436 1437
            QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_CCID_EMULATED);
1438

1439 1440 1441 1442 1443 1444 1445 1446 1447 1448
    DO_TEST("chardev-reconnect",
            QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_CHARDEV_RECONNECT,
            QEMU_CAPS_USB_REDIR,
            QEMU_CAPS_DEVICE_VIRTIO_RNG,
            QEMU_CAPS_OBJECT_RNG_EGD,
            QEMU_CAPS_CCID_PASSTHRU);
    DO_TEST_PARSE_ERROR("chardev-reconnect-invalid-timeout",
                        QEMU_CAPS_NODEFCONFIG,
                        QEMU_CAPS_CHARDEV_RECONNECT);
1449 1450 1451
    DO_TEST_PARSE_ERROR("chardev-reconnect-generated-path",
                        QEMU_CAPS_NODEFCONFIG,
                        QEMU_CAPS_CHARDEV_RECONNECT);
1452

1453
    DO_TEST("usb-controller",
1454
            QEMU_CAPS_NODEFCONFIG);
1455
    DO_TEST("usb-piix3-controller",
1456 1457 1458
            QEMU_CAPS_PIIX3_USB_UHCI,
            QEMU_CAPS_PCI_MULTIFUNCTION,
            QEMU_CAPS_NODEFCONFIG);
1459
    DO_TEST("usb-ich9-ehci-addr",
1460 1461 1462
            QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_PCI_MULTIFUNCTION,
            QEMU_CAPS_ICH9_USB_EHCI1);
1463
    DO_TEST("input-usbmouse-addr",
1464
            QEMU_CAPS_NODEFCONFIG);
1465
    DO_TEST("usb-ich9-companion",
1466 1467 1468
            QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_PCI_MULTIFUNCTION,
            QEMU_CAPS_ICH9_USB_EHCI1);
1469
    DO_TEST_PARSE_ERROR("usb-ich9-no-companion",
1470 1471 1472
            QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_PCI_MULTIFUNCTION,
            QEMU_CAPS_ICH9_USB_EHCI1);
1473
    DO_TEST("usb-ich9-autoassign",
1474 1475 1476
            QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_PCI_MULTIFUNCTION,
            QEMU_CAPS_ICH9_USB_EHCI1,
1477
            QEMU_CAPS_USB_HUB);
1478
    DO_TEST("usb-hub",
1479
            QEMU_CAPS_USB_HUB,
M
Marc-André Lureau 已提交
1480
            QEMU_CAPS_NODEFCONFIG);
1481
    DO_TEST("usb-hub-autoadd",
1482
            QEMU_CAPS_USB_HUB,
1483
            QEMU_CAPS_NODEFCONFIG);
1484
    DO_TEST("usb-hub-autoadd-deluxe",
1485
            QEMU_CAPS_USB_HUB,
1486
            QEMU_CAPS_NODEFCONFIG);
J
Ján Tomko 已提交
1487
    DO_TEST_PARSE_ERROR("usb-hub-conflict",
1488
            QEMU_CAPS_USB_HUB,
J
Ján Tomko 已提交
1489
            QEMU_CAPS_NODEFCONFIG);
1490
    DO_TEST_PARSE_ERROR("usb-hub-nonexistent",
1491
            QEMU_CAPS_USB_HUB,
1492
            QEMU_CAPS_NODEFCONFIG);
J
Ján Tomko 已提交
1493
    DO_TEST("usb-port-missing",
1494
            QEMU_CAPS_USB_HUB,
J
Ján Tomko 已提交
1495
            QEMU_CAPS_NODEFCONFIG);
1496 1497 1498
    DO_TEST_FAILURE("usb-bus-missing",
                    QEMU_CAPS_USB_HUB,
                    QEMU_CAPS_NODEFCONFIG);
1499
    DO_TEST("usb-ports",
1500
            QEMU_CAPS_USB_HUB,
1501
            QEMU_CAPS_NODEFCONFIG);
1502
    DO_TEST_PARSE_ERROR("usb-ports-out-of-range",
1503
            QEMU_CAPS_USB_HUB,
1504
            QEMU_CAPS_NODEFCONFIG);
1505
    DO_TEST("usb-port-autoassign",
1506
            QEMU_CAPS_USB_HUB,
1507
            QEMU_CAPS_NODEFCONFIG);
1508
    DO_TEST("usb-redir",
1509 1510 1511 1512 1513 1514 1515
            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);
1516
    DO_TEST("usb-redir-boot",
1517 1518 1519 1520 1521 1522 1523 1524
            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,
1525
            QEMU_CAPS_USB_REDIR_BOOTINDEX);
1526
    DO_TEST("usb-redir-filter",
1527 1528 1529 1530 1531 1532 1533
            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,
1534
            QEMU_CAPS_USB_REDIR_FILTER);
1535
    DO_TEST("usb-redir-filter-version",
1536
            QEMU_CAPS_NODEFCONFIG,
1537
            QEMU_CAPS_USB_REDIR,
1538 1539
            QEMU_CAPS_SPICE,
            QEMU_CAPS_CHARDEV_SPICEVMC,
1540
            QEMU_CAPS_USB_REDIR_FILTER);
1541
    DO_TEST("usb1-usb2",
1542 1543 1544 1545 1546
            QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_PCI_MULTIFUNCTION,
            QEMU_CAPS_PIIX3_USB_UHCI,
            QEMU_CAPS_USB_HUB,
            QEMU_CAPS_ICH9_USB_EHCI1);
1547
    DO_TEST("usb-none",
1548
            QEMU_CAPS_NODEFCONFIG);
1549
    DO_TEST_PARSE_ERROR("usb-none-other",
1550
            QEMU_CAPS_NODEFCONFIG);
1551
    DO_TEST_PARSE_ERROR("usb-none-hub",
1552
            QEMU_CAPS_NODEFCONFIG,
1553 1554
            QEMU_CAPS_USB_HUB);
    DO_TEST_PARSE_ERROR("usb-none-usbtablet",
1555
            QEMU_CAPS_NODEFCONFIG);
1556
    DO_TEST("usb-controller-default-q35",
1557
            QEMU_CAPS_DEVICE_IOH3420,
1558 1559 1560
            QEMU_CAPS_PCI_OHCI,
            QEMU_CAPS_PIIX3_USB_UHCI,
            QEMU_CAPS_NEC_USB_XHCI);
1561
    DO_TEST_FAILURE("usb-controller-default-unavailable-q35",
1562
                    QEMU_CAPS_DEVICE_IOH3420,
1563
                    QEMU_CAPS_PCI_OHCI,
1564 1565
                    QEMU_CAPS_NEC_USB_XHCI);
    DO_TEST("usb-controller-explicit-q35",
1566
            QEMU_CAPS_DEVICE_IOH3420,
1567 1568 1569
            QEMU_CAPS_PCI_OHCI,
            QEMU_CAPS_PIIX3_USB_UHCI,
            QEMU_CAPS_NEC_USB_XHCI);
1570
    DO_TEST_FAILURE("usb-controller-explicit-unavailable-q35",
1571
                    QEMU_CAPS_DEVICE_IOH3420,
1572
                    QEMU_CAPS_PCI_OHCI,
1573
                    QEMU_CAPS_PIIX3_USB_UHCI);
1574
    DO_TEST("usb-controller-xhci",
1575 1576 1577 1578
            QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_PIIX3_USB_UHCI,
            QEMU_CAPS_NEC_USB_XHCI,
            QEMU_CAPS_NEC_USB_XHCI_PORTS);
1579
    DO_TEST("usb-xhci-autoassign",
1580 1581 1582 1583
            QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_PIIX3_USB_UHCI,
            QEMU_CAPS_NEC_USB_XHCI,
            QEMU_CAPS_NEC_USB_XHCI_PORTS,
1584
            QEMU_CAPS_USB_HUB);
1585
    DO_TEST_PARSE_ERROR("usb-controller-xhci-limit",
1586 1587 1588 1589
            QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_PIIX3_USB_UHCI,
            QEMU_CAPS_NEC_USB_XHCI,
            QEMU_CAPS_NEC_USB_XHCI_PORTS);
1590 1591 1592 1593
    DO_TEST("usb-controller-qemu-xhci", QEMU_CAPS_DEVICE_QEMU_XHCI);
    DO_TEST_FAILURE("usb-controller-qemu-xhci-unavailable", NONE);
    DO_TEST_PARSE_ERROR("usb-controller-qemu-xhci-limit",
                        QEMU_CAPS_DEVICE_QEMU_XHCI);
1594

1595
    DO_TEST("smbios", QEMU_CAPS_SMBIOS_TYPE);
1596
    DO_TEST_PARSE_ERROR("smbios-date", QEMU_CAPS_SMBIOS_TYPE);
1597
    DO_TEST_PARSE_ERROR("smbios-uuid-match", QEMU_CAPS_SMBIOS_TYPE);
1598

1599
    DO_TEST("watchdog", NONE);
1600
    DO_TEST("watchdog-device", QEMU_CAPS_NODEFCONFIG);
1601
    DO_TEST("watchdog-dump", NONE);
1602
    DO_TEST("watchdog-injectnmi", NONE);
1603
    DO_TEST("watchdog-diag288",
1604
            QEMU_CAPS_NODEFCONFIG,
1605
            QEMU_CAPS_BOOTINDEX, QEMU_CAPS_VIRTIO_S390);
1606 1607
    DO_TEST("balloon-device", QEMU_CAPS_NODEFCONFIG);
    DO_TEST("balloon-device-deflate", QEMU_CAPS_NODEFCONFIG,
1608
            QEMU_CAPS_VIRTIO_BALLOON_AUTODEFLATE);
1609
    DO_TEST("balloon-ccw-deflate", QEMU_CAPS_NODEFCONFIG,
1610
            QEMU_CAPS_VIRTIO_BALLOON_AUTODEFLATE);
1611
    DO_TEST("balloon-mmio-deflate", QEMU_CAPS_NODEFCONFIG,
1612 1613
            QEMU_CAPS_DTB, QEMU_CAPS_DEVICE_VIRTIO_MMIO,
            QEMU_CAPS_VIRTIO_BALLOON_AUTODEFLATE);
1614
    DO_TEST("balloon-device-deflate-off", QEMU_CAPS_NODEFCONFIG,
1615
            QEMU_CAPS_VIRTIO_BALLOON_AUTODEFLATE);
1616
    DO_TEST("balloon-device-auto",
1617 1618
            QEMU_CAPS_NODEFCONFIG);
    DO_TEST("balloon-device-period", QEMU_CAPS_NODEFCONFIG);
1619 1620
    DO_TEST("sound", NONE);
    DO_TEST("sound-device",
1621
            QEMU_CAPS_NODEFCONFIG,
1622
            QEMU_CAPS_HDA_DUPLEX, QEMU_CAPS_HDA_MICRO,
1623 1624
            QEMU_CAPS_DEVICE_ICH9_INTEL_HDA,
            QEMU_CAPS_OBJECT_USB_AUDIO);
1625
    DO_TEST("fs9p",
1626
            QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_FSDEV,
1627
            QEMU_CAPS_FSDEV_WRITEOUT);
1628
    DO_TEST("fs9p-ccw",
1629
            QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_FSDEV,
1630
            QEMU_CAPS_FSDEV_WRITEOUT,
1631
            QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
1632

1633 1634
    DO_TEST("hostdev-usb-address", NONE);
    DO_TEST("hostdev-usb-address-device",
1635 1636
            QEMU_CAPS_NODEFCONFIG);
    DO_TEST("hostdev-usb-address-device-boot",
1637 1638
            QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_BOOTINDEX,
            QEMU_CAPS_USB_HOST_BOOTINDEX);
J
Ján Tomko 已提交
1639
    DO_TEST("hostdev-pci-address", NONE);
1640
    DO_TEST("hostdev-pci-address-device",
J
Ján Tomko 已提交
1641
            QEMU_CAPS_NODEFCONFIG);
1642
    DO_TEST("hostdev-vfio",
J
Ján Tomko 已提交
1643
            QEMU_CAPS_NODEFCONFIG,
1644
            QEMU_CAPS_DEVICE_VFIO_PCI);
1645
    DO_TEST("hostdev-vfio-multidomain",
J
Ján Tomko 已提交
1646
            QEMU_CAPS_NODEFCONFIG,
1647
            QEMU_CAPS_DEVICE_VFIO_PCI, QEMU_CAPS_HOST_PCI_MULTIDOMAIN);
1648 1649 1650 1651 1652 1653 1654 1655 1656
    DO_TEST("hostdev-mdev-precreated",
            QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_DEVICE_VFIO_PCI);
    DO_TEST_PARSE_ERROR("hostdev-mdev-src-address-invalid",
            QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_DEVICE_VFIO_PCI);
    DO_TEST_PARSE_ERROR("hostdev-mdev-invalid-target-address",
            QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_DEVICE_VFIO_PCI);
1657 1658
    DO_TEST_FAILURE("hostdev-vfio-multidomain",
                    QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DEVICE_VFIO_PCI);
1659
    DO_TEST("pci-rom",
J
Ján Tomko 已提交
1660
            QEMU_CAPS_NODEFCONFIG);
1661

1662 1663 1664 1665
    DO_TEST_FULL("restore-v2", "exec:cat", 7, 0, 0, GIC_NONE, NONE);
    DO_TEST_FULL("restore-v2-fd", "stdio", 7, 0, 0, GIC_NONE, NONE);
    DO_TEST_FULL("restore-v2-fd", "fd:7", 7, 0, 0, GIC_NONE, NONE);
    DO_TEST_FULL("migrate", "tcp:10.0.0.1:5000", -1, 0, 0, GIC_NONE, NONE);
1666

1667
    DO_TEST_LINUX_FULL("migrate-numa-unaligned", "stdio", 7, 0, 0, GIC_NONE,
1668
                       QEMU_CAPS_NUMA,
1669 1670
                       QEMU_CAPS_OBJECT_MEMORY_RAM);

1671
    DO_TEST("qemu-ns", NONE);
1672
    DO_TEST("qemu-ns-no-env", NONE);
1673
    DO_TEST("qemu-ns-alt", NONE);
1674

1675
    DO_TEST("smp", NONE);
1676

J
John Ferlan 已提交
1677
    DO_TEST("iothreads", QEMU_CAPS_OBJECT_IOTHREAD);
1678 1679
    DO_TEST("iothreads-ids", QEMU_CAPS_OBJECT_IOTHREAD);
    DO_TEST("iothreads-ids-partial", QEMU_CAPS_OBJECT_IOTHREAD);
1680
    DO_TEST_FAILURE("iothreads-nocap", NONE);
1681 1682
    DO_TEST("iothreads-disk", QEMU_CAPS_OBJECT_IOTHREAD);
    DO_TEST("iothreads-disk-virtio-ccw", QEMU_CAPS_OBJECT_IOTHREAD,
1683
            QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
1684 1685 1686 1687 1688 1689
    DO_TEST("iothreads-virtio-scsi-pci", QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_OBJECT_IOTHREAD,
            QEMU_CAPS_VIRTIO_SCSI_IOTHREAD);
    DO_TEST("iothreads-virtio-scsi-ccw", QEMU_CAPS_OBJECT_IOTHREAD,
            QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_VIRTIO_SCSI_IOTHREAD,
            QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
J
John Ferlan 已提交
1690

1691 1692
    DO_TEST("cpu-topology1", NONE);
    DO_TEST("cpu-topology2", NONE);
1693
    DO_TEST("cpu-topology3", NONE);
1694 1695 1696 1697 1698 1699 1700 1701
    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);
1702
    DO_TEST("cpu-numa1", NONE);
1703 1704
    DO_TEST("cpu-numa2", NONE);
    DO_TEST("cpu-numa-no-memory-element", NONE);
1705
    DO_TEST_PARSE_ERROR("cpu-numa3", NONE);
1706 1707
    DO_TEST_FAILURE("cpu-numa-disjoint", NONE);
    DO_TEST("cpu-numa-disjoint", QEMU_CAPS_NUMA);
1708 1709
    DO_TEST_FAILURE("cpu-numa-memshared", QEMU_CAPS_OBJECT_MEMORY_RAM);
    DO_TEST_FAILURE("cpu-numa-memshared", NONE);
1710
    DO_TEST("cpu-numa-memshared", QEMU_CAPS_OBJECT_MEMORY_FILE);
1711
    DO_TEST("cpu-host-model", NONE);
1712
    DO_TEST("cpu-host-model-vendor", NONE);
1713
    skipLegacyCPUs = true;
1714
    DO_TEST("cpu-host-model-fallback", NONE);
1715
    DO_TEST_FAILURE("cpu-host-model-nofallback", NONE);
1716
    skipLegacyCPUs = false;
A
Andrea Bolognani 已提交
1717
    DO_TEST("cpu-host-passthrough", QEMU_CAPS_KVM);
1718
    DO_TEST_FAILURE("cpu-host-passthrough", NONE);
A
Andrea Bolognani 已提交
1719
    DO_TEST_FAILURE("cpu-qemu-host-passthrough", QEMU_CAPS_KVM);
1720

1721 1722
    qemuTestSetHostArch(driver.caps, VIR_ARCH_S390X);
    DO_TEST("cpu-s390-zEC12", QEMU_CAPS_KVM, QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
1723 1724
    DO_TEST("cpu-s390-features", QEMU_CAPS_KVM, QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION);
    DO_TEST_FAILURE("cpu-s390-features", QEMU_CAPS_KVM);
1725 1726
    qemuTestSetHostArch(driver.caps, VIR_ARCH_NONE);

1727
    qemuTestSetHostCPU(driver.caps, cpuHaswell);
1728 1729 1730 1731
    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);
1732
    DO_TEST("cpu-host-model-cmt", NONE);
1733
    DO_TEST("cpu-tsc-frequency", QEMU_CAPS_KVM);
1734
    qemuTestSetHostCPU(driver.caps, NULL);
1735

1736
    DO_TEST("encrypted-disk", NONE);
J
John Ferlan 已提交
1737
    DO_TEST("encrypted-disk-usage", NONE);
1738
# ifdef HAVE_GNUTLS_CIPHER_ENCRYPT
1739
    DO_TEST("luks-disks", QEMU_CAPS_OBJECT_SECRET);
1740
    DO_TEST("luks-disks-source", QEMU_CAPS_OBJECT_SECRET);
1741 1742
    DO_TEST_PARSE_ERROR("luks-disks-source-qcow2", QEMU_CAPS_OBJECT_SECRET);
    DO_TEST("luks-disks-source-qcow2", QEMU_CAPS_OBJECT_SECRET, QEMU_CAPS_QCOW2_LUKS);
1743 1744 1745
# else
    DO_TEST_FAILURE("luks-disks", QEMU_CAPS_OBJECT_SECRET);
# endif
1746
    DO_TEST_PARSE_ERROR("luks-disk-invalid", NONE);
1747
    DO_TEST_PARSE_ERROR("luks-disks-source-both", QEMU_CAPS_OBJECT_SECRET);
1748

1749 1750 1751 1752 1753 1754 1755 1756
    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);
1757
    DO_TEST("cputune-numatune",
1758
            QEMU_CAPS_KVM,
1759
            QEMU_CAPS_OBJECT_IOTHREAD,
1760 1761
            QEMU_CAPS_OBJECT_MEMORY_RAM,
            QEMU_CAPS_OBJECT_MEMORY_FILE);
1762 1763 1764
    DO_TEST("vcpu-placement-static",
            QEMU_CAPS_KVM,
            QEMU_CAPS_OBJECT_IOTHREAD);
1765

1766
    DO_TEST("numatune-memory", NONE);
1767
    DO_TEST_PARSE_ERROR("numatune-memory-invalid-nodeset", NONE);
1768 1769
    DO_TEST_LINUX("numatune-memnode", QEMU_CAPS_NUMA,
                  QEMU_CAPS_OBJECT_MEMORY_RAM);
1770 1771
    DO_TEST_FAILURE("numatune-memnode", NONE);

1772 1773
    DO_TEST_LINUX("numatune-memnode-no-memory", QEMU_CAPS_NUMA,
                  QEMU_CAPS_OBJECT_MEMORY_RAM);
1774 1775
    DO_TEST_FAILURE("numatune-memnode-no-memory", NONE);

1776 1777
    DO_TEST("numatune-distances", QEMU_CAPS_NUMA, QEMU_CAPS_NUMA_DIST);

1778
    DO_TEST("numatune-auto-nodeset-invalid", NONE);
1779 1780
    DO_TEST("numatune-auto-prefer", QEMU_CAPS_OBJECT_MEMORY_RAM,
            QEMU_CAPS_OBJECT_MEMORY_FILE);
1781 1782
    DO_TEST_FAILURE("numatune-static-nodeset-exceed-hostnode",
                    QEMU_CAPS_OBJECT_MEMORY_RAM);
1783 1784
    DO_TEST_PARSE_ERROR("numatune-memnode-nocpu", NONE);
    DO_TEST_PARSE_ERROR("numatune-memnodes-problematic", NONE);
1785 1786
    DO_TEST("numad", NONE);
    DO_TEST("numad-auto-vcpu-static-numatune", NONE);
1787
    DO_TEST_PARSE_ERROR("numad-auto-vcpu-static-numatune-no-nodeset", NONE);
1788 1789 1790
    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);
1791
    DO_TEST("blkdeviotune",
1792
            QEMU_CAPS_DRIVE_IOTUNE);
1793
    DO_TEST("blkdeviotune-max",
1794
            QEMU_CAPS_DRIVE_IOTUNE,
1795
            QEMU_CAPS_DRIVE_IOTUNE_MAX);
1796 1797 1798 1799
    DO_TEST("blkdeviotune-group-num",
            QEMU_CAPS_DRIVE_IOTUNE,
            QEMU_CAPS_DRIVE_IOTUNE_MAX,
            QEMU_CAPS_DRIVE_IOTUNE_GROUP);
1800 1801 1802 1803
    DO_TEST("blkdeviotune-max-length",
            QEMU_CAPS_DRIVE_IOTUNE,
            QEMU_CAPS_DRIVE_IOTUNE_MAX,
            QEMU_CAPS_DRIVE_IOTUNE_MAX_LENGTH);
1804

1805
    DO_TEST("multifunction-pci-device",
1806
            QEMU_CAPS_NODEFCONFIG,
1807
            QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_SCSI_LSI);
1808

1809
    DO_TEST("monitor-json",
1810 1811
            QEMU_CAPS_MONITOR_JSON,
            QEMU_CAPS_NODEFCONFIG);
1812
    DO_TEST("no-shutdown",
1813 1814
            QEMU_CAPS_MONITOR_JSON,
            QEMU_CAPS_NODEFCONFIG,
1815
            QEMU_CAPS_NO_SHUTDOWN);
1816

1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828
    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);
1829

1830
    DO_TEST("pseries-basic",
1831
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1832
            QEMU_CAPS_DEVICE_SPAPR_VTY,
1833
            QEMU_CAPS_NODEFCONFIG);
1834
    DO_TEST("pseries-vio",
1835
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1836
            QEMU_CAPS_DEVICE_SPAPR_VTY,
1837
            QEMU_CAPS_NODEFCONFIG);
1838
    DO_TEST("pseries-usb-default",
1839
            QEMU_CAPS_NODEFCONFIG,
1840
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1841
            QEMU_CAPS_DEVICE_SPAPR_VTY,
1842 1843 1844
            QEMU_CAPS_PIIX3_USB_UHCI,
            QEMU_CAPS_PCI_OHCI,
            QEMU_CAPS_PCI_MULTIFUNCTION);
1845
    DO_TEST("pseries-usb-multi",
1846
            QEMU_CAPS_NODEFCONFIG,
1847
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1848
            QEMU_CAPS_DEVICE_SPAPR_VTY,
1849 1850 1851
            QEMU_CAPS_PIIX3_USB_UHCI,
            QEMU_CAPS_PCI_OHCI,
            QEMU_CAPS_PCI_MULTIFUNCTION);
1852
    DO_TEST("pseries-vio-user-assigned",
1853
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1854
            QEMU_CAPS_DEVICE_SPAPR_VTY,
1855
            QEMU_CAPS_NODEFCONFIG);
1856
    DO_TEST_PARSE_ERROR("pseries-vio-address-clash",
1857
            QEMU_CAPS_NODEFCONFIG);
1858 1859 1860
    DO_TEST("pseries-nvram",
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
            QEMU_CAPS_DEVICE_NVRAM);
1861
    DO_TEST("pseries-usb-kbd", QEMU_CAPS_PCI_OHCI,
1862
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1863
            QEMU_CAPS_DEVICE_USB_KBD,
1864
            QEMU_CAPS_DEVICE_SPAPR_VTY,
1865
            QEMU_CAPS_NODEFCONFIG);
1866
    DO_TEST("pseries-cpu-exact",
1867
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1868
            QEMU_CAPS_DEVICE_SPAPR_VTY,
1869
            QEMU_CAPS_NODEFCONFIG);
1870 1871
    DO_TEST_PARSE_ERROR("pseries-no-parallel",
            QEMU_CAPS_NODEFCONFIG);
1872 1873

    qemuTestSetHostArch(driver.caps, VIR_ARCH_PPC64);
A
Andrea Bolognani 已提交
1874
    DO_TEST("pseries-cpu-compat", QEMU_CAPS_KVM,
1875
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1876
            QEMU_CAPS_DEVICE_SPAPR_VTY,
1877
            QEMU_CAPS_NODEFCONFIG);
1878 1879 1880 1881
    DO_TEST("pseries-machine-max-cpu-compat",
            QEMU_CAPS_KVM,
            QEMU_CAPS_MACHINE_OPT,
            QEMU_CAPS_MACHINE_PSERIES_MAX_CPU_COMPAT,
1882
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1883
            QEMU_CAPS_NODEFCONFIG);
A
Andrea Bolognani 已提交
1884
    DO_TEST("pseries-cpu-le", QEMU_CAPS_KVM,
1885
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1886
            QEMU_CAPS_DEVICE_SPAPR_VTY,
1887
            QEMU_CAPS_NODEFCONFIG);
1888 1889 1890
    DO_TEST_FAILURE("pseries-cpu-compat-power9",
                    QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
                    QEMU_CAPS_KVM);
1891 1892 1893

    qemuTestSetHostCPU(driver.caps, cpuPower9);
    DO_TEST("pseries-cpu-compat-power9",
1894
            QEMU_CAPS_KVM,
1895
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1896
            QEMU_CAPS_DEVICE_SPAPR_VTY,
1897
            QEMU_CAPS_NODEFCONFIG);
1898 1899
    qemuTestSetHostCPU(driver.caps, NULL);

1900 1901
    qemuTestSetHostArch(driver.caps, VIR_ARCH_NONE);

1902
    DO_TEST("pseries-panic-missing",
1903
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1904
            QEMU_CAPS_DEVICE_SPAPR_VTY,
1905
            QEMU_CAPS_NODEFCONFIG);
1906
    DO_TEST("pseries-panic-no-address",
1907
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1908
            QEMU_CAPS_DEVICE_SPAPR_VTY,
1909
            QEMU_CAPS_NODEFCONFIG);
1910
    DO_TEST_FAILURE("pseries-panic-address",
1911
                    QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1912
                    QEMU_CAPS_NODEFCONFIG);
1913 1914 1915 1916 1917 1918 1919

    DO_TEST("pseries-phb-simple",
            QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE);
    DO_TEST("pseries-phb-default-missing",
            QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE);
1920 1921 1922 1923 1924 1925
    DO_TEST("pseries-phb-numa-node",
            QEMU_CAPS_NUMA,
            QEMU_CAPS_OBJECT_MEMORY_RAM,
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
            QEMU_CAPS_SPAPR_PCI_HOST_BRIDGE_NUMA_NODE);
    DO_TEST_PARSE_ERROR("pseries-default-phb-numa-node", NONE);
1926 1927 1928
    DO_TEST_PARSE_ERROR("pseries-phb-invalid-target-index-1", NONE);
    DO_TEST_PARSE_ERROR("pseries-phb-invalid-target-index-2", NONE);
    DO_TEST_PARSE_ERROR("pseries-phb-invalid-target-index-3", NONE);
1929

1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960
    DO_TEST("pseries-many-devices",
            QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
            QEMU_CAPS_VIRTIO_SCSI);
    DO_TEST("pseries-many-buses-1",
            QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
            QEMU_CAPS_VIRTIO_SCSI);
    DO_TEST("pseries-many-buses-2",
            QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
            QEMU_CAPS_VIRTIO_SCSI);
    DO_TEST("pseries-hostdevs-1",
            QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
            QEMU_CAPS_HOST_PCI_MULTIDOMAIN,
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_DEVICE_VFIO_PCI);
    DO_TEST("pseries-hostdevs-2",
            QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
            QEMU_CAPS_HOST_PCI_MULTIDOMAIN,
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_DEVICE_VFIO_PCI);
    DO_TEST("pseries-hostdevs-3",
            QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
            QEMU_CAPS_HOST_PCI_MULTIDOMAIN,
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_DEVICE_VFIO_PCI);

1961
    DO_TEST("pseries-features",
1962
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1963 1964
            QEMU_CAPS_MACHINE_OPT,
            QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT);
1965
    DO_TEST_FAILURE("pseries-features",
1966
                    QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1967
                    QEMU_CAPS_MACHINE_OPT);
A
Andrea Bolognani 已提交
1968
    DO_TEST_PARSE_ERROR("pseries-features-invalid-machine", NONE);
1969

1970 1971
    DO_TEST("pseries-serial-native",
            QEMU_CAPS_NODEFCONFIG,
1972
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1973 1974 1975
            QEMU_CAPS_DEVICE_SPAPR_VTY);
    DO_TEST("pseries-serial+console-native",
            QEMU_CAPS_NODEFCONFIG,
1976
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1977 1978 1979
            QEMU_CAPS_DEVICE_SPAPR_VTY);
    DO_TEST("pseries-serial-compat",
            QEMU_CAPS_NODEFCONFIG,
1980
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1981
            QEMU_CAPS_DEVICE_SPAPR_VTY);
1982 1983
    DO_TEST("pseries-serial-pci",
            QEMU_CAPS_NODEFCONFIG,
1984
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1985 1986 1987
            QEMU_CAPS_DEVICE_PCI_SERIAL);
    DO_TEST("pseries-serial-usb",
            QEMU_CAPS_NODEFCONFIG,
1988
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1989 1990
            QEMU_CAPS_DEVICE_QEMU_XHCI,
            QEMU_CAPS_DEVICE_USB_SERIAL);
1991 1992
    DO_TEST("pseries-console-native",
            QEMU_CAPS_NODEFCONFIG,
1993
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1994 1995
            QEMU_CAPS_DEVICE_SPAPR_VTY);
    DO_TEST("pseries-console-virtio",
1996
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
1997 1998 1999
            QEMU_CAPS_NODEFCONFIG);
    DO_TEST_PARSE_ERROR("pseries-serial-invalid-machine", NONE);

2000
    DO_TEST("mach-virt-serial-native",
2001
            QEMU_CAPS_DEVICE_PL011,
2002 2003
            QEMU_CAPS_NODEFCONFIG);
    DO_TEST("mach-virt-serial+console-native",
2004
            QEMU_CAPS_DEVICE_PL011,
2005 2006
            QEMU_CAPS_NODEFCONFIG);
    DO_TEST("mach-virt-serial-compat",
2007
            QEMU_CAPS_DEVICE_PL011,
2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024
            QEMU_CAPS_NODEFCONFIG);
    DO_TEST("mach-virt-serial-pci",
            QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_OBJECT_GPEX,
            QEMU_CAPS_PCI_MULTIFUNCTION,
            QEMU_CAPS_DEVICE_PCIE_ROOT_PORT,
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_PCI_SERIAL);
    DO_TEST("mach-virt-serial-usb",
            QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_OBJECT_GPEX,
            QEMU_CAPS_PCI_MULTIFUNCTION,
            QEMU_CAPS_DEVICE_PCIE_ROOT_PORT,
            QEMU_CAPS_DEVICE_QEMU_XHCI,
            QEMU_CAPS_DEVICE_USB_SERIAL);
    DO_TEST("mach-virt-console-native",
2025
            QEMU_CAPS_DEVICE_PL011,
2026 2027 2028 2029 2030
            QEMU_CAPS_NODEFCONFIG);
    DO_TEST("mach-virt-console-virtio",
            QEMU_CAPS_NODEFCONFIG);
    DO_TEST_PARSE_ERROR("mach-virt-serial-invalid-machine", NONE);

2031
    DO_TEST("disk-ide-drive-split",
2032
            QEMU_CAPS_NODEFCONFIG,
2033
            QEMU_CAPS_IDE_CD);
2034
    DO_TEST("disk-ide-wwn",
2035
            QEMU_CAPS_IDE_CD,
2036
            QEMU_CAPS_DRIVE_SERIAL, QEMU_CAPS_IDE_DRIVE_WWN);
2037

2038
    DO_TEST("disk-geometry", NONE);
V
Viktor Mihajlovski 已提交
2039
    DO_TEST("disk-blockio",
2040
            QEMU_CAPS_NODEFCONFIG,
V
Viktor Mihajlovski 已提交
2041
            QEMU_CAPS_IDE_CD, QEMU_CAPS_BLOCKIO);
2042

2043
    DO_TEST("video-device-pciaddr-default",
2044 2045
            QEMU_CAPS_KVM,
            QEMU_CAPS_VNC,
2046
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2047
            QEMU_CAPS_DEVICE_QXL);
2048
    DO_TEST("video-vga-nodevice", QEMU_CAPS_DEVICE_VGA);
2049
    DO_TEST("video-vga-device", QEMU_CAPS_DEVICE_VGA,
2050
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
2051
    DO_TEST("video-vga-device-vgamem", QEMU_CAPS_DEVICE_VGA,
2052
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY, QEMU_CAPS_VGA_VGAMEM);
2053
    DO_TEST("video-qxl-nodevice", QEMU_CAPS_DEVICE_QXL);
2054
    DO_TEST("video-qxl-device",
2055
            QEMU_CAPS_DEVICE_QXL,
2056
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
2057
    DO_TEST("video-qxl-device-vgamem",
2058
            QEMU_CAPS_DEVICE_QXL,
2059
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2060 2061
            QEMU_CAPS_QXL_VGAMEM);
    DO_TEST("video-qxl-sec-device",
2062
            QEMU_CAPS_DEVICE_QXL, QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
2063
    DO_TEST("video-qxl-sec-device-vgamem",
2064 2065
            QEMU_CAPS_DEVICE_QXL,
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2066
            QEMU_CAPS_QXL_VGAMEM);
2067 2068 2069
    DO_TEST("video-qxl-heads",
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
            QEMU_CAPS_DEVICE_QXL,
2070
            QEMU_CAPS_QXL_MAX_OUTPUTS);
2071 2072 2073
    DO_TEST("video-vga-qxl-heads",
            QEMU_CAPS_DEVICE_QXL,
            QEMU_CAPS_QXL_MAX_OUTPUTS);
2074 2075 2076
    DO_TEST("video-qxl-noheads",
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
            QEMU_CAPS_DEVICE_QXL,
2077
            QEMU_CAPS_QXL_MAX_OUTPUTS);
M
Marc-André Lureau 已提交
2078
    DO_TEST("video-virtio-gpu-device",
2079
            QEMU_CAPS_DEVICE_VIRTIO_GPU,
M
Marc-André Lureau 已提交
2080
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
2081
    DO_TEST("video-virtio-gpu-virgl",
2082
            QEMU_CAPS_DEVICE_VIRTIO_GPU,
2083
            QEMU_CAPS_VIRTIO_GPU_VIRGL,
2084
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
2085 2086
    DO_TEST("video-virtio-gpu-spice-gl",
            QEMU_CAPS_DEVICE_VIRTIO_GPU,
2087
            QEMU_CAPS_VIRTIO_GPU_VIRGL,
2088 2089
            QEMU_CAPS_SPICE,
            QEMU_CAPS_SPICE_GL,
2090
            QEMU_CAPS_SPICE_RENDERNODE,
2091
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
2092 2093 2094
    DO_TEST("video-virtio-gpu-secondary",
            QEMU_CAPS_DEVICE_VIRTIO_GPU,
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
2095 2096 2097
    DO_TEST("video-virtio-vga",
            QEMU_CAPS_DEVICE_VIRTIO_GPU,
            QEMU_CAPS_DEVICE_VIRTIO_VGA,
2098 2099
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
            QEMU_CAPS_VIRTIO_GPU_MAX_OUTPUTS);
2100
    DO_TEST_PARSE_ERROR("video-invalid", NONE);
2101

2102 2103
    DO_TEST("virtio-rng-default",
            QEMU_CAPS_DEVICE_VIRTIO_RNG,
2104
            QEMU_CAPS_OBJECT_RNG_RANDOM);
2105 2106
    DO_TEST("virtio-rng-random",
            QEMU_CAPS_DEVICE_VIRTIO_RNG,
2107
            QEMU_CAPS_OBJECT_RNG_RANDOM);
2108 2109
    DO_TEST("virtio-rng-egd",
            QEMU_CAPS_DEVICE_VIRTIO_RNG,
2110
            QEMU_CAPS_OBJECT_RNG_EGD);
2111 2112 2113 2114
    DO_TEST("virtio-rng-multiple",
            QEMU_CAPS_DEVICE_VIRTIO_RNG,
            QEMU_CAPS_OBJECT_RNG_EGD,
            QEMU_CAPS_OBJECT_RNG_RANDOM);
2115
    DO_TEST_PARSE_ERROR("virtio-rng-egd-crash",
2116 2117
            QEMU_CAPS_DEVICE_VIRTIO_RNG,
            QEMU_CAPS_OBJECT_RNG_EGD);
2118
    DO_TEST("virtio-rng-ccw",
2119 2120 2121 2122 2123
            QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_BOOTINDEX,
            QEMU_CAPS_VIRTIO_CCW,
            QEMU_CAPS_VIRTIO_S390,
            QEMU_CAPS_DEVICE_VIRTIO_RNG,
2124
            QEMU_CAPS_OBJECT_RNG_RANDOM);
2125

2126
    DO_TEST("s390-allow-bogus-usb-none",
2127 2128 2129 2130 2131
            QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_BOOTINDEX,
            QEMU_CAPS_VIRTIO_S390,
            QEMU_CAPS_DEVICE_VIRTIO_RNG,
            QEMU_CAPS_OBJECT_RNG_RANDOM);
2132
    DO_TEST("s390-allow-bogus-usb-controller",
2133 2134 2135 2136 2137
            QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_BOOTINDEX,
            QEMU_CAPS_VIRTIO_S390,
            QEMU_CAPS_DEVICE_VIRTIO_RNG,
            QEMU_CAPS_OBJECT_RNG_RANDOM);
2138

2139
    DO_TEST("s390-panic-no-address",
2140 2141 2142
            QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_VIRTIO_CCW,
            QEMU_CAPS_VIRTIO_S390);
2143
    DO_TEST_FAILURE("s390-panic-address",
2144 2145 2146
            QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_VIRTIO_CCW,
            QEMU_CAPS_VIRTIO_S390);
2147
    DO_TEST("s390-panic-missing",
2148 2149 2150
            QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_VIRTIO_CCW,
            QEMU_CAPS_VIRTIO_S390);
2151 2152 2153 2154
    DO_TEST_PARSE_ERROR("s390-no-parallel",
            QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_VIRTIO_CCW,
            QEMU_CAPS_VIRTIO_S390);
2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170
    DO_TEST("s390-serial",
            QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_VIRTIO_CCW,
            QEMU_CAPS_VIRTIO_S390,
            QEMU_CAPS_DEVICE_SCLPCONSOLE);
    DO_TEST("s390-serial-2",
            QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_VIRTIO_CCW,
            QEMU_CAPS_VIRTIO_S390,
            QEMU_CAPS_DEVICE_SCLPCONSOLE,
            QEMU_CAPS_DEVICE_SCLPLMCONSOLE);
    DO_TEST("s390-serial-console",
            QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_VIRTIO_CCW,
            QEMU_CAPS_VIRTIO_S390,
            QEMU_CAPS_DEVICE_SCLPCONSOLE);
2171

2172 2173 2174 2175 2176
    DO_TEST("ppc-dtb",
            QEMU_CAPS_KVM,
            QEMU_CAPS_DTB);
    DO_TEST("ppce500-serial",
            QEMU_CAPS_KVM);
O
Olivia Yin 已提交
2177

2178
    DO_TEST("tpm-passthrough",
2179
            QEMU_CAPS_DEVICE_TPM_PASSTHROUGH, QEMU_CAPS_DEVICE_TPM_TIS);
2180
    DO_TEST_PARSE_ERROR("tpm-no-backend-invalid",
2181
                        QEMU_CAPS_DEVICE_TPM_PASSTHROUGH, QEMU_CAPS_DEVICE_TPM_TIS);
2182

2183

2184 2185 2186 2187
    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);
2188

2189 2190 2191 2192 2193 2194
    DO_TEST("pci-bridge",
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
            QEMU_CAPS_VNC,
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
    DO_TEST("pci-autoadd-addr",
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
2195
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
2196 2197
    DO_TEST("pci-autoadd-idx",
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
2198 2199
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
    DO_TEST("pci-autofill-addr", QEMU_CAPS_DEVICE_CIRRUS_VGA);
2200
    DO_TEST("pci-many",
2201
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
2202
    DO_TEST("pci-bridge-many-disks",
2203
            QEMU_CAPS_DEVICE_PCI_BRIDGE);
L
Laine Stump 已提交
2204
    DO_TEST("pcie-root",
2205 2206 2207 2208
            QEMU_CAPS_DEVICE_IOH3420,
            QEMU_CAPS_ICH9_AHCI,
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
            QEMU_CAPS_DEVICE_QXL);
2209
    DO_TEST("q35",
2210
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
2211
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
2212
            QEMU_CAPS_DEVICE_IOH3420,
2213
            QEMU_CAPS_ICH9_AHCI,
2214 2215
            QEMU_CAPS_PCI_MULTIFUNCTION,
            QEMU_CAPS_ICH9_USB_EHCI1,
2216
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2217
            QEMU_CAPS_DEVICE_QXL);
2218 2219 2220 2221 2222 2223 2224 2225
    DO_TEST_PARSE_ERROR("q35-dmi-bad-address1",
                        QEMU_CAPS_DEVICE_PCI_BRIDGE,
                        QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
                        QEMU_CAPS_DEVICE_IOH3420);
    DO_TEST_PARSE_ERROR("q35-dmi-bad-address2",
                        QEMU_CAPS_DEVICE_PCI_BRIDGE,
                        QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
                        QEMU_CAPS_DEVICE_IOH3420);
2226
    DO_TEST("q35-pm-disable",
2227
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
2228
            QEMU_CAPS_DEVICE_IOH3420,
2229 2230 2231 2232
            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",
2233
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
2234
            QEMU_CAPS_DEVICE_IOH3420,
2235 2236
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, QEMU_CAPS_ICH9_AHCI,
            QEMU_CAPS_PIIX_DISABLE_S3, QEMU_CAPS_PIIX_DISABLE_S4);
2237
    DO_TEST("q35-usb2",
2238
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
2239
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
2240
            QEMU_CAPS_DEVICE_IOH3420,
2241
            QEMU_CAPS_ICH9_AHCI,
2242 2243
            QEMU_CAPS_PCI_MULTIFUNCTION,
            QEMU_CAPS_ICH9_USB_EHCI1,
2244
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2245
            QEMU_CAPS_DEVICE_QXL);
2246
    DO_TEST("q35-usb2-multi",
2247
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
2248
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
2249
            QEMU_CAPS_DEVICE_IOH3420,
2250
            QEMU_CAPS_ICH9_AHCI,
2251 2252
            QEMU_CAPS_PCI_MULTIFUNCTION,
            QEMU_CAPS_ICH9_USB_EHCI1,
2253
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2254
            QEMU_CAPS_DEVICE_QXL);
2255
    DO_TEST("q35-usb2-reorder",
2256
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
2257
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
2258
            QEMU_CAPS_DEVICE_IOH3420,
2259
            QEMU_CAPS_ICH9_AHCI,
2260 2261
            QEMU_CAPS_PCI_MULTIFUNCTION,
            QEMU_CAPS_ICH9_USB_EHCI1,
2262
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2263
            QEMU_CAPS_DEVICE_QXL);
2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285
    /* verify that devices with pcie capability are assigned to a pcie slot */
    DO_TEST("q35-pcie",
            QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY,
            QEMU_CAPS_DEVICE_VIRTIO_RNG,
            QEMU_CAPS_OBJECT_RNG_RANDOM,
            QEMU_CAPS_NETDEV,
            QEMU_CAPS_DEVICE_VIRTIO_NET,
            QEMU_CAPS_DEVICE_VIRTIO_GPU,
            QEMU_CAPS_VIRTIO_GPU_VIRGL,
            QEMU_CAPS_VIRTIO_KEYBOARD,
            QEMU_CAPS_VIRTIO_MOUSE,
            QEMU_CAPS_VIRTIO_TABLET,
            QEMU_CAPS_VIRTIO_INPUT_HOST,
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_FSDEV,
            QEMU_CAPS_FSDEV_WRITEOUT,
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_IOH3420,
            QEMU_CAPS_ICH9_AHCI,
            QEMU_CAPS_PCI_MULTIFUNCTION,
            QEMU_CAPS_ICH9_USB_EHCI1,
2286
            QEMU_CAPS_NEC_USB_XHCI,
2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
    /* same XML as q35-pcie, but don't set
     * QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY, so virtio devices should
     * be assigned to legacy pci slots
     */
    DO_TEST("q35-virtio-pci",
            QEMU_CAPS_DEVICE_VIRTIO_RNG,
            QEMU_CAPS_OBJECT_RNG_RANDOM,
            QEMU_CAPS_NETDEV,
            QEMU_CAPS_DEVICE_VIRTIO_NET,
            QEMU_CAPS_DEVICE_VIRTIO_GPU,
            QEMU_CAPS_VIRTIO_GPU_VIRGL,
            QEMU_CAPS_VIRTIO_KEYBOARD,
            QEMU_CAPS_VIRTIO_MOUSE,
2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324
            QEMU_CAPS_VIRTIO_TABLET,
            QEMU_CAPS_VIRTIO_INPUT_HOST,
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_FSDEV,
            QEMU_CAPS_FSDEV_WRITEOUT,
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_IOH3420,
            QEMU_CAPS_ICH9_AHCI,
            QEMU_CAPS_PCI_MULTIFUNCTION,
            QEMU_CAPS_ICH9_USB_EHCI1,
            QEMU_CAPS_NEC_USB_XHCI,
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
    /* same as q35-pcie, but all PCI controllers are added automatically */
    DO_TEST("q35-pcie-autoadd",
            QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY,
            QEMU_CAPS_DEVICE_VIRTIO_RNG,
            QEMU_CAPS_OBJECT_RNG_RANDOM,
            QEMU_CAPS_NETDEV,
            QEMU_CAPS_DEVICE_VIRTIO_NET,
            QEMU_CAPS_DEVICE_VIRTIO_GPU,
            QEMU_CAPS_VIRTIO_GPU_VIRGL,
            QEMU_CAPS_VIRTIO_KEYBOARD,
            QEMU_CAPS_VIRTIO_MOUSE,
2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342
            QEMU_CAPS_VIRTIO_TABLET,
            QEMU_CAPS_VIRTIO_INPUT_HOST,
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_FSDEV,
            QEMU_CAPS_FSDEV_WRITEOUT,
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_IOH3420,
            QEMU_CAPS_ICH9_AHCI,
            QEMU_CAPS_PCI_MULTIFUNCTION,
            QEMU_CAPS_ICH9_USB_EHCI1,
            QEMU_CAPS_NEC_USB_XHCI,
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
    DO_TEST("q35-default-devices-only",
            QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY,
            QEMU_CAPS_DEVICE_VIRTIO_RNG,
            QEMU_CAPS_OBJECT_RNG_RANDOM,
            QEMU_CAPS_NETDEV,
2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365
            QEMU_CAPS_DEVICE_VIRTIO_NET,
            QEMU_CAPS_DEVICE_VIRTIO_GPU,
            QEMU_CAPS_VIRTIO_GPU_VIRGL,
            QEMU_CAPS_VIRTIO_KEYBOARD,
            QEMU_CAPS_VIRTIO_MOUSE,
            QEMU_CAPS_VIRTIO_TABLET,
            QEMU_CAPS_VIRTIO_INPUT_HOST,
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_FSDEV,
            QEMU_CAPS_FSDEV_WRITEOUT,
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_IOH3420,
            QEMU_CAPS_ICH9_AHCI,
            QEMU_CAPS_PCI_MULTIFUNCTION,
            QEMU_CAPS_ICH9_USB_EHCI1,
            QEMU_CAPS_NEC_USB_XHCI,
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
    DO_TEST("q35-multifunction",
            QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY,
            QEMU_CAPS_DEVICE_VIRTIO_RNG,
            QEMU_CAPS_OBJECT_RNG_RANDOM,
            QEMU_CAPS_NETDEV,
2366 2367 2368 2369 2370
            QEMU_CAPS_DEVICE_VIRTIO_NET,
            QEMU_CAPS_DEVICE_VIRTIO_GPU,
            QEMU_CAPS_VIRTIO_GPU_VIRGL,
            QEMU_CAPS_VIRTIO_KEYBOARD,
            QEMU_CAPS_VIRTIO_MOUSE,
2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381
            QEMU_CAPS_VIRTIO_TABLET,
            QEMU_CAPS_VIRTIO_INPUT_HOST,
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_FSDEV,
            QEMU_CAPS_FSDEV_WRITEOUT,
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_IOH3420,
            QEMU_CAPS_ICH9_AHCI,
            QEMU_CAPS_PCI_MULTIFUNCTION,
            QEMU_CAPS_ICH9_USB_EHCI1,
2382
            QEMU_CAPS_NEC_USB_XHCI,
2383
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415
    DO_TEST("q35-virt-manager-basic",
            QEMU_CAPS_KVM,
            QEMU_CAPS_RTC,
            QEMU_CAPS_ICH9_DISABLE_S3,
            QEMU_CAPS_ICH9_DISABLE_S4,
            QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY,
            QEMU_CAPS_DEVICE_VIRTIO_RNG,
            QEMU_CAPS_OBJECT_RNG_RANDOM,
            QEMU_CAPS_NETDEV,
            QEMU_CAPS_DEVICE_VIRTIO_NET,
            QEMU_CAPS_DEVICE_VIRTIO_GPU,
            QEMU_CAPS_VIRTIO_GPU_VIRGL,
            QEMU_CAPS_VIRTIO_KEYBOARD,
            QEMU_CAPS_VIRTIO_MOUSE,
            QEMU_CAPS_VIRTIO_TABLET,
            QEMU_CAPS_VIRTIO_INPUT_HOST,
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_FSDEV,
            QEMU_CAPS_FSDEV_WRITEOUT,
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_IOH3420,
            QEMU_CAPS_ICH9_AHCI,
            QEMU_CAPS_PCI_MULTIFUNCTION,
            QEMU_CAPS_ICH9_USB_EHCI1,
            QEMU_CAPS_NEC_USB_XHCI,
            QEMU_CAPS_DEVICE_ICH9_INTEL_HDA,
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
            QEMU_CAPS_SPICE,
            QEMU_CAPS_CHARDEV_SPICEVMC,
            QEMU_CAPS_DEVICE_QXL,
            QEMU_CAPS_HDA_DUPLEX,
2416
            QEMU_CAPS_DEVICE_ISA_SERIAL,
2417
            QEMU_CAPS_USB_REDIR);
2418 2419

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

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

2438 2439 2440 2441 2442 2443 2444
    DO_TEST("autoindex",
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_IOH3420,
            QEMU_CAPS_DEVICE_X3130_UPSTREAM,
            QEMU_CAPS_DEVICE_XIO3130_DOWNSTREAM,
            QEMU_CAPS_ICH9_AHCI,
2445 2446
            QEMU_CAPS_PCI_MULTIFUNCTION,
            QEMU_CAPS_ICH9_USB_EHCI1,
2447
            QEMU_CAPS_NEC_USB_XHCI);
2448 2449 2450 2451 2452 2453 2454
    /* Make sure the user can always override libvirt's default device
     * placement policy by providing an explicit PCI address */
    DO_TEST("q35-pci-force-address",
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_IOH3420,
            QEMU_CAPS_HDA_DUPLEX);
2455

2456
    DO_TEST_PARSE_ERROR("q35-wrong-root",
2457
            QEMU_CAPS_DEVICE_IOH3420,
2458 2459 2460
            QEMU_CAPS_ICH9_AHCI,
            QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_ICH9_USB_EHCI1,
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2461
            QEMU_CAPS_DEVICE_QXL);
2462
    DO_TEST_PARSE_ERROR("440fx-wrong-root", NONE);
2463
    DO_TEST_PARSE_ERROR("440fx-ide-address-conflict", NONE);
2464

2465
    DO_TEST_PARSE_ERROR("pcie-root-port-too-many",
2466
            QEMU_CAPS_DEVICE_IOH3420,
2467
            QEMU_CAPS_ICH9_AHCI,
2468
            QEMU_CAPS_PCI_MULTIFUNCTION,
2469
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2470
            QEMU_CAPS_DEVICE_QXL);
2471

2472 2473 2474
    DO_TEST("pcie-switch-upstream-port",
            QEMU_CAPS_DEVICE_IOH3420,
            QEMU_CAPS_DEVICE_X3130_UPSTREAM,
2475
            QEMU_CAPS_ICH9_AHCI,
2476
            QEMU_CAPS_PCI_MULTIFUNCTION,
2477
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2478
            QEMU_CAPS_DEVICE_QXL);
2479 2480 2481 2482
    DO_TEST("pcie-switch-downstream-port",
            QEMU_CAPS_DEVICE_IOH3420,
            QEMU_CAPS_DEVICE_X3130_UPSTREAM,
            QEMU_CAPS_DEVICE_XIO3130_DOWNSTREAM,
2483
            QEMU_CAPS_ICH9_AHCI,
2484
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2485
            QEMU_CAPS_DEVICE_QXL);
2486

2487 2488 2489 2490 2491 2492
    DO_TEST("pci-expander-bus",
            QEMU_CAPS_DEVICE_PXB);
    DO_TEST_PARSE_ERROR("pci-expander-bus-bad-node",
                        QEMU_CAPS_DEVICE_PXB);
    DO_TEST_PARSE_ERROR("pci-expander-bus-bad-machine",
                        QEMU_CAPS_DEVICE_PXB);
2493 2494
    DO_TEST_PARSE_ERROR("pci-expander-bus-bad-bus",
                        QEMU_CAPS_DEVICE_PXB);
2495

2496 2497 2498 2499 2500 2501 2502 2503 2504 2505
    DO_TEST("pcie-expander-bus",
            QEMU_CAPS_DEVICE_IOH3420,
            QEMU_CAPS_DEVICE_X3130_UPSTREAM,
            QEMU_CAPS_DEVICE_XIO3130_DOWNSTREAM,
            QEMU_CAPS_DEVICE_PXB_PCIE);
    DO_TEST_PARSE_ERROR("pcie-expander-bus-bad-machine",
                        QEMU_CAPS_DEVICE_IOH3420,
                        QEMU_CAPS_DEVICE_X3130_UPSTREAM,
                        QEMU_CAPS_DEVICE_XIO3130_DOWNSTREAM,
                        QEMU_CAPS_DEVICE_PXB_PCIE);
2506 2507 2508
    DO_TEST_PARSE_ERROR("pcie-expander-bus-bad-bus",
                        QEMU_CAPS_DEVICE_IOH3420,
                        QEMU_CAPS_DEVICE_PXB_PCIE);
2509

2510
    DO_TEST("hostdev-scsi-lsi",
2511 2512
            QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI,
            QEMU_CAPS_DEVICE_SCSI_GENERIC);
2513
    DO_TEST("hostdev-scsi-virtio-scsi",
2514 2515
            QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_DEVICE_SCSI_GENERIC);
2516
    DO_TEST("hostdev-scsi-readonly",
J
Ján Tomko 已提交
2517
            QEMU_CAPS_VIRTIO_SCSI,
O
Osier Yang 已提交
2518
            QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE_SCSI_GENERIC);
2519
    DO_TEST("hostdev-scsi-virtio-scsi",
2520 2521 2522
            QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_DEVICE_SCSI_GENERIC,
            QEMU_CAPS_DEVICE_SCSI_GENERIC_BOOTINDEX);
2523
    DO_TEST("hostdev-scsi-lsi-iscsi",
J
John Ferlan 已提交
2524 2525
            QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI,
            QEMU_CAPS_DEVICE_SCSI_GENERIC);
2526
    DO_TEST("hostdev-scsi-lsi-iscsi-auth",
J
John Ferlan 已提交
2527 2528
            QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI,
            QEMU_CAPS_DEVICE_SCSI_GENERIC);
2529
    DO_TEST("hostdev-scsi-virtio-iscsi",
J
John Ferlan 已提交
2530 2531
            QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_DEVICE_SCSI_GENERIC);
2532
    DO_TEST("hostdev-scsi-virtio-iscsi-auth",
J
John Ferlan 已提交
2533 2534
            QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_DEVICE_SCSI_GENERIC);
2535 2536 2537 2538 2539 2540
# ifdef HAVE_GNUTLS_CIPHER_ENCRYPT
    DO_TEST("disk-hostdev-scsi-virtio-iscsi-auth-AES",
            QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_DEVICE_SCSI_GENERIC, QEMU_CAPS_OBJECT_SECRET,
            QEMU_CAPS_ISCSI_PASSWORD_SECRET);
# endif
2541 2542 2543 2544 2545 2546
    DO_TEST("hostdev-scsi-vhost-scsi-ccw",
            QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE_VHOST_SCSI,
            QEMU_CAPS_DEVICE_SCSI_GENERIC, QEMU_CAPS_VIRTIO_CCW);
    DO_TEST("hostdev-scsi-vhost-scsi-pci",
            QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE_VHOST_SCSI,
            QEMU_CAPS_DEVICE_SCSI_GENERIC);
2547 2548 2549 2550 2551 2552 2553
    DO_TEST("hostdev-scsi-vhost-scsi-pcie",
            QEMU_CAPS_KVM,
            QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE_VHOST_SCSI,
            QEMU_CAPS_DEVICE_SCSI_GENERIC,
            QEMU_CAPS_PCI_MULTIFUNCTION,
            QEMU_CAPS_DEVICE_PCIE_ROOT_PORT,
            QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY);
2554

2555
    DO_TEST("mlock-on", QEMU_CAPS_REALTIME_MLOCK);
2556
    DO_TEST_FAILURE("mlock-on", NONE);
2557
    DO_TEST("mlock-off", QEMU_CAPS_REALTIME_MLOCK);
2558 2559
    DO_TEST("mlock-unsupported", NONE);

2560 2561 2562 2563
    DO_TEST_PARSE_ERROR("pci-bridge-negative-index-invalid", NONE);
    DO_TEST_PARSE_ERROR("pci-bridge-duplicate-index", NONE);
    DO_TEST_PARSE_ERROR("pci-root-nonzero-index", NONE);
    DO_TEST_PARSE_ERROR("pci-root-address", NONE);
2564

2565
    DO_TEST("hotplug-base",
2566
            QEMU_CAPS_KVM, QEMU_CAPS_VIRTIO_SCSI);
2567

2568 2569
    DO_TEST("pcihole64", QEMU_CAPS_I440FX_PCI_HOLE64_SIZE);
    DO_TEST_FAILURE("pcihole64-none", NONE);
2570
    DO_TEST("pcihole64-q35",
2571
            QEMU_CAPS_DEVICE_IOH3420,
2572
            QEMU_CAPS_ICH9_AHCI,
2573
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
2574
            QEMU_CAPS_DEVICE_QXL,
2575 2576
            QEMU_CAPS_Q35_PCI_HOLE64_SIZE);

2577
    DO_TEST("arm-vexpressa9-nodevs",
2578
            QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DTB);
2579
    DO_TEST("arm-vexpressa9-basic",
2580
            QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DTB);
2581
    DO_TEST("arm-vexpressa9-virtio",
2582
            QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DTB,
2583
            QEMU_CAPS_DEVICE_VIRTIO_MMIO,
2584
            QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM);
2585
    DO_TEST("arm-virt-virtio",
2586
            QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DTB,
2587
            QEMU_CAPS_DEVICE_VIRTIO_MMIO,
2588
            QEMU_CAPS_DEVICE_PL011,
2589
            QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM);
2590

2591
    DO_TEST("aarch64-virt-virtio",
2592
            QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DTB,
2593
            QEMU_CAPS_DEVICE_VIRTIO_MMIO,
2594
            QEMU_CAPS_DEVICE_PL011,
2595
            QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM);
2596 2597 2598 2599 2600 2601

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

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

2767
    qemuTestSetHostArch(driver.caps, VIR_ARCH_NONE);
2768

2769
    DO_TEST("kvm-pit-delay", QEMU_CAPS_KVM_PIT_TICK_POLICY);
2770
    DO_TEST("kvm-pit-discard", QEMU_CAPS_KVM_PIT_TICK_POLICY);
2771
    DO_TEST("no-kvm-pit-device", NONE);
2772

H
Hu Tao 已提交
2773
    DO_TEST("panic", QEMU_CAPS_DEVICE_PANIC,
2774
            QEMU_CAPS_NODEFCONFIG);
D
Dmitry Andreev 已提交
2775
    DO_TEST("panic-double", QEMU_CAPS_DEVICE_PANIC,
2776
            QEMU_CAPS_NODEFCONFIG);
H
Hu Tao 已提交
2777

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

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

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

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

2815 2816
    DO_TEST("machine-aeskeywrap-on-caps",
            QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_AES_KEY_WRAP,
2817
            QEMU_CAPS_DEA_KEY_WRAP,
2818
            QEMU_CAPS_VIRTIO_SCSI,
2819 2820
            QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
    DO_TEST_FAILURE("machine-aeskeywrap-on-caps", QEMU_CAPS_MACHINE_OPT,
2821
                    QEMU_CAPS_VIRTIO_SCSI,
2822 2823 2824 2825 2826
                    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,
2827
            QEMU_CAPS_VIRTIO_SCSI,
2828 2829
            QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
    DO_TEST_FAILURE("machine-aeskeywrap-on-cap", QEMU_CAPS_MACHINE_OPT,
2830
                    QEMU_CAPS_VIRTIO_SCSI,
2831 2832 2833 2834 2835
                    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,
2836
            QEMU_CAPS_VIRTIO_SCSI,
2837 2838
            QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
    DO_TEST_FAILURE("machine-aeskeywrap-off-caps", QEMU_CAPS_MACHINE_OPT,
2839
                    QEMU_CAPS_VIRTIO_SCSI,
2840 2841 2842 2843
                    QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
    DO_TEST_FAILURE("machine-aeskeywrap-off-caps", NONE);

    DO_TEST("machine-aeskeywrap-off-cap",
2844
            QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_AES_KEY_WRAP,
2845
            QEMU_CAPS_VIRTIO_SCSI,
2846 2847
            QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
    DO_TEST_FAILURE("machine-aeskeywrap-off-cap", QEMU_CAPS_MACHINE_OPT,
2848
                    QEMU_CAPS_VIRTIO_SCSI,
2849 2850 2851 2852 2853
                    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,
2854
            QEMU_CAPS_VIRTIO_SCSI,
2855
            QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
2856
    DO_TEST_FAILURE("machine-deakeywrap-on-caps", QEMU_CAPS_MACHINE_OPT,
2857
                    QEMU_CAPS_VIRTIO_SCSI,
2858 2859 2860 2861
                    QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
    DO_TEST_FAILURE("machine-deakeywrap-on-caps", NONE);

    DO_TEST("machine-deakeywrap-on-cap",
2862
            QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_DEA_KEY_WRAP,
2863
            QEMU_CAPS_VIRTIO_SCSI,
2864 2865
            QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
    DO_TEST_FAILURE("machine-deakeywrap-on-cap", QEMU_CAPS_MACHINE_OPT,
2866
                    QEMU_CAPS_VIRTIO_SCSI,
2867 2868 2869 2870 2871
                    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,
2872
            QEMU_CAPS_VIRTIO_SCSI,
2873 2874
            QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
    DO_TEST_FAILURE("machine-deakeywrap-off-caps", QEMU_CAPS_MACHINE_OPT,
2875
                    QEMU_CAPS_VIRTIO_SCSI,
2876 2877 2878 2879
                    QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
    DO_TEST_FAILURE("machine-deakeywrap-off-caps", NONE);

    DO_TEST("machine-deakeywrap-off-cap",
2880
            QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_DEA_KEY_WRAP,
2881
            QEMU_CAPS_VIRTIO_SCSI,
2882 2883
            QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
    DO_TEST_FAILURE("machine-deakeywrap-off-cap", QEMU_CAPS_MACHINE_OPT,
2884
                    QEMU_CAPS_VIRTIO_SCSI,
2885 2886 2887 2888 2889
                    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,
2890
            QEMU_CAPS_VIRTIO_SCSI,
2891 2892
            QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
    DO_TEST("machine-keywrap-none",
2893
            QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_VIRTIO_SCSI,
2894
            QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
2895

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

J
Jiri Denemark 已提交
2915 2916 2917 2918 2919 2920 2921
    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);

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

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

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

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

2947 2948 2949 2950
    DO_TEST_PARSE_FLAGS_ERROR("missing-machine",
                              VIR_DOMAIN_DEF_PARSE_SKIP_OSTYPE_CHECKS,
                              NONE);

2951 2952 2953 2954 2955 2956 2957 2958
    DO_TEST("name-escape",
            QEMU_CAPS_NAME_DEBUG_THREADS,
            QEMU_CAPS_OBJECT_SECRET,
            QEMU_CAPS_VNC,
            QEMU_CAPS_NAME_GUEST,
            QEMU_CAPS_DEVICE_CIRRUS_VGA,
            QEMU_CAPS_SPICE,
            QEMU_CAPS_SPICE_UNIX);
M
Marc-André Lureau 已提交
2959 2960
    DO_TEST("debug-threads", QEMU_CAPS_NAME_DEBUG_THREADS);

2961
    DO_TEST("master-key", QEMU_CAPS_OBJECT_SECRET);
2962
    DO_TEST("usb-long-port-path", QEMU_CAPS_NODEFCONFIG,
J
Ján Tomko 已提交
2963
            QEMU_CAPS_USB_HUB);
2964 2965
    DO_TEST_PARSE_ERROR("usb-too-long-port-path-invalid",
                        QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_USB_HUB);
2966

2967
    DO_TEST("acpi-table", NONE);
2968
    DO_TEST("intel-iommu",
2969
            QEMU_CAPS_DEVICE_INTEL_IOMMU);
2970 2971 2972
    DO_TEST("intel-iommu-machine",
            QEMU_CAPS_MACHINE_OPT,
            QEMU_CAPS_MACHINE_IOMMU);
J
Ján Tomko 已提交
2973
    DO_TEST("intel-iommu-caching-mode",
2974 2975 2976
            QEMU_CAPS_MACHINE_OPT,
            QEMU_CAPS_MACHINE_KERNEL_IRQCHIP,
            QEMU_CAPS_MACHINE_KERNEL_IRQCHIP_SPLIT,
2977 2978 2979 2980 2981 2982 2983 2984 2985
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_IOH3420,
            QEMU_CAPS_ICH9_AHCI,
            QEMU_CAPS_PCI_MULTIFUNCTION,
            QEMU_CAPS_ICH9_USB_EHCI1,
            QEMU_CAPS_DEVICE_INTEL_IOMMU,
            QEMU_CAPS_INTEL_IOMMU_INTREMAP,
            QEMU_CAPS_INTEL_IOMMU_CACHING_MODE);
2986 2987 2988 2989 2990 2991 2992
    DO_TEST("intel-iommu-eim",
            QEMU_CAPS_MACHINE_OPT,
            QEMU_CAPS_MACHINE_KERNEL_IRQCHIP,
            QEMU_CAPS_MACHINE_KERNEL_IRQCHIP_SPLIT,
            QEMU_CAPS_INTEL_IOMMU_INTREMAP,
            QEMU_CAPS_INTEL_IOMMU_EIM,
            QEMU_CAPS_DEVICE_INTEL_IOMMU);
2993 2994 2995 2996 2997 2998 2999
    DO_TEST("intel-iommu-device-iotlb",
            QEMU_CAPS_MACHINE_OPT,
            QEMU_CAPS_MACHINE_KERNEL_IRQCHIP,
            QEMU_CAPS_MACHINE_KERNEL_IRQCHIP_SPLIT,
            QEMU_CAPS_INTEL_IOMMU_INTREMAP,
            QEMU_CAPS_INTEL_IOMMU_DEVICE_IOTLB,
            QEMU_CAPS_DEVICE_INTEL_IOMMU);
3000

3001
    DO_TEST("cpu-hotplug-startup", QEMU_CAPS_QUERY_HOTPLUGGABLE_CPUS);
3002 3003 3004
    DO_TEST_PARSE_ERROR("cpu-hotplug-granularity",
                        QEMU_CAPS_QUERY_HOTPLUGGABLE_CPUS);

3005 3006 3007 3008 3009 3010 3011 3012
    DO_TEST("virtio-options", QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_VIRTIO_KEYBOARD,
            QEMU_CAPS_VIRTIO_MOUSE, QEMU_CAPS_VIRTIO_TABLET,
            QEMU_CAPS_VIRTIO_INPUT_HOST,
            QEMU_CAPS_FSDEV, QEMU_CAPS_FSDEV_WRITEOUT,
            QEMU_CAPS_DEVICE_VIRTIO_GPU,
            QEMU_CAPS_VIRTIO_GPU_VIRGL,
            QEMU_CAPS_DEVICE_VIRTIO_RNG,
            QEMU_CAPS_OBJECT_RNG_RANDOM,
3013 3014 3015
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
            QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM,
            QEMU_CAPS_VIRTIO_PCI_ATS);
3016

3017 3018 3019 3020 3021 3022 3023 3024 3025 3026
    DO_TEST("fd-memory-numa-topology", QEMU_CAPS_MEM_PATH, QEMU_CAPS_OBJECT_MEMORY_FILE,
            QEMU_CAPS_KVM);
    DO_TEST("fd-memory-numa-topology2", QEMU_CAPS_MEM_PATH, QEMU_CAPS_OBJECT_MEMORY_FILE,
            QEMU_CAPS_KVM);
    DO_TEST("fd-memory-numa-topology3", QEMU_CAPS_MEM_PATH, QEMU_CAPS_OBJECT_MEMORY_FILE,
            QEMU_CAPS_KVM);

    DO_TEST("fd-memory-no-numa-topology", QEMU_CAPS_MEM_PATH, QEMU_CAPS_OBJECT_MEMORY_FILE,
            QEMU_CAPS_KVM);

3027 3028 3029 3030 3031 3032 3033 3034
    DO_TEST("cpu-check-none", QEMU_CAPS_KVM);
    DO_TEST("cpu-check-partial", QEMU_CAPS_KVM);
    DO_TEST("cpu-check-full", QEMU_CAPS_KVM);
    DO_TEST("cpu-check-default-none", QEMU_CAPS_KVM);
    DO_TEST("cpu-check-default-none2", NONE);
    DO_TEST("cpu-check-default-partial", QEMU_CAPS_KVM);
    DO_TEST("cpu-check-default-partial2", QEMU_CAPS_KVM);

3035 3036 3037 3038 3039 3040 3041 3042 3043
    DO_TEST("cpu-cache-disable", QEMU_CAPS_KVM, QEMU_CAPS_CPU_CACHE);
    DO_TEST("cpu-cache-disable2", QEMU_CAPS_KVM);
    DO_TEST("cpu-cache-disable3", QEMU_CAPS_KVM, QEMU_CAPS_CPU_CACHE);
    DO_TEST("cpu-cache-passthrough", QEMU_CAPS_KVM, QEMU_CAPS_CPU_CACHE);
    DO_TEST("cpu-cache-passthrough2", QEMU_CAPS_KVM);
    DO_TEST("cpu-cache-emulate-l3", QEMU_CAPS_KVM, QEMU_CAPS_CPU_CACHE);
    DO_TEST_PARSE_ERROR("cpu-cache-emulate-l2", QEMU_CAPS_KVM);
    DO_TEST_PARSE_ERROR("cpu-cache-passthrough3", QEMU_CAPS_KVM);
    DO_TEST_PARSE_ERROR("cpu-cache-passthrough-l3", QEMU_CAPS_KVM);
M
Marc-André Lureau 已提交
3044
    DO_TEST("vmcoreinfo", QEMU_CAPS_DEVICE_VMCOREINFO);
3045

3046 3047 3048
    DO_TEST("user-aliases", QEMU_CAPS_KVM, QEMU_CAPS_DEVICE_CIRRUS_VGA,
            QEMU_CAPS_OBJECT_MEMORY_FILE, QEMU_CAPS_PIIX_DISABLE_S3,
            QEMU_CAPS_PIIX_DISABLE_S4, QEMU_CAPS_VNC,
3049
            QEMU_CAPS_DEVICE_ISA_SERIAL,
3050 3051
            QEMU_CAPS_HDA_DUPLEX,
            QEMU_CAPS_CCID_EMULATED);
3052
    DO_TEST("user-aliases2", QEMU_CAPS_DEVICE_IOH3420, QEMU_CAPS_ICH9_AHCI);
3053 3054 3055
    DO_TEST("user-aliases-usb", QEMU_CAPS_KVM,
            QEMU_CAPS_PIIX_DISABLE_S3, QEMU_CAPS_PIIX_DISABLE_S4,
            QEMU_CAPS_ICH9_USB_EHCI1, QEMU_CAPS_PCI_MULTIFUNCTION);
3056

3057 3058 3059 3060 3061 3062
    /* Test disks with format probing enabled for legacy reasons.
     * New tests should not go in this section. */
    driver.config->allowDiskFormatProbing = true;
    DO_TEST("disk-many-format-probing", QEMU_CAPS_DRIVE_BOOT);
    driver.config->allowDiskFormatProbing = false;

3063 3064 3065 3066 3067 3068 3069
    DO_TEST("video-virtio-gpu-ccw", QEMU_CAPS_VIRTIO_CCW,
            QEMU_CAPS_DEVICE_VIRTIO_GPU,
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
            QEMU_CAPS_VIRTIO_GPU_MAX_OUTPUTS,
            QEMU_CAPS_VNC,
            QEMU_CAPS_DEVICE_VIRTIO_GPU_CCW);

3070 3071 3072 3073 3074 3075 3076 3077
    DO_TEST("input-virtio-ccw", QEMU_CAPS_VIRTIO_CCW,
            QEMU_CAPS_VIRTIO_KEYBOARD,
            QEMU_CAPS_VIRTIO_MOUSE,
            QEMU_CAPS_VIRTIO_TABLET,
            QEMU_CAPS_DEVICE_VIRTIO_KEYBOARD_CCW,
            QEMU_CAPS_DEVICE_VIRTIO_MOUSE_CCW,
            QEMU_CAPS_DEVICE_VIRTIO_TABLET_CCW);

A
Andrea Bolognani 已提交
3078 3079 3080
    if (getenv("LIBVIRT_SKIP_CLEANUP") == NULL)
        virFileDeleteTree(fakerootdir);

3081
    qemuTestDriverFree(&driver);
A
Andrea Bolognani 已提交
3082
    VIR_FREE(fakerootdir);
3083

3084
    return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
3085 3086
}

3087
VIR_TEST_MAIN_PRELOAD(mymain,
A
Andrea Bolognani 已提交
3088 3089 3090 3091
                      abs_builddir "/.libs/qemuxml2argvmock.so",
                      abs_builddir "/.libs/virrandommock.so",
                      abs_builddir "/.libs/qemucpumock.so",
                      abs_builddir "/.libs/virpcimock.so")
3092

3093 3094
#else

3095 3096 3097 3098
int main(void)
{
    return EXIT_AM_SKIP;
}
3099 3100

#endif /* WITH_QEMU */