qemuxml2xmltest.c 56.1 KB
Newer Older
1
#include <config.h>
2 3

#include <unistd.h>
4 5 6 7

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

8 9
#include "testutils.h"

10 11
#ifdef WITH_QEMU

12
# include "internal.h"
J
Ján Tomko 已提交
13
# include "qemu/qemu_domain_address.h"
M
Matthias Bolte 已提交
14
# include "qemu/qemu_domain.h"
15
# include "testutilsqemu.h"
16
# include "virstring.h"
17 18
# include "virfilewrapper.h"
# include "configmake.h"
19

20 21
# define VIR_FROM_THIS VIR_FROM_NONE

22
static virQEMUDriver driver;
23

24 25 26 27 28 29
enum {
    WHEN_INACTIVE = 1,
    WHEN_ACTIVE = 2,
    WHEN_BOTH = 3,
};

30

31 32 33
static int
testXML2XMLActive(const void *opaque)
{
34
    const struct testQemuInfo *info = opaque;
35

36
    return testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt,
37
                                      info->infile, info->outfile, true, 0,
38
                                      TEST_COMPARE_DOM_XML2XML_RESULT_SUCCESS);
39 40
}

41

42
static int
43
testXML2XMLInactive(const void *opaque)
44
{
45
    const struct testQemuInfo *info = opaque;
46

47 48
    return testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt,
                                      info->infile, info->outfile, false, 0,
49
                                      TEST_COMPARE_DOM_XML2XML_RESULT_SUCCESS);
50
}
51

52

53 54 55
static int
testCompareStatusXMLToXMLFiles(const void *opaque)
{
56
    const struct testQemuInfo *data = opaque;
57 58 59 60
    virDomainObjPtr obj = NULL;
    char *actual = NULL;
    int ret = -1;

61
    if (!(obj = virDomainObjParseFile(data->infile, driver.xmlopt,
62 63 64 65
                                      VIR_DOMAIN_DEF_PARSE_STATUS |
                                      VIR_DOMAIN_DEF_PARSE_ACTUAL_NET |
                                      VIR_DOMAIN_DEF_PARSE_PCI_ORIG_STATES |
                                      VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE |
66
                                      VIR_DOMAIN_DEF_PARSE_ALLOW_POST_PARSE_FAIL))) {
67
        VIR_TEST_DEBUG("\nfailed to parse '%s'", data->infile);
68
        goto cleanup;
69
    }
70

71
    if (!(actual = virDomainObjFormat(obj, driver.xmlopt,
72 73 74 75
                                      VIR_DOMAIN_DEF_FORMAT_SECURE |
                                      VIR_DOMAIN_DEF_FORMAT_STATUS |
                                      VIR_DOMAIN_DEF_FORMAT_ACTUAL_NET |
                                      VIR_DOMAIN_DEF_FORMAT_PCI_ORIG_STATES |
76
                                      VIR_DOMAIN_DEF_FORMAT_CLOCK_ADJUST))) {
77
        VIR_TEST_DEBUG("\nfailed to format back '%s'", data->infile);
78
        goto cleanup;
79
    }
80

81
    if (virTestCompareToFile(actual, data->outfile) < 0)
82 83 84 85 86
        goto cleanup;

    ret = 0;

 cleanup:
87
    virDomainObjEndAPI(&obj);
88 89 90 91 92 93
    VIR_FREE(actual);
    return ret;
}


static int
94
testInfoSetPaths(struct testQemuInfo *info,
95
                 const char *suffix,
96
                 int when)
97
{
98 99 100
    VIR_FREE(info->infile);
    VIR_FREE(info->outfile);

101 102
    info->infile = g_strdup_printf("%s/qemuxml2argvdata/%s.xml", abs_srcdir,
                                   info->name);
103

104 105 106
    info->outfile = g_strdup_printf("%s/qemuxml2xmloutdata/%s-%s%s.xml",
                                    abs_srcdir, info->name,
                                    when == WHEN_ACTIVE ? "active" : "inactive", suffix);
107

108 109
    if (!virFileExists(info->outfile)) {
        VIR_FREE(info->outfile);
110

111 112
        info->outfile = g_strdup_printf("%s/qemuxml2xmloutdata/%s%s.xml",
                                        abs_srcdir, info->name, suffix);
113
    }
114

115
    return 0;
116 117
}

118 119 120

static const char *statusPath = abs_srcdir "/qemustatusxml2xmldata/";

121
static void
122
testInfoSetStatusPaths(struct testQemuInfo *info)
123
{
124 125
    info->infile = g_strdup_printf("%s%s-in.xml", statusPath, info->name);
    info->outfile = g_strdup_printf("%s%s-out.xml", statusPath, info->name);
126 127 128
}


A
Andrea Bolognani 已提交
129
# define FAKEROOTDIRTEMPLATE abs_builddir "/fakerootdir-XXXXXX"
130

131
static int
E
Eric Blake 已提交
132
mymain(void)
133 134
{
    int ret = 0;
A
Andrea Bolognani 已提交
135
    char *fakerootdir;
136
    virQEMUDriverConfigPtr cfg = NULL;
137 138 139 140 141
    virHashTablePtr capslatest = NULL;

    capslatest = testQemuGetLatestCaps();
    if (!capslatest)
        return EXIT_FAILURE;
142

143
    fakerootdir = g_strdup(FAKEROOTDIRTEMPLATE);
A
Andrea Bolognani 已提交
144

J
Ján Tomko 已提交
145
    if (!g_mkdtemp(fakerootdir)) {
A
Andrea Bolognani 已提交
146 147 148 149
        fprintf(stderr, "Cannot create fakerootdir");
        abort();
    }

150
    g_setenv("LIBVIRT_FAKE_ROOT_DIR", fakerootdir, TRUE);
A
Andrea Bolognani 已提交
151

152 153 154 155 156 157 158 159 160
    /* Required for tpm-emulator tests
     */
    virFileWrapperAddPrefix(SYSCONFDIR "/qemu/firmware",
                            abs_srcdir "/qemufirmwaredata/etc/qemu/firmware");
    virFileWrapperAddPrefix(PREFIX "/share/qemu/firmware",
                            abs_srcdir "/qemufirmwaredata/usr/share/qemu/firmware");
    virFileWrapperAddPrefix("/home/user/.config/qemu/firmware",
                            abs_srcdir "/qemufirmwaredata/home/user/.config/qemu/firmware");

161
    if (qemuTestDriverInit(&driver) < 0)
162
        return EXIT_FAILURE;
163

164
    cfg = virQEMUDriverGetConfig(&driver);
165
    driver.privileged = true;
166

167
# define DO_TEST_INTERNAL(_name, suffix, when, ...) \
168
    do { \
169 170 171
        static struct testQemuInfo info = { \
            .name = _name, \
        }; \
172
        if (testQemuInfoSetArgs(&info, capslatest, \
173
                                __VA_ARGS__, \
174 175
                                ARG_END) < 0 || \
            qemuTestCapsCacheInsert(driver.qemuCapsCache, info.qemuCaps) < 0) { \
176
            VIR_TEST_DEBUG("Failed to generate test data for '%s'", _name); \
177 178 179
            return -1; \
        } \
 \
180
        if (when & WHEN_INACTIVE) { \
181
            if (testInfoSetPaths(&info, suffix, WHEN_INACTIVE) < 0) { \
182
                VIR_TEST_DEBUG("Failed to generate inactive paths for '%s'", _name); \
183 184
                return -1; \
            } \
185
            if (virTestRun("QEMU XML-2-XML-inactive " _name, \
186 187 188 189
                            testXML2XMLInactive, &info) < 0) \
                ret = -1; \
        } \
 \
190
        if (when & WHEN_ACTIVE) { \
191
            if (testInfoSetPaths(&info, suffix, WHEN_ACTIVE) < 0) { \
192
                VIR_TEST_DEBUG("Failed to generate active paths for '%s'", _name); \
193 194
                return -1; \
            } \
195
            if (virTestRun("QEMU XML-2-XML-active " _name, \
196 197 198
                            testXML2XMLActive, &info) < 0) \
                ret = -1; \
        } \
199
        testQemuInfoClear(&info); \
200 201
    } while (0)

202 203 204 205 206 207 208 209 210
# define DO_TEST_CAPS_INTERNAL(name, arch, ver, ...) \
    DO_TEST_INTERNAL(name, "." arch "-" ver, WHEN_BOTH, \
                     ARG_CAPS_ARCH, arch, \
                     ARG_CAPS_VER, ver, \
                     __VA_ARGS__)

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

211 212 213
# define DO_TEST_CAPS_ARCH_VER_FULL(name, arch, ver, ...) \
    DO_TEST_CAPS_INTERNAL(name, arch, ver, __VA_ARGS__)

214 215 216
# define DO_TEST_CAPS_ARCH_LATEST(name, arch) \
    DO_TEST_CAPS_ARCH_LATEST_FULL(name, arch, ARG_END)

217
# define DO_TEST_CAPS_ARCH_VER(name, arch, ver) \
218
    DO_TEST_CAPS_ARCH_VER_FULL(name, arch, ver, ARG_END)
219

220 221
# define DO_TEST_CAPS_LATEST(name) \
    DO_TEST_CAPS_ARCH_LATEST(name, "x86_64")
222

223 224 225 226 227 228 229 230 231 232 233
# define DO_TEST_CAPS_VER(name, ver) \
    DO_TEST_CAPS_ARCH_VER(name, "x86_64", ver)

# define DO_TEST_FULL(name, when, ...) \
    DO_TEST_INTERNAL(name, "", when, __VA_ARGS__)

# define DO_TEST(name, ...) \
    DO_TEST_FULL(name, WHEN_BOTH, \
                 ARG_QEMU_CAPS, __VA_ARGS__, QEMU_CAPS_LAST)

# define NONE QEMU_CAPS_LAST
234 235 236 237

    /* 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 */
238
    g_setenv("PATH", "/bin", TRUE);
239

240
    DO_TEST("minimal", NONE);
241 242
    DO_TEST_CAPS_LATEST("genid");
    DO_TEST_CAPS_LATEST("genid-auto");
243 244
    DO_TEST("machine-core-on", NONE);
    DO_TEST("machine-core-off", NONE);
245
    DO_TEST("machine-loadparm-multiple-disks-nets-s390", NONE);
246 247 248 249 250
    DO_TEST("default-kvm-host-arch", NONE);
    DO_TEST("default-qemu-host-arch", NONE);
    DO_TEST("boot-cdrom", NONE);
    DO_TEST("boot-network", NONE);
    DO_TEST("boot-floppy", NONE);
251 252 253
    DO_TEST("boot-floppy-q35",
            QEMU_CAPS_DEVICE_IOH3420,
            QEMU_CAPS_ICH9_AHCI);
254
    DO_TEST("boot-multi", NONE);
255
    DO_TEST("boot-menu-enable-with-timeout", QEMU_CAPS_SPLASH_TIMEOUT);
256 257 258 259
    DO_TEST("boot-menu-disable", NONE);
    DO_TEST("boot-menu-disable-with-timeout", NONE);
    DO_TEST("boot-order", NONE);

260 261
    DO_TEST("reboot-timeout-enabled", QEMU_CAPS_REBOOT_TIMEOUT);
    DO_TEST("reboot-timeout-disabled", QEMU_CAPS_REBOOT_TIMEOUT);
262 263 264 265 266 267 268 269

    DO_TEST("clock-utc", NONE);
    DO_TEST("clock-localtime", NONE);
    DO_TEST("cpu-empty", NONE);
    DO_TEST("cpu-kvmclock", NONE);
    DO_TEST("cpu-host-kvmclock", NONE);
    DO_TEST("cpu-host-passthrough-features", NONE);
    DO_TEST("cpu-host-model-features", NONE);
270
    DO_TEST("cpu-host-model-vendor", NONE);
271
    DO_TEST("clock-catchup", QEMU_CAPS_KVM_PIT_TICK_POLICY);
272 273
    DO_TEST("kvmclock", NONE);
    DO_TEST("clock-timer-hyperv-rtc", NONE);
274
    DO_TEST_CAPS_ARCH_LATEST("clock-timer-armvtimer", "aarch64");
275 276 277 278 279 280 281 282 283 284 285

    DO_TEST("cpu-eoi-disabled", NONE);
    DO_TEST("cpu-eoi-enabled", NONE);
    DO_TEST("eoi-disabled", NONE);
    DO_TEST("eoi-enabled", NONE);
    DO_TEST("pv-spinlock-disabled", NONE);
    DO_TEST("pv-spinlock-enabled", NONE);

    DO_TEST("hyperv", NONE);
    DO_TEST("hyperv-off", NONE);
    DO_TEST("hyperv-panic", NONE);
286
    DO_TEST("hyperv-stimer-direct", NONE);
287 288 289 290 291 292 293

    DO_TEST("kvm-features", NONE);
    DO_TEST("kvm-features-off", NONE);

    DO_TEST("pmu-feature", NONE);
    DO_TEST("pmu-feature-off", NONE);

294
    DO_TEST("pages-discard", NONE);
295
    DO_TEST("pages-discard-hugepages", QEMU_CAPS_OBJECT_MEMORY_FILE);
296
    DO_TEST("pages-dimm-discard", NONE);
297 298
    DO_TEST("hugepages-default", QEMU_CAPS_OBJECT_MEMORY_FILE);
    DO_TEST("hugepages-default-2M", QEMU_CAPS_OBJECT_MEMORY_FILE);
299
    DO_TEST("hugepages-default-system-size", QEMU_CAPS_OBJECT_MEMORY_FILE);
300 301 302 303 304 305 306 307 308 309
    DO_TEST("hugepages-nodeset", QEMU_CAPS_OBJECT_MEMORY_FILE);
    DO_TEST("hugepages-numa-default-2M", QEMU_CAPS_OBJECT_MEMORY_FILE);
    DO_TEST("hugepages-numa-default-dimm", QEMU_CAPS_OBJECT_MEMORY_FILE);
    DO_TEST("hugepages-numa-nodeset", QEMU_CAPS_OBJECT_MEMORY_FILE);
    DO_TEST("hugepages-numa-nodeset-part", QEMU_CAPS_OBJECT_MEMORY_FILE);
    DO_TEST("hugepages-shared", QEMU_CAPS_OBJECT_MEMORY_FILE);
    DO_TEST("hugepages-memaccess", QEMU_CAPS_OBJECT_MEMORY_FILE);
    DO_TEST("hugepages-memaccess2", QEMU_CAPS_OBJECT_MEMORY_FILE);
    DO_TEST("hugepages-nvdimm", QEMU_CAPS_DEVICE_NVDIMM,
            QEMU_CAPS_OBJECT_MEMORY_FILE);
310 311 312 313 314 315
    DO_TEST("nosharepages", NONE);
    DO_TEST("restore-v2", NONE);
    DO_TEST("migrate", NONE);
    DO_TEST("qemu-ns-no-env", NONE);
    DO_TEST("disk-aio", NONE);
    DO_TEST("disk-cdrom", NONE);
316
    DO_TEST_CAPS_LATEST("disk-cdrom-empty-network-invalid");
317
    DO_TEST("disk-cdrom-bus-other", NONE);
318 319 320 321
    DO_TEST("disk-floppy", NONE);
    DO_TEST("disk-usb-device", NONE);
    DO_TEST("disk-virtio", NONE);
    DO_TEST("floppy-drive-fat", NONE);
322 323 324 325 326
    DO_TEST("disk-virtio-queues", QEMU_CAPS_VIRTIO_BLK_NUM_QUEUES);
    DO_TEST("disk-boot-disk", NONE);
    DO_TEST("disk-boot-cdrom", NONE);
    DO_TEST("disk-error-policy", NONE);
    DO_TEST("disk-fmt-qcow", NONE);
327 328 329 330 331
    DO_TEST_CAPS_VER("disk-cache", "1.5.3");
    DO_TEST_CAPS_VER("disk-cache", "2.6.0");
    DO_TEST_CAPS_VER("disk-cache", "2.7.0");
    DO_TEST_CAPS_VER("disk-cache", "2.12.0");
    DO_TEST_CAPS_LATEST("disk-cache");
332
    DO_TEST("disk-network-nbd", NONE);
333
    DO_TEST("disk-network-iscsi", QEMU_CAPS_VIRTIO_SCSI);
334 335 336 337 338 339
    DO_TEST("disk-network-gluster", NONE);
    DO_TEST("disk-network-rbd", NONE);
    DO_TEST("disk-network-source-auth", NONE);
    DO_TEST("disk-network-sheepdog", NONE);
    DO_TEST("disk-network-vxhs", NONE);
    DO_TEST("disk-network-tlsx509", NONE);
340
    DO_TEST("disk-nvme", QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_QCOW2_LUKS);
341 342
    DO_TEST("disk-scsi", QEMU_CAPS_SCSI_LSI, QEMU_CAPS_SCSI_MEGASAS,
            QEMU_CAPS_SCSI_MPTSAS1068, QEMU_CAPS_SCSI_DISK_WWN);
343
    DO_TEST("disk-virtio-scsi-reservations",
344
            QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_PR_MANAGER_HELPER);
345
    DO_TEST("controller-virtio-scsi", QEMU_CAPS_VIRTIO_SCSI);
346 347 348
    DO_TEST("disk-virtio-s390-zpci",
            QEMU_CAPS_DEVICE_ZPCI,
            QEMU_CAPS_CCW);
349
    DO_TEST("disk-mirror-old", NONE);
350
    DO_TEST("disk-mirror", NONE);
351
    DO_TEST("disk-active-commit", NONE);
352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372
    DO_TEST("graphics-listen-network",
            QEMU_CAPS_DEVICE_CIRRUS_VGA,
            QEMU_CAPS_VNC);
    DO_TEST("graphics-vnc",
            QEMU_CAPS_DEVICE_CIRRUS_VGA,
            QEMU_CAPS_VNC);
    DO_TEST("graphics-vnc-websocket",
            QEMU_CAPS_DEVICE_CIRRUS_VGA,
            QEMU_CAPS_VNC);
    DO_TEST("graphics-vnc-sasl",
            QEMU_CAPS_DEVICE_CIRRUS_VGA,
            QEMU_CAPS_VNC);
    DO_TEST("graphics-vnc-tls",
            QEMU_CAPS_DEVICE_CIRRUS_VGA,
            QEMU_CAPS_VNC);
    DO_TEST("graphics-vnc-no-listen-attr",
            QEMU_CAPS_DEVICE_CIRRUS_VGA,
            QEMU_CAPS_VNC);
    DO_TEST("graphics-vnc-remove-generated-socket",
            QEMU_CAPS_DEVICE_CIRRUS_VGA,
            QEMU_CAPS_VNC);
373
    cfg->vncAutoUnixSocket = true;
374 375 376
    DO_TEST("graphics-vnc-auto-socket-cfg",
            QEMU_CAPS_DEVICE_CIRRUS_VGA,
            QEMU_CAPS_VNC);
377
    cfg->vncAutoUnixSocket = false;
378 379 380 381 382 383
    DO_TEST("graphics-vnc-socket",
            QEMU_CAPS_DEVICE_CIRRUS_VGA,
            QEMU_CAPS_VNC);
    DO_TEST("graphics-vnc-auto-socket",
            QEMU_CAPS_DEVICE_CIRRUS_VGA,
            QEMU_CAPS_VNC);
384
    DO_TEST("graphics-vnc-egl-headless",
385 386 387
            QEMU_CAPS_DEVICE_CIRRUS_VGA,
            QEMU_CAPS_EGL_HEADLESS,
            QEMU_CAPS_VNC);
388

389 390 391 392
    DO_TEST_CAPS_ARCH_LATEST("default-video-type-aarch64", "aarch64");
    DO_TEST_CAPS_ARCH_LATEST("default-video-type-ppc64", "ppc64");
    DO_TEST_CAPS_ARCH_LATEST("default-video-type-riscv64", "riscv64");
    DO_TEST_CAPS_ARCH_LATEST("default-video-type-s390x", "s390x");
393 394 395 396 397 398
    DO_TEST("default-video-type-x86_64-caps-test-0",
            QEMU_CAPS_DEVICE_VGA,
            QEMU_CAPS_SPICE);
    DO_TEST("default-video-type-x86_64-caps-test-1",
            QEMU_CAPS_DEVICE_CIRRUS_VGA,
            QEMU_CAPS_SPICE);
399

400 401
    DO_TEST("graphics-sdl", QEMU_CAPS_DEVICE_VGA);
    DO_TEST("graphics-sdl-fullscreen", QEMU_CAPS_DEVICE_CIRRUS_VGA);
402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421

    cfg->spiceTLS = true;
    DO_TEST("graphics-spice",
            QEMU_CAPS_DEVICE_QXL,
            QEMU_CAPS_SPICE,
            QEMU_CAPS_SPICE_FILE_XFER_DISABLE);
    DO_TEST("graphics-spice-compression",
            QEMU_CAPS_DEVICE_QXL,
            QEMU_CAPS_SPICE);
    DO_TEST("graphics-spice-qxl-vga",
            QEMU_CAPS_DEVICE_QXL,
            QEMU_CAPS_SPICE);
    DO_TEST("graphics-spice-socket",
            QEMU_CAPS_DEVICE_CIRRUS_VGA,
            QEMU_CAPS_SPICE,
            QEMU_CAPS_SPICE_UNIX);
    DO_TEST("graphics-spice-auto-socket",
            QEMU_CAPS_DEVICE_CIRRUS_VGA,
            QEMU_CAPS_SPICE,
            QEMU_CAPS_SPICE_UNIX);
422
    cfg->spiceAutoUnixSocket = true;
423 424 425
    DO_TEST("graphics-spice-auto-socket-cfg",
            QEMU_CAPS_DEVICE_CIRRUS_VGA,
            QEMU_CAPS_SPICE);
426
    cfg->spiceAutoUnixSocket = false;
427
    cfg->spiceTLS = false;
428
    DO_TEST("graphics-spice-egl-headless",
429
            QEMU_CAPS_DEVICE_QXL,
430 431
            QEMU_CAPS_EGL_HEADLESS,
            QEMU_CAPS_SPICE);
432

433
    DO_TEST("graphics-egl-headless-rendernode",
434
            QEMU_CAPS_DEVICE_CIRRUS_VGA,
435
            QEMU_CAPS_EGL_HEADLESS,
436 437
            QEMU_CAPS_EGL_HEADLESS_RENDERNODE,
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
438

439 440 441
    DO_TEST("input-usbmouse", NONE);
    DO_TEST("input-usbtablet", NONE);
    DO_TEST("misc-acpi", NONE);
442 443 444 445 446
    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);
447 448 449 450
    DO_TEST("misc-no-reboot", NONE);
    DO_TEST("misc-uuid", NONE);
    DO_TEST("net-vhostuser", NONE);
    DO_TEST("net-user", NONE);
J
Ján Tomko 已提交
451
    DO_TEST("net-user-addr", NONE);
452 453 454 455 456 457
    DO_TEST("net-virtio", NONE);
    DO_TEST("net-virtio-device", NONE);
    DO_TEST("net-virtio-disable-offloads", NONE);
    DO_TEST("net-eth", NONE);
    DO_TEST("net-eth-ifname", NONE);
    DO_TEST("net-eth-hostip", NONE);
458
    DO_TEST("net-eth-unmanaged-tap", NONE);
459
    DO_TEST("net-virtio-network-portgroup", NONE);
460
    DO_TEST("net-virtio-rxtxqueuesize", NONE);
461 462 463 464 465 466
    DO_TEST("net-virtio-teaming",
            QEMU_CAPS_VIRTIO_NET_FAILOVER,
            QEMU_CAPS_DEVICE_VFIO_PCI);
    DO_TEST("net-virtio-teaming-network",
            QEMU_CAPS_VIRTIO_NET_FAILOVER,
            QEMU_CAPS_DEVICE_VFIO_PCI);
467
    DO_TEST_CAPS_LATEST("net-isolated-port");
468
    DO_TEST("net-hostdev", NONE);
469
    DO_TEST("net-hostdev-bootorder", NONE);
470
    DO_TEST("net-hostdev-vfio", QEMU_CAPS_DEVICE_VFIO_PCI);
471 472 473
    DO_TEST("net-midonet", NONE);
    DO_TEST("net-openvswitch", NONE);
    DO_TEST("sound", NONE);
474 475
    DO_TEST("sound-device",
            QEMU_CAPS_DEVICE_ICH9_INTEL_HDA,
476 477 478 479
            QEMU_CAPS_OBJECT_USB_AUDIO,
            QEMU_CAPS_HDA_MICRO,
            QEMU_CAPS_HDA_DUPLEX,
            QEMU_CAPS_HDA_OUTPUT);
480
    DO_TEST("watchdog", NONE);
481 482
    DO_TEST("net-bandwidth", QEMU_CAPS_DEVICE_VGA, QEMU_CAPS_VNC);
    DO_TEST("net-bandwidth2", QEMU_CAPS_DEVICE_VGA, QEMU_CAPS_VNC);
483
    DO_TEST("net-mtu", NONE);
484
    DO_TEST("net-coalesce", NONE);
485
    DO_TEST("net-many-models", NONE);
486

487
    DO_TEST("serial-tcp-tlsx509-chardev", NONE);
488
    DO_TEST("serial-tcp-tlsx509-chardev-notls", NONE);
489 490 491 492 493 494 495

    cfg->spiceTLS = true;
    DO_TEST("serial-spiceport",
            QEMU_CAPS_DEVICE_QXL,
            QEMU_CAPS_SPICE);
    cfg->spiceTLS = false;

496 497 498 499 500 501 502 503
    DO_TEST("serial-spiceport-nospice", NONE);
    DO_TEST("console-compat", NONE);
    DO_TEST("console-compat2", NONE);
    DO_TEST("console-virtio-many", NONE);
    DO_TEST("channel-guestfwd", NONE);
    DO_TEST("channel-virtio", NONE);
    DO_TEST("channel-virtio-state", NONE);

504
    DO_TEST("channel-unix-source-path", NONE);
505

506 507
    DO_TEST("hostdev-usb-address", NONE);
    DO_TEST("hostdev-pci-address", NONE);
508
    DO_TEST("hostdev-pci-address-unassigned", QEMU_CAPS_DEVICE_VFIO_PCI);
509 510
    DO_TEST("hostdev-pci-multifunction", QEMU_CAPS_DEVICE_VFIO_PCI);
    DO_TEST("hostdev-vfio", QEMU_CAPS_DEVICE_VFIO_PCI);
511
    DO_TEST("hostdev-vfio-zpci",
512
            QEMU_CAPS_DEVICE_VFIO_PCI,
513 514
            QEMU_CAPS_DEVICE_ZPCI,
            QEMU_CAPS_CCW);
515 516 517 518 519 520 521 522 523 524 525
    DO_TEST("hostdev-vfio-zpci-multidomain-many",
            QEMU_CAPS_DEVICE_VFIO_PCI,
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_ZPCI);
    DO_TEST("hostdev-vfio-zpci-autogenerate",
            QEMU_CAPS_DEVICE_VFIO_PCI,
            QEMU_CAPS_DEVICE_ZPCI);
    DO_TEST("hostdev-vfio-zpci-boundaries",
            QEMU_CAPS_DEVICE_VFIO_PCI,
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_ZPCI);
526
    DO_TEST("hostdev-mdev-precreated", QEMU_CAPS_DEVICE_VFIO_PCI);
527 528
    DO_TEST("hostdev-mdev-display",
            QEMU_CAPS_DEVICE_QXL,
529
            QEMU_CAPS_VFIO_PCI_DISPLAY,
530 531
            QEMU_CAPS_DEVICE_VFIO_PCI,
            QEMU_CAPS_VNC);
532
    DO_TEST("pci-rom", NONE);
533
    DO_TEST("pci-rom-disabled", NONE);
534
    DO_TEST("pci-rom-disabled-invalid", NONE);
535 536
    DO_TEST("pci-serial-dev-chardev", NONE);

537 538
    DO_TEST_CAPS_LATEST("disk-slices");

539 540
    DO_TEST("encrypted-disk", QEMU_CAPS_QCOW2_LUKS);
    DO_TEST("encrypted-disk-usage", QEMU_CAPS_QCOW2_LUKS);
541
    DO_TEST("luks-disks", NONE);
542
    DO_TEST("luks-disks-source", NONE);
543
    DO_TEST_CAPS_LATEST("luks-disks-source-qcow2");
544 545 546 547 548 549 550 551 552
    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("cputune-iothreadsched", NONE);
    DO_TEST("cputune-iothreadsched-zeropriority", NONE);
    DO_TEST("cputune-numatune", NONE);
553
    DO_TEST("vcpu-placement-static",
554 555
            QEMU_CAPS_KVM,
            QEMU_CAPS_OBJECT_IOTHREAD);
556

557 558 559 560 561 562
    DO_TEST("smp", NONE);
    DO_TEST("iothreads", NONE);
    DO_TEST("iothreads-ids", NONE);
    DO_TEST("iothreads-ids-partial", NONE);
    DO_TEST("cputune-iothreads", NONE);
    DO_TEST("iothreads-disk", NONE);
563
    DO_TEST("iothreads-disk-virtio-ccw",
564
            QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
565
    DO_TEST("iothreads-virtio-scsi-pci",
566
            QEMU_CAPS_VIRTIO_SCSI);
567
    DO_TEST("iothreads-virtio-scsi-ccw",
568
            QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_CCW,
569
            QEMU_CAPS_VIRTIO_S390);
570 571 572 573
    DO_TEST("lease", NONE);
    DO_TEST("event_idx", NONE);
    DO_TEST("vhost_queues", NONE);
    DO_TEST("interface-driver", NONE);
574
    DO_TEST("interface-server", QEMU_CAPS_DEVICE_CIRRUS_VGA,
575 576
            QEMU_CAPS_OBJECT_MEMORY_FILE,
            QEMU_CAPS_PIIX_DISABLE_S3,
577 578
            QEMU_CAPS_PIIX_DISABLE_S4,
            QEMU_CAPS_VNC);
579 580
    DO_TEST("virtio-lun", NONE);

581 582 583 584 585
    DO_TEST("usb-none", NONE);
    DO_TEST("usb-controller", NONE);
    DO_TEST("usb-piix3-controller",
            QEMU_CAPS_PIIX3_USB_UHCI);
    DO_TEST("usb-controller-default-q35",
586
            QEMU_CAPS_DEVICE_IOH3420,
587 588
            QEMU_CAPS_PCI_OHCI,
            QEMU_CAPS_PIIX3_USB_UHCI,
589 590
            QEMU_CAPS_NEC_USB_XHCI);
    DO_TEST("usb-controller-explicit-q35",
591
            QEMU_CAPS_DEVICE_IOH3420,
592 593
            QEMU_CAPS_PCI_OHCI,
            QEMU_CAPS_PIIX3_USB_UHCI,
594 595
            QEMU_CAPS_NEC_USB_XHCI);
    DO_TEST("ppc64-usb-controller",
596
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
597 598
            QEMU_CAPS_PCI_OHCI);
    DO_TEST("ppc64-usb-controller-legacy",
599
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
600
            QEMU_CAPS_PIIX3_USB_UHCI);
601
    DO_TEST("usb-port-missing", QEMU_CAPS_USB_HUB);
602 603 604 605
    DO_TEST("usb-redir", NONE);
    DO_TEST("usb-redir-filter", NONE);
    DO_TEST("usb-redir-filter-version", NONE);
    DO_TEST("blkdeviotune", NONE);
606
    DO_TEST("blkdeviotune-max", NONE);
607
    DO_TEST("blkdeviotune-group-num", NONE);
608
    DO_TEST("blkdeviotune-max-length", NONE);
609 610 611
    DO_TEST("controller-usb-order",
            QEMU_CAPS_PIIX_DISABLE_S3,
            QEMU_CAPS_PIIX_DISABLE_S4);
612

613 614 615 616 617 618 619 620
    DO_TEST_FULL("seclabel-dynamic-baselabel", WHEN_INACTIVE,
                 ARG_QEMU_CAPS, NONE);
    DO_TEST_FULL("seclabel-dynamic-override", WHEN_INACTIVE,
                 ARG_QEMU_CAPS, NONE);
    DO_TEST_FULL("seclabel-dynamic-labelskip", WHEN_INACTIVE,
                 ARG_QEMU_CAPS, NONE);
    DO_TEST_FULL("seclabel-dynamic-relabel", WHEN_INACTIVE,
                 ARG_QEMU_CAPS, NONE);
621
    DO_TEST("seclabel-static", NONE);
622
    DO_TEST("seclabel-static-labelskip", NONE);
623 624 625 626
    DO_TEST("seclabel-none", NONE);
    DO_TEST("seclabel-dac-none", NONE);
    DO_TEST("seclabel-dynamic-none", NONE);
    DO_TEST("seclabel-device-multiple", NONE);
627
    DO_TEST_FULL("seclabel-dynamic-none-relabel", WHEN_INACTIVE,
628
                 ARG_QEMU_CAPS, QEMU_CAPS_DEVICE_CIRRUS_VGA,
629 630
                 QEMU_CAPS_OBJECT_MEMORY_FILE,
                 QEMU_CAPS_SPICE, NONE);
631
    DO_TEST("numad-static-vcpu-no-numatune", NONE);
632

633
    DO_TEST("disk-scsi-lun-passthrough-sgio",
634
            QEMU_CAPS_SCSI_LSI, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_DISK_WWN);
635
    DO_TEST("disk-scsi-disk-vpd",
636
            QEMU_CAPS_SCSI_LSI, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_DISK_WWN);
637 638
    DO_TEST("disk-source-pool", NONE);
    DO_TEST("disk-source-pool-mode", NONE);
639

640 641
    DO_TEST("disk-discard", NONE);
    DO_TEST("disk-detect-zeroes", NONE);
O
Osier Yang 已提交
642

643 644
    DO_TEST("disk-serial", NONE);

645 646 647 648
    DO_TEST("virtio-rng-random",
            QEMU_CAPS_DEVICE_VIRTIO_RNG);
    DO_TEST("virtio-rng-egd",
            QEMU_CAPS_DEVICE_VIRTIO_RNG);
H
Han Han 已提交
649
    DO_TEST_CAPS_LATEST("virtio-rng-builtin");
650

651
    DO_TEST("pseries-nvram",
652 653
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
            QEMU_CAPS_DEVICE_NVRAM);
654 655 656 657
    DO_TEST("pseries-panic-missing",
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE);
    DO_TEST("pseries-panic-no-address",
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE);
658

659 660 661 662
    DO_TEST("pseries-phb-simple",
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE);
    DO_TEST("pseries-phb-default-missing",
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE);
663 664 665
    DO_TEST("pseries-phb-numa-node",
            QEMU_CAPS_NUMA,
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
666 667
            QEMU_CAPS_SPAPR_PCI_HOST_BRIDGE_NUMA_NODE,
            QEMU_CAPS_OBJECT_MEMORY_FILE);
668

669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690
    DO_TEST("pseries-many-devices",
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
            QEMU_CAPS_VIRTIO_SCSI);
    DO_TEST("pseries-many-buses-1",
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
            QEMU_CAPS_VIRTIO_SCSI);
    DO_TEST("pseries-many-buses-2",
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
            QEMU_CAPS_VIRTIO_SCSI);
    DO_TEST("pseries-hostdevs-1",
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_DEVICE_VFIO_PCI);
    DO_TEST("pseries-hostdevs-2",
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_DEVICE_VFIO_PCI);
    DO_TEST("pseries-hostdevs-3",
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_DEVICE_VFIO_PCI);

691
    DO_TEST("pseries-features",
692
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
693
            QEMU_CAPS_MACHINE_PSERIES_CAP_HPT_MAX_PAGE_SIZE,
694
            QEMU_CAPS_MACHINE_PSERIES_CAP_HTM,
695
            QEMU_CAPS_MACHINE_PSERIES_CAP_NESTED_HV,
696
            QEMU_CAPS_MACHINE_PSERIES_CAP_CCF_ASSIST,
697 698
            QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT);

699
    DO_TEST("pseries-serial-native",
700
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
701 702
            QEMU_CAPS_DEVICE_SPAPR_VTY);
    DO_TEST("pseries-serial+console-native",
703
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
704 705
            QEMU_CAPS_DEVICE_SPAPR_VTY);
    DO_TEST("pseries-serial-compat",
706
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
707
            QEMU_CAPS_DEVICE_SPAPR_VTY);
708
    DO_TEST("pseries-serial-pci",
709
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
710 711
            QEMU_CAPS_DEVICE_PCI_SERIAL);
    DO_TEST("pseries-serial-usb",
712
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
713 714
            QEMU_CAPS_DEVICE_QEMU_XHCI,
            QEMU_CAPS_DEVICE_USB_SERIAL);
715
    DO_TEST("pseries-console-native",
716
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
717 718
            QEMU_CAPS_DEVICE_SPAPR_VTY);
    DO_TEST("pseries-console-virtio",
719 720 721 722 723
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE);

    DO_TEST("mach-virt-serial-native", NONE);
    DO_TEST("mach-virt-serial+console-native", NONE);
    DO_TEST("mach-virt-serial-compat", NONE);
724 725 726 727 728 729 730 731 732 733 734
    DO_TEST("mach-virt-serial-pci",
            QEMU_CAPS_OBJECT_GPEX,
            QEMU_CAPS_DEVICE_PCIE_ROOT_PORT,
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_PCI_SERIAL);
    DO_TEST("mach-virt-serial-usb",
            QEMU_CAPS_OBJECT_GPEX,
            QEMU_CAPS_DEVICE_PCIE_ROOT_PORT,
            QEMU_CAPS_DEVICE_QEMU_XHCI,
            QEMU_CAPS_DEVICE_USB_SERIAL);
735 736 737 738
    DO_TEST("mach-virt-console-native",
            QEMU_CAPS_DEVICE_PL011);
    DO_TEST("mach-virt-console-virtio",
            QEMU_CAPS_DEVICE_VIRTIO_MMIO);
739

740 741 742 743
    DO_TEST("balloon-device-auto", NONE);
    DO_TEST("balloon-device-period", NONE);
    DO_TEST("channel-virtio-auto", NONE);
    DO_TEST("console-compat-auto", NONE);
744
    DO_TEST("disk-scsi-device-auto",
745
            QEMU_CAPS_SCSI_LSI);
746 747
    DO_TEST("console-virtio", NONE);
    DO_TEST("serial-target-port-auto", NONE);
748 749 750
    DO_TEST("graphics-listen-network2",
            QEMU_CAPS_DEVICE_CIRRUS_VGA,
            QEMU_CAPS_VNC);
751 752 753
    DO_TEST("graphics-spice-timeout",
            QEMU_CAPS_DEVICE_VGA,
            QEMU_CAPS_SPICE);
754 755 756 757 758
    DO_TEST("numad-auto-vcpu-no-numatune", NONE);
    DO_TEST("numad-auto-memory-vcpu-no-cpuset-and-placement", NONE);
    DO_TEST("numad-auto-memory-vcpu-cpuset", NONE);
    DO_TEST("usb-ich9-ehci-addr", NONE);
    DO_TEST("disk-copy_on_read", NONE);
759 760 761 762 763
    DO_TEST_CAPS_LATEST("tpm-passthrough");
    DO_TEST_CAPS_LATEST("tpm-passthrough-crb");
    DO_TEST_CAPS_LATEST("tpm-emulator");
    DO_TEST_CAPS_LATEST("tpm-emulator-tpm2");
    DO_TEST_CAPS_LATEST("tpm-emulator-tpm2-enc");
764 765 766

    DO_TEST("metadata", NONE);
    DO_TEST("metadata-duplicate", NONE);
767

768
    DO_TEST("pci-bridge",
769 770 771 772 773
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
            QEMU_CAPS_VNC,
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
    DO_TEST("pci-many",
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
774 775 776
    DO_TEST("pci-bridge-many-disks",
            QEMU_CAPS_DEVICE_PCI_BRIDGE);
    DO_TEST("pci-autoadd-addr",
777 778
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
779
    DO_TEST("pci-autoadd-idx",
780 781
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_CIRRUS_VGA);
782
    DO_TEST("pci-autofill-addr", QEMU_CAPS_DEVICE_CIRRUS_VGA);
783

784
    DO_TEST("q35",
785 786
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
787
            QEMU_CAPS_DEVICE_IOH3420,
788 789 790
            QEMU_CAPS_ICH9_AHCI,
            QEMU_CAPS_ICH9_USB_EHCI1,
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
791
            QEMU_CAPS_DEVICE_QXL);
792 793 794
    DO_TEST("q35-usb2",
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
795
            QEMU_CAPS_DEVICE_IOH3420,
796
            QEMU_CAPS_ICH9_AHCI,
797
            QEMU_CAPS_ICH9_USB_EHCI1,
798
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
799
            QEMU_CAPS_DEVICE_QXL);
800
    DO_TEST("q35-usb2-multi",
801 802
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
803
            QEMU_CAPS_DEVICE_IOH3420,
804 805 806
            QEMU_CAPS_ICH9_AHCI,
            QEMU_CAPS_ICH9_USB_EHCI1,
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
807
            QEMU_CAPS_DEVICE_QXL);
808
    DO_TEST("q35-usb2-reorder",
809 810
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
811
            QEMU_CAPS_DEVICE_IOH3420,
812 813 814
            QEMU_CAPS_ICH9_AHCI,
            QEMU_CAPS_ICH9_USB_EHCI1,
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
815
            QEMU_CAPS_DEVICE_QXL);
816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832
    DO_TEST("q35-pcie",
            QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY,
            QEMU_CAPS_DEVICE_VIRTIO_RNG,
            QEMU_CAPS_OBJECT_RNG_RANDOM,
            QEMU_CAPS_DEVICE_VIRTIO_NET,
            QEMU_CAPS_DEVICE_VIRTIO_GPU,
            QEMU_CAPS_VIRTIO_GPU_VIRGL,
            QEMU_CAPS_VIRTIO_KEYBOARD,
            QEMU_CAPS_VIRTIO_MOUSE,
            QEMU_CAPS_VIRTIO_TABLET,
            QEMU_CAPS_VIRTIO_INPUT_HOST,
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_IOH3420,
            QEMU_CAPS_ICH9_AHCI,
            QEMU_CAPS_ICH9_USB_EHCI1,
833
            QEMU_CAPS_NEC_USB_XHCI,
834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
    /* same XML as q35-pcie, but don't set
       QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY */
    DO_TEST("q35-virtio-pci",
            QEMU_CAPS_DEVICE_VIRTIO_RNG,
            QEMU_CAPS_OBJECT_RNG_RANDOM,
            QEMU_CAPS_DEVICE_VIRTIO_NET,
            QEMU_CAPS_DEVICE_VIRTIO_GPU,
            QEMU_CAPS_VIRTIO_GPU_VIRGL,
            QEMU_CAPS_VIRTIO_KEYBOARD,
            QEMU_CAPS_VIRTIO_MOUSE,
            QEMU_CAPS_VIRTIO_TABLET,
            QEMU_CAPS_VIRTIO_INPUT_HOST,
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_IOH3420,
            QEMU_CAPS_ICH9_AHCI,
            QEMU_CAPS_ICH9_USB_EHCI1,
853
            QEMU_CAPS_NEC_USB_XHCI,
854
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
855 856 857 858 859 860 861 862 863
    /* same as q35-pcie, but all PCI controllers are added automatically */
    DO_TEST("q35-pcie-autoadd",
            QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY,
            QEMU_CAPS_DEVICE_VIRTIO_RNG,
            QEMU_CAPS_OBJECT_RNG_RANDOM,
            QEMU_CAPS_DEVICE_VIRTIO_NET,
            QEMU_CAPS_DEVICE_VIRTIO_GPU,
            QEMU_CAPS_VIRTIO_GPU_VIRGL,
            QEMU_CAPS_VIRTIO_KEYBOARD,
864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882
            QEMU_CAPS_VIRTIO_MOUSE,
            QEMU_CAPS_VIRTIO_TABLET,
            QEMU_CAPS_VIRTIO_INPUT_HOST,
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_IOH3420,
            QEMU_CAPS_ICH9_AHCI,
            QEMU_CAPS_ICH9_USB_EHCI1,
            QEMU_CAPS_NEC_USB_XHCI,
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
    DO_TEST("q35-default-devices-only",
            QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY,
            QEMU_CAPS_DEVICE_VIRTIO_RNG,
            QEMU_CAPS_OBJECT_RNG_RANDOM,
            QEMU_CAPS_DEVICE_VIRTIO_NET,
            QEMU_CAPS_DEVICE_VIRTIO_GPU,
            QEMU_CAPS_VIRTIO_GPU_VIRGL,
            QEMU_CAPS_VIRTIO_KEYBOARD,
883 884 885 886 887 888 889 890 891 892
            QEMU_CAPS_VIRTIO_MOUSE,
            QEMU_CAPS_VIRTIO_TABLET,
            QEMU_CAPS_VIRTIO_INPUT_HOST,
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_IOH3420,
            QEMU_CAPS_ICH9_AHCI,
            QEMU_CAPS_ICH9_USB_EHCI1,
            QEMU_CAPS_NEC_USB_XHCI,
893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911
            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_DEVICE_VIRTIO_NET,
            QEMU_CAPS_DEVICE_VIRTIO_GPU,
            QEMU_CAPS_VIRTIO_GPU_VIRGL,
            QEMU_CAPS_VIRTIO_KEYBOARD,
            QEMU_CAPS_VIRTIO_MOUSE,
            QEMU_CAPS_VIRTIO_TABLET,
            QEMU_CAPS_VIRTIO_INPUT_HOST,
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_IOH3420,
            QEMU_CAPS_ICH9_AHCI,
            QEMU_CAPS_ICH9_USB_EHCI1,
            QEMU_CAPS_NEC_USB_XHCI,
912
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
913
    DO_TEST("q35-virt-manager-basic",
914 915 916
            QEMU_CAPS_KVM,
            QEMU_CAPS_ICH9_DISABLE_S3,
            QEMU_CAPS_ICH9_DISABLE_S4,
917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934
            QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY,
            QEMU_CAPS_DEVICE_VIRTIO_RNG,
            QEMU_CAPS_OBJECT_RNG_RANDOM,
            QEMU_CAPS_DEVICE_VIRTIO_NET,
            QEMU_CAPS_DEVICE_VIRTIO_GPU,
            QEMU_CAPS_VIRTIO_GPU_VIRGL,
            QEMU_CAPS_VIRTIO_KEYBOARD,
            QEMU_CAPS_VIRTIO_MOUSE,
            QEMU_CAPS_VIRTIO_TABLET,
            QEMU_CAPS_VIRTIO_INPUT_HOST,
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_IOH3420,
            QEMU_CAPS_ICH9_AHCI,
            QEMU_CAPS_ICH9_USB_EHCI1,
            QEMU_CAPS_NEC_USB_XHCI,
            QEMU_CAPS_DEVICE_ICH9_INTEL_HDA,
935 936 937 938
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
            QEMU_CAPS_SPICE,
            QEMU_CAPS_DEVICE_QXL,
            QEMU_CAPS_HDA_DUPLEX,
939 940
            QEMU_CAPS_USB_REDIR,
            QEMU_CAPS_MACHINE_VMPORT_OPT);
941
    DO_TEST("pcie-root",
942 943
            QEMU_CAPS_DEVICE_IOH3420,
            QEMU_CAPS_ICH9_AHCI,
944
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
945
            QEMU_CAPS_DEVICE_QXL);
946 947

    /* Test automatic and manual setting of pcie-root-port attributes */
948
    DO_TEST("pcie-root-port",
949 950
            QEMU_CAPS_DEVICE_IOH3420,
            QEMU_CAPS_ICH9_AHCI,
951
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
952
            QEMU_CAPS_DEVICE_QXL);
953 954 955 956 957 958

    /* 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,
959
            QEMU_CAPS_DEVICE_IOH3420);
960
    DO_TEST("pcie-root-port-model-ioh3420",
961
            QEMU_CAPS_DEVICE_IOH3420);
962

963
    DO_TEST("pcie-switch-upstream-port",
964 965 966
            QEMU_CAPS_DEVICE_IOH3420,
            QEMU_CAPS_DEVICE_X3130_UPSTREAM,
            QEMU_CAPS_ICH9_AHCI,
967
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
968
            QEMU_CAPS_DEVICE_QXL);
969
    DO_TEST("pcie-switch-downstream-port",
970 971 972 973
            QEMU_CAPS_DEVICE_IOH3420,
            QEMU_CAPS_DEVICE_X3130_UPSTREAM,
            QEMU_CAPS_DEVICE_XIO3130_DOWNSTREAM,
            QEMU_CAPS_ICH9_AHCI,
974
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
975
            QEMU_CAPS_DEVICE_QXL);
976
    DO_TEST("pci-expander-bus",
977
            QEMU_CAPS_DEVICE_PXB);
978
    DO_TEST("pcie-expander-bus",
979 980 981 982
            QEMU_CAPS_DEVICE_IOH3420,
            QEMU_CAPS_DEVICE_X3130_UPSTREAM,
            QEMU_CAPS_DEVICE_XIO3130_DOWNSTREAM,
            QEMU_CAPS_DEVICE_PXB_PCIE);
983
    DO_TEST("autoindex",
984 985 986 987 988 989 990
            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,
            QEMU_CAPS_ICH9_USB_EHCI1,
991
            QEMU_CAPS_NEC_USB_XHCI);
992 993 994 995 996 997 998
    /* 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);
999

1000 1001
    DO_TEST("hostdev-scsi-vhost-scsi-ccw",
            QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE_VHOST_SCSI,
1002
            QEMU_CAPS_CCW);
1003
    DO_TEST("hostdev-scsi-vhost-scsi-pci",
1004 1005
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_DEVICE_VHOST_SCSI);
1006 1007 1008 1009 1010
    DO_TEST("hostdev-scsi-vhost-scsi-pcie",
            QEMU_CAPS_KVM,
            QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE_VHOST_SCSI,
            QEMU_CAPS_DEVICE_PCIE_ROOT_PORT,
            QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY);
1011
    DO_TEST("hostdev-scsi-lsi",
1012 1013
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_SCSI_LSI);
1014
    DO_TEST("hostdev-scsi-virtio-scsi",
1015 1016
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_SCSI_LSI);
1017
    DO_TEST("hostdev-scsi-readonly",
1018 1019
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_SCSI_LSI);
1020 1021

    DO_TEST("hostdev-scsi-shareable",
1022 1023
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_SCSI_LSI);
1024
    DO_TEST("hostdev-scsi-sgio",
1025 1026
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_SCSI_LSI);
1027
    DO_TEST("hostdev-scsi-rawio",
1028 1029
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_SCSI_LSI);
1030 1031

    DO_TEST("hostdev-scsi-autogen-address",
1032 1033
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_SCSI_LSI);
1034
    DO_TEST("hostdev-scsi-large-unit",
1035 1036
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_SCSI_LSI);
1037 1038

    DO_TEST("hostdev-scsi-lsi-iscsi",
1039 1040
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_SCSI_LSI);
1041
    DO_TEST("hostdev-scsi-lsi-iscsi-auth",
1042 1043
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_SCSI_LSI);
1044
    DO_TEST("hostdev-scsi-virtio-iscsi",
1045 1046
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_SCSI_LSI);
1047
    DO_TEST("hostdev-scsi-virtio-iscsi-auth",
1048 1049
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_SCSI_LSI);
1050

1051 1052 1053 1054
    DO_TEST("hostdev-subsys-mdev-vfio-ccw",
            QEMU_CAPS_CCW,
            QEMU_CAPS_CCW_CSSID_UNRESTRICTED,
            QEMU_CAPS_DEVICE_VFIO_CCW);
1055 1056
    DO_TEST_CAPS_ARCH_LATEST("hostdev-subsys-mdev-vfio-ccw-boot",
                             "s390x");
B
Boris Fiuczynski 已提交
1057 1058 1059 1060
    DO_TEST("hostdev-subsys-mdev-vfio-ap",
            QEMU_CAPS_CCW,
            QEMU_CAPS_CCW_CSSID_UNRESTRICTED,
            QEMU_CAPS_DEVICE_VFIO_AP);
1061

1062
    DO_TEST("s390-defaultconsole",
1063
            QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
1064
    DO_TEST("s390-panic",
1065
            QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
1066
    DO_TEST("s390-panic-missing",
1067
            QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
1068
    DO_TEST("s390-panic-no-address",
1069
            QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
1070
    DO_TEST("s390-serial",
1071
            QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
1072
    DO_TEST("s390-serial-2",
1073
            QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
1074
    DO_TEST("s390-serial-console",
1075
            QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
1076

1077 1078 1079
    DO_TEST("pcihole64", QEMU_CAPS_I440FX_PCI_HOLE64_SIZE);
    DO_TEST("pcihole64-gib", QEMU_CAPS_I440FX_PCI_HOLE64_SIZE);
    DO_TEST("pcihole64-none", QEMU_CAPS_I440FX_PCI_HOLE64_SIZE);
1080
    DO_TEST("pcihole64-q35",
1081
            QEMU_CAPS_DEVICE_IOH3420,
1082 1083
            QEMU_CAPS_ICH9_AHCI,
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
1084
            QEMU_CAPS_DEVICE_QXL,
1085
            QEMU_CAPS_Q35_PCI_HOLE64_SIZE);
1086

1087 1088
    DO_TEST("panic", NONE);
    DO_TEST("panic-isa", NONE);
1089 1090
    DO_TEST("panic-pseries",
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE);
1091 1092
    DO_TEST("panic-double", NONE);
    DO_TEST("panic-no-address", NONE);
H
Hu Tao 已提交
1093

1094
    DO_TEST("disk-backing-chains", NONE);
1095 1096
    DO_TEST("disk-backing-chains-index", NONE);
    DO_TEST("disk-backing-chains-noindex", NONE);
1097

1098 1099
    DO_TEST("chardev-label",
            QEMU_CAPS_DEVICE_VIRTIO_RNG);
J
Ján Tomko 已提交
1100

1101 1102 1103 1104
    DO_TEST("cpu-numa1", NONE);
    DO_TEST("cpu-numa2", NONE);
    DO_TEST("cpu-numa-no-memory-element", NONE);
    DO_TEST("cpu-numa-disordered", NONE);
1105 1106
    DO_TEST("cpu-numa-disjoint", QEMU_CAPS_NUMA);
    DO_TEST("cpu-numa-memshared", QEMU_CAPS_OBJECT_MEMORY_FILE);
1107

1108
    DO_TEST("numatune-auto-prefer", NONE);
1109 1110
    DO_TEST("numatune-memnode", QEMU_CAPS_NUMA, QEMU_CAPS_OBJECT_MEMORY_FILE);
    DO_TEST("numatune-memnode-no-memory", QEMU_CAPS_OBJECT_MEMORY_FILE);
1111

1112 1113
    DO_TEST("bios-nvram", NONE);
    DO_TEST("bios-nvram-os-interleave", NONE);
1114

1115 1116 1117
    DO_TEST("tap-vhost", NONE);
    DO_TEST("tap-vhost-incorrect", NONE);
    DO_TEST("shmem", NONE);
1118
    DO_TEST("shmem-plain-doorbell", NONE);
1119 1120
    DO_TEST("smbios", NONE);
    DO_TEST("smbios-multiple-type2", NONE);
1121

1122 1123 1124
    DO_TEST_CAPS_LATEST("os-firmware-bios");
    DO_TEST_CAPS_LATEST("os-firmware-efi");
    DO_TEST_CAPS_LATEST("os-firmware-efi-secboot");
1125

1126
    DO_TEST("aarch64-aavmf-virtio-mmio",
1127 1128
            QEMU_CAPS_DEVICE_VIRTIO_MMIO,
            QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM);
1129
    DO_TEST_CAPS_ARCH_LATEST("aarch64-os-firmware-efi", "aarch64");
1130
    DO_TEST("aarch64-virtio-pci-default",
1131
            QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY,
1132 1133 1134
            QEMU_CAPS_DEVICE_VIRTIO_MMIO,
            QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM,
            QEMU_CAPS_OBJECT_GPEX, QEMU_CAPS_DEVICE_PCI_BRIDGE,
1135 1136 1137
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_IOH3420,
            QEMU_CAPS_VIRTIO_SCSI);
1138
    DO_TEST("aarch64-virtio-pci-manual-addresses",
1139 1140 1141
            QEMU_CAPS_DEVICE_VIRTIO_MMIO,
            QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM,
            QEMU_CAPS_OBJECT_GPEX, QEMU_CAPS_DEVICE_PCI_BRIDGE,
1142 1143 1144
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_IOH3420,
            QEMU_CAPS_VIRTIO_SCSI);
1145
    DO_TEST("aarch64-video-virtio-gpu-pci",
1146
            QEMU_CAPS_OBJECT_GPEX,
1147
            QEMU_CAPS_DEVICE_PCI_BRIDGE, QEMU_CAPS_DEVICE_IOH3420,
1148
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
1149
            QEMU_CAPS_DEVICE_VIRTIO_GPU);
1150 1151 1152 1153 1154 1155 1156
    DO_TEST("aarch64-pci-serial",
            QEMU_CAPS_DEVICE_PCI_SERIAL,
            QEMU_CAPS_CHARDEV_LOGFILE,
            QEMU_CAPS_OBJECT_GPEX,
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_PCIE_ROOT_PORT);
1157 1158 1159 1160
    DO_TEST("aarch64-traditional-pci",
            QEMU_CAPS_OBJECT_GPEX,
            QEMU_CAPS_DEVICE_PCIE_ROOT_PORT,
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
1161
            QEMU_CAPS_DEVICE_PCIE_PCI_BRIDGE,
1162 1163
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_PCI_SERIAL);
1164 1165 1166 1167 1168 1169 1170 1171
    DO_TEST("aarch64-video-default",
            QEMU_CAPS_OBJECT_GPEX,
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_IOH3420,
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
            QEMU_CAPS_DEVICE_VIRTIO_GPU,
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
            QEMU_CAPS_VNC);
1172

1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235
    DO_TEST_FULL("aarch64-gic-none", WHEN_BOTH,
                 ARG_GIC, GIC_NONE,
                 ARG_QEMU_CAPS, NONE);
    DO_TEST_FULL("aarch64-gic-none-v2", WHEN_BOTH,
                 ARG_GIC, GIC_V2,
                 ARG_QEMU_CAPS, NONE);
    DO_TEST_FULL("aarch64-gic-none-v3", WHEN_BOTH,
                 ARG_GIC, GIC_V3,
                 ARG_QEMU_CAPS, NONE);
    DO_TEST_FULL("aarch64-gic-none-both", WHEN_BOTH,
                 ARG_GIC, GIC_BOTH,
                 ARG_QEMU_CAPS, NONE);
    DO_TEST_FULL("aarch64-gic-none-tcg", WHEN_BOTH,
                 ARG_GIC, GIC_BOTH,
                 ARG_QEMU_CAPS, NONE);
    DO_TEST_FULL("aarch64-gic-default", WHEN_BOTH,
                 ARG_GIC, GIC_NONE,
                 ARG_QEMU_CAPS, NONE);
    DO_TEST_FULL("aarch64-gic-default-v2", WHEN_BOTH,
                 ARG_GIC, GIC_V2,
                 ARG_QEMU_CAPS, NONE);
    DO_TEST_FULL("aarch64-gic-default-v3", WHEN_BOTH,
                 ARG_GIC, GIC_V3,
                 ARG_QEMU_CAPS, NONE);
    DO_TEST_FULL("aarch64-gic-default-both", WHEN_BOTH,
                 ARG_GIC, GIC_BOTH,
                 ARG_QEMU_CAPS, NONE);
    DO_TEST_FULL("aarch64-gic-v2", WHEN_BOTH,
                 ARG_GIC, GIC_NONE,
                 ARG_QEMU_CAPS, NONE);
    DO_TEST_FULL("aarch64-gic-v2", WHEN_BOTH,
                 ARG_GIC, GIC_V2,
                 ARG_QEMU_CAPS, NONE);
    DO_TEST_FULL("aarch64-gic-v2", WHEN_BOTH,
                 ARG_GIC, GIC_V3,
                 ARG_QEMU_CAPS, NONE);
    DO_TEST_FULL("aarch64-gic-v2", WHEN_BOTH,
                 ARG_GIC, GIC_BOTH,
                 ARG_QEMU_CAPS, NONE);
    DO_TEST_FULL("aarch64-gic-v3", WHEN_BOTH,
                 ARG_GIC, GIC_NONE,
                 ARG_QEMU_CAPS, NONE);
    DO_TEST_FULL("aarch64-gic-v3", WHEN_BOTH,
                 ARG_GIC, GIC_V2,
                 ARG_QEMU_CAPS, NONE);
    DO_TEST_FULL("aarch64-gic-v3", WHEN_BOTH,
                 ARG_GIC, GIC_V3,
                 ARG_QEMU_CAPS, NONE);
    DO_TEST_FULL("aarch64-gic-v3", WHEN_BOTH,
                 ARG_GIC, GIC_BOTH,
                 ARG_QEMU_CAPS, NONE);
    DO_TEST_FULL("aarch64-gic-host", WHEN_BOTH,
                 ARG_GIC, GIC_NONE,
                 ARG_QEMU_CAPS, NONE);
    DO_TEST_FULL("aarch64-gic-host", WHEN_BOTH,
                 ARG_GIC, GIC_V2,
                 ARG_QEMU_CAPS, NONE);
    DO_TEST_FULL("aarch64-gic-host", WHEN_BOTH,
                 ARG_GIC, GIC_V3,
                 ARG_QEMU_CAPS, NONE);
    DO_TEST_FULL("aarch64-gic-host", WHEN_BOTH,
                 ARG_GIC, GIC_BOTH,
                 ARG_QEMU_CAPS, NONE);
1236

1237 1238 1239
    /* SVE aarch64 CPU features work on modern QEMU */
    DO_TEST_CAPS_ARCH_LATEST("aarch64-features-sve", "aarch64");

1240 1241 1242
    DO_TEST("memory-hotplug", NONE);
    DO_TEST("memory-hotplug-nonuma", NONE);
    DO_TEST("memory-hotplug-dimm", NONE);
1243 1244 1245 1246 1247 1248
    DO_TEST("memory-hotplug-nvdimm", QEMU_CAPS_DEVICE_NVDIMM);
    DO_TEST("memory-hotplug-nvdimm-access", QEMU_CAPS_DEVICE_NVDIMM);
    DO_TEST("memory-hotplug-nvdimm-label", QEMU_CAPS_DEVICE_NVDIMM);
    DO_TEST("memory-hotplug-nvdimm-align", QEMU_CAPS_DEVICE_NVDIMM);
    DO_TEST("memory-hotplug-nvdimm-pmem", QEMU_CAPS_DEVICE_NVDIMM);
    DO_TEST("memory-hotplug-nvdimm-readonly", QEMU_CAPS_DEVICE_NVDIMM);
1249 1250
    DO_TEST("memory-hotplug-nvdimm-ppc64", QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
                                           QEMU_CAPS_DEVICE_NVDIMM);
1251
    DO_TEST("net-udp", NONE);
1252

1253 1254 1255 1256 1257 1258
    DO_TEST("video-virtio-gpu-device", QEMU_CAPS_DEVICE_VIRTIO_GPU);
    DO_TEST("video-virtio-gpu-virgl",
            QEMU_CAPS_DEVICE_VIRTIO_GPU,
            QEMU_CAPS_VIRTIO_GPU_VIRGL);
    DO_TEST("video-virtio-gpu-spice-gl",
            QEMU_CAPS_DEVICE_VIRTIO_GPU,
1259 1260 1261 1262 1263
            QEMU_CAPS_VIRTIO_GPU_VIRGL,
            QEMU_CAPS_SPICE,
            QEMU_CAPS_SPICE_FILE_XFER_DISABLE,
            QEMU_CAPS_SPICE_GL,
            QEMU_CAPS_SPICE_RENDERNODE);
1264 1265
    DO_TEST("video-virtio-gpu-sdl-gl",
            QEMU_CAPS_DEVICE_VIRTIO_GPU,
1266 1267
            QEMU_CAPS_VIRTIO_GPU_VIRGL,
            QEMU_CAPS_SDL_GL);
1268 1269 1270 1271 1272 1273 1274

    DO_TEST("virtio-input",
            QEMU_CAPS_VIRTIO_KEYBOARD,
            QEMU_CAPS_VIRTIO_MOUSE,
            QEMU_CAPS_VIRTIO_TABLET);
    DO_TEST("virtio-input-passthrough",
            QEMU_CAPS_VIRTIO_INPUT_HOST);
M
Marc-André Lureau 已提交
1275

1276 1277
    DO_TEST("memorybacking-set", NONE);
    DO_TEST("memorybacking-unset", NONE);
1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290

    DO_TEST("virtio-options",
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_VIRTIO_KEYBOARD,
            QEMU_CAPS_VIRTIO_MOUSE,
            QEMU_CAPS_VIRTIO_TABLET,
            QEMU_CAPS_VIRTIO_INPUT_HOST,
            QEMU_CAPS_DEVICE_VIRTIO_GPU,
            QEMU_CAPS_VIRTIO_GPU_VIRGL,
            QEMU_CAPS_DEVICE_VIRTIO_RNG,
            QEMU_CAPS_OBJECT_RNG_RANDOM,
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
            QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM,
1291 1292
            QEMU_CAPS_VIRTIO_PCI_ATS,
            QEMU_CAPS_DEVICE_VHOST_USER_GPU);
1293

1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305
    DO_TEST("fd-memory-numa-topology", QEMU_CAPS_OBJECT_MEMORY_FILE,
            QEMU_CAPS_KVM);
    DO_TEST("fd-memory-numa-topology2", QEMU_CAPS_OBJECT_MEMORY_FILE,
            QEMU_CAPS_KVM);
    DO_TEST("fd-memory-numa-topology3", QEMU_CAPS_OBJECT_MEMORY_FILE,
            QEMU_CAPS_KVM);

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

    DO_TEST("memfd-memory-numa",
            QEMU_CAPS_OBJECT_MEMORY_MEMFD,
1306 1307
            QEMU_CAPS_OBJECT_MEMORY_MEMFD_HUGETLB,
            QEMU_CAPS_OBJECT_MEMORY_FILE);
1308 1309
    DO_TEST("memfd-memory-default-hugepage",
            QEMU_CAPS_OBJECT_MEMORY_MEMFD,
1310 1311
            QEMU_CAPS_OBJECT_MEMORY_MEMFD_HUGETLB,
            QEMU_CAPS_OBJECT_MEMORY_FILE);
1312

1313
    DO_TEST("acpi-table", NONE);
J
Ján Tomko 已提交
1314

1315 1316 1317 1318 1319
    DO_TEST("video-device-pciaddr-default",
            QEMU_CAPS_KVM,
            QEMU_CAPS_VNC,
            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
            QEMU_CAPS_DEVICE_QXL);
1320 1321 1322 1323
    DO_TEST("video-qxl-heads", QEMU_CAPS_DEVICE_QXL);
    DO_TEST("video-qxl-noheads", QEMU_CAPS_DEVICE_QXL);
    DO_TEST("video-qxl-resolution", QEMU_CAPS_DEVICE_QXL);
    DO_TEST("video-virtio-gpu-secondary", QEMU_CAPS_DEVICE_VIRTIO_GPU);
1324
    DO_TEST("video-virtio-gpu-ccw",
1325
            QEMU_CAPS_CCW,
1326 1327 1328 1329 1330
            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);
1331
    DO_TEST("video-virtio-gpu-ccw-auto",
1332
            QEMU_CAPS_CCW,
1333 1334 1335 1336 1337
            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);
1338
    DO_TEST("video-none-device", QEMU_CAPS_VNC);
1339

1340 1341 1342 1343 1344
    DO_TEST_CAPS_LATEST("intel-iommu");
    DO_TEST_CAPS_VER("intel-iommu", "2.6.0");
    DO_TEST_CAPS_LATEST("intel-iommu-caching-mode");
    DO_TEST_CAPS_LATEST("intel-iommu-eim");
    DO_TEST_CAPS_LATEST("intel-iommu-device-iotlb");
1345
    DO_TEST_CAPS_ARCH_LATEST("iommu-smmuv3", "aarch64");
J
Ján Tomko 已提交
1346

1347 1348 1349 1350 1351 1352 1353
    DO_TEST("cpu-check-none", NONE);
    DO_TEST("cpu-check-partial", NONE);
    DO_TEST("cpu-check-full", NONE);
    DO_TEST("cpu-check-default-none", NONE);
    DO_TEST("cpu-check-default-none2", NONE);
    DO_TEST("cpu-check-default-partial", NONE);
    DO_TEST("cpu-check-default-partial2", NONE);
1354
    DO_TEST("vmcoreinfo", QEMU_CAPS_DEVICE_VMCOREINFO);
1355

1356 1357 1358 1359 1360 1361 1362
    DO_TEST("smartcard-host", QEMU_CAPS_CCID_EMULATED);
    DO_TEST("smartcard-host-certificates", QEMU_CAPS_CCID_EMULATED);
    DO_TEST("smartcard-host-certificates-database",
            QEMU_CAPS_CCID_EMULATED);
    DO_TEST("smartcard-passthrough-tcp", QEMU_CAPS_CCID_PASSTHRU);
    DO_TEST("smartcard-passthrough-spicevmc", QEMU_CAPS_CCID_PASSTHRU);
    DO_TEST("smartcard-controller", QEMU_CAPS_CCID_EMULATED);
1363

1364 1365 1366 1367 1368 1369
    DO_TEST("pseries-cpu-compat-power9",
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE);
    DO_TEST("pseries-cpu-compat",
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE);
    DO_TEST("pseries-cpu-exact",
            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE);
1370

1371 1372
    DO_TEST("user-aliases",
            QEMU_CAPS_DEVICE_CIRRUS_VGA,
1373
            QEMU_CAPS_QCOW2_LUKS,
1374 1375
            QEMU_CAPS_OBJECT_MEMORY_FILE,
            QEMU_CAPS_PIIX_DISABLE_S3,
1376
            QEMU_CAPS_PIIX_DISABLE_S4,
1377 1378
            QEMU_CAPS_VNC,
            QEMU_CAPS_CCID_EMULATED);
1379
    DO_TEST("input-virtio-ccw",
1380
            QEMU_CAPS_CCW,
1381 1382 1383 1384 1385 1386
            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);
1387

1388 1389 1390 1391 1392 1393 1394 1395 1396
    DO_TEST("tseg-explicit-size",
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_IOH3420,
            QEMU_CAPS_ICH9_AHCI,
            QEMU_CAPS_MACHINE_SMM_OPT,
            QEMU_CAPS_VIRTIO_SCSI,
            QEMU_CAPS_MCH_EXTENDED_TSEG_MBYTES);

1397
# define DO_TEST_STATUS(_name) \
1398
    do { \
1399 1400 1401
        static struct testQemuInfo info = { \
            .name = _name, \
        }; \
1402 1403 1404
        if (testQemuInfoSetArgs(&info, capslatest, \
                                ARG_QEMU_CAPS, QEMU_CAPS_LAST, \
                                ARG_END) < 0 || \
1405
            qemuTestCapsCacheInsert(driver.qemuCapsCache, info.qemuCaps) < 0) { \
1406
            VIR_TEST_DEBUG("Failed to generate status test data for '%s'", _name); \
1407 1408
            return -1; \
        } \
1409
        testInfoSetStatusPaths(&info); \
1410
\
1411
        if (virTestRun("QEMU status XML-2-XML " _name, \
1412 1413 1414
                       testCompareStatusXMLToXMLFiles, &info) < 0) \
            ret = -1; \
\
1415
        testQemuInfoClear(&info); \
1416 1417 1418 1419 1420
    } while (0)


    DO_TEST_STATUS("blockjob-mirror");
    DO_TEST_STATUS("vcpus-multi");
1421
    DO_TEST_STATUS("modern");
1422
    DO_TEST_STATUS("migration-out-nbd");
1423 1424
    DO_TEST_STATUS("migration-in-params");
    DO_TEST_STATUS("migration-out-params");
1425
    DO_TEST_STATUS("migration-out-nbd-tls");
1426
    DO_TEST_STATUS("disk-secinfo-upgrade");
1427

1428 1429
    DO_TEST_STATUS("blockjob-blockdev");

1430 1431
    DO_TEST_STATUS("backup-pull");

1432 1433
    DO_TEST("vhost-vsock", QEMU_CAPS_DEVICE_VHOST_VSOCK);
    DO_TEST("vhost-vsock-auto", QEMU_CAPS_DEVICE_VHOST_VSOCK);
1434 1435 1436 1437 1438
    DO_TEST("vhost-vsock-ccw", QEMU_CAPS_DEVICE_VHOST_VSOCK,
            QEMU_CAPS_CCW);
    DO_TEST("vhost-vsock-ccw-auto", QEMU_CAPS_DEVICE_VHOST_VSOCK,
            QEMU_CAPS_CCW);

1439 1440 1441
    DO_TEST_CAPS_LATEST("vhost-user-fs-fd-memory");
    DO_TEST_CAPS_LATEST("vhost-user-fs-hugepages");

L
Lubomir Rintel 已提交
1442 1443
    DO_TEST("riscv64-virt",
            QEMU_CAPS_DEVICE_VIRTIO_MMIO);
1444 1445
    DO_TEST("riscv64-virt-pci",
            QEMU_CAPS_OBJECT_GPEX);
J
Ján Tomko 已提交
1446

1447 1448
    DO_TEST_CAPS_LATEST("virtio-transitional");
    DO_TEST_CAPS_LATEST("virtio-non-transitional");
1449

1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465
    /* Simple headless guests for various architectures */
    DO_TEST_CAPS_ARCH_LATEST("aarch64-virt-headless", "aarch64");
    DO_TEST_CAPS_ARCH_LATEST("ppc64-pseries-headless", "ppc64");
    DO_TEST_CAPS_ARCH_LATEST("riscv64-virt-headless", "riscv64");
    DO_TEST_CAPS_ARCH_LATEST("s390x-ccw-headless", "s390x");
    DO_TEST_CAPS_ARCH_LATEST("x86_64-pc-headless", "x86_64");
    DO_TEST_CAPS_ARCH_LATEST("x86_64-q35-headless", "x86_64");

    /* Simple guests with graphics for various architectures */
    DO_TEST_CAPS_ARCH_LATEST("aarch64-virt-graphics", "aarch64");
    DO_TEST_CAPS_ARCH_LATEST("ppc64-pseries-graphics", "ppc64");
    DO_TEST_CAPS_ARCH_LATEST("riscv64-virt-graphics", "riscv64");
    DO_TEST_CAPS_ARCH_LATEST("s390x-ccw-graphics", "s390x");
    DO_TEST_CAPS_ARCH_LATEST("x86_64-pc-graphics", "x86_64");
    DO_TEST_CAPS_ARCH_LATEST("x86_64-q35-graphics", "x86_64");

1466 1467 1468
    DO_TEST_CAPS_VER("cpu-Icelake-Server-pconfig", "3.1.0");
    DO_TEST_CAPS_LATEST("cpu-Icelake-Server-pconfig");

1469 1470
    DO_TEST_CAPS_ARCH_LATEST("aarch64-default-cpu-kvm-virt-4.2", "aarch64");
    DO_TEST_CAPS_ARCH_LATEST("aarch64-default-cpu-tcg-virt-4.2", "aarch64");
1471 1472 1473 1474 1475 1476
    DO_TEST_CAPS_ARCH_LATEST("ppc64-default-cpu-kvm-pseries-2.7", "ppc64");
    DO_TEST_CAPS_ARCH_LATEST("ppc64-default-cpu-tcg-pseries-2.7", "ppc64");
    DO_TEST_CAPS_ARCH_LATEST("ppc64-default-cpu-kvm-pseries-3.1", "ppc64");
    DO_TEST_CAPS_ARCH_LATEST("ppc64-default-cpu-tcg-pseries-3.1", "ppc64");
    DO_TEST_CAPS_ARCH_LATEST("ppc64-default-cpu-kvm-pseries-4.2", "ppc64");
    DO_TEST_CAPS_ARCH_LATEST("ppc64-default-cpu-tcg-pseries-4.2", "ppc64");
1477 1478
    DO_TEST_CAPS_ARCH_LATEST("s390-default-cpu-kvm-ccw-virtio-2.7", "s390x");
    DO_TEST_CAPS_ARCH_LATEST("s390-default-cpu-tcg-ccw-virtio-2.7", "s390x");
1479 1480
    DO_TEST_CAPS_ARCH_LATEST("s390-default-cpu-kvm-ccw-virtio-4.2", "s390x");
    DO_TEST_CAPS_ARCH_LATEST("s390-default-cpu-tcg-ccw-virtio-4.2", "s390x");
1481 1482 1483 1484
    DO_TEST_CAPS_ARCH_LATEST("x86_64-default-cpu-kvm-pc-4.2", "x86_64");
    DO_TEST_CAPS_ARCH_LATEST("x86_64-default-cpu-tcg-pc-4.2", "x86_64");
    DO_TEST_CAPS_ARCH_LATEST("x86_64-default-cpu-kvm-q35-4.2", "x86_64");
    DO_TEST_CAPS_ARCH_LATEST("x86_64-default-cpu-tcg-q35-4.2", "x86_64");
1485

A
Andrea Bolognani 已提交
1486 1487 1488
    if (getenv("LIBVIRT_SKIP_CLEANUP") == NULL)
        virFileDeleteTree(fakerootdir);

1489
    virHashFree(capslatest);
1490
    qemuTestDriverFree(&driver);
A
Andrea Bolognani 已提交
1491
    VIR_FREE(fakerootdir);
1492
    virFileWrapperClearPrefixes();
1493

1494
    return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
1495 1496
}

A
Andrea Bolognani 已提交
1497
VIR_TEST_MAIN_PRELOAD(mymain,
1498 1499
                      VIR_TEST_MOCK("virpci"),
                      VIR_TEST_MOCK("virrandom"),
M
Michal Privoznik 已提交
1500
                      VIR_TEST_MOCK("domaincaps"),
1501
                      VIR_TEST_MOCK("virdeterministichash"))
1502

1503 1504
#else

1505 1506 1507 1508 1509
int
main(void)
{
    return EXIT_AM_SKIP;
}
1510 1511

#endif /* WITH_QEMU */