qemuxml2argvtest.c 31.1 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
#ifdef WITH_QEMU

13 14
# include "internal.h"
# include "testutils.h"
15
# include "util/memory.h"
16 17
# include "qemu/qemu_capabilities.h"
# include "qemu/qemu_command.h"
M
Matthias Bolte 已提交
18
# include "qemu/qemu_domain.h"
19
# include "datatypes.h"
20
# include "cpu/cpu_map.h"
21

22
# include "testutilsqemu.h"
23

24
static const char *abs_top_srcdir;
25
static struct qemud_driver driver;
26

27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
static unsigned char *
fakeSecretGetValue(virSecretPtr obj ATTRIBUTE_UNUSED,
                   size_t *value_size,
                   unsigned int fakeflags ATTRIBUTE_UNUSED,
                   unsigned int internalFlags ATTRIBUTE_UNUSED)
{
    char *secret = strdup("AQCVn5hO6HzFAhAAq0NCv8jtJcIcE+HOBlMQ1A");
    *value_size = strlen(secret);
    return (unsigned char *) secret;
}

static virSecretPtr
fakeSecretLookupByUsage(virConnectPtr conn,
                        int usageType ATTRIBUTE_UNUSED,
                        const char *usageID)
{
43
    unsigned char uuid[VIR_UUID_BUFLEN];
44 45
    if (STRNEQ(usageID, "mycluster_myname"))
        return NULL;
46 47 48

    virUUIDGenerate(uuid);
    return virGetSecret(conn, uuid, usageType, usageID);
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
}

static int
fakeSecretClose(virConnectPtr conn ATTRIBUTE_UNUSED)
{
    return 0;
}

static virSecretDriver fakeSecretDriver = {
    .name = "fake_secret",
    .open = NULL,
    .close = fakeSecretClose,
    .numOfSecrets = NULL,
    .listSecrets = NULL,
    .lookupByUUID = NULL,
    .lookupByUsage = fakeSecretLookupByUsage,
    .defineXML = NULL,
    .getXMLDesc = NULL,
    .setValue = NULL,
    .getValue = fakeSecretGetValue,
    .undefine = NULL,
};

72 73 74 75 76 77 78
typedef enum {
    FLAG_EXPECT_ERROR       = 1 << 0,
    FLAG_EXPECT_FAILURE     = 1 << 1,
    FLAG_EXPECT_PARSE_ERROR = 1 << 2,
    FLAG_JSON               = 1 << 3,
} virQemuXML2ArgvTestFlags;

79
static int testCompareXMLToArgvFiles(const char *xml,
E
Eric Blake 已提交
80
                                     const char *cmdline,
81
                                     virBitmapPtr extraFlags,
J
Jiri Denemark 已提交
82
                                     const char *migrateFrom,
83
                                     int migrateFd,
84
                                     virQemuXML2ArgvTestFlags flags)
85 86
{
    char *expectargv = NULL;
E
Eric Blake 已提交
87
    int len;
88
    char *actualargv = NULL;
E
Eric Blake 已提交
89
    int ret = -1;
90
    virDomainDefPtr vmdef = NULL;
91
    virDomainChrSourceDef monitor_chr;
92
    virConnectPtr conn;
J
Jiri Denemark 已提交
93
    char *log = NULL;
94
    char *emulator = NULL;
E
Eric Blake 已提交
95
    virCommandPtr cmd = NULL;
96 97

    if (!(conn = virGetConnect()))
98
        goto out;
99
    conn->secretDriver = &fakeSecretDriver;
100

101
    if (!(vmdef = virDomainDefParseFile(driver.caps, xml,
M
Matthias Bolte 已提交
102
                                        QEMU_EXPECTED_VIRT_TYPES,
103 104 105
                                        VIR_DOMAIN_XML_INACTIVE))) {
        if (flags & FLAG_EXPECT_PARSE_ERROR)
            goto ok;
106
        goto out;
107
    }
108

109 110 111 112 113 114 115 116 117 118 119 120
    /*
     * For test purposes, we may want to fake emulator's output by providing
     * our own script instead of a real emulator. For this to work we need to
     * specify a relative path in <emulator/> element, which, however, is not
     * allowed by RelaxNG schema for domain XML. To work around it we add an
     * extra '/' at the beginning of relative emulator path so that it looks
     * like, e.g., "/./qemu.sh" or "/../emulator/qemu.sh" instead of
     * "./qemu.sh" or "../emulator/qemu.sh" respectively. The following code
     * detects such paths, strips the extra '/' and makes the path absolute.
     */
    if (vmdef->emulator && STRPREFIX(vmdef->emulator, "/.")) {
        if (!(emulator = strdup(vmdef->emulator + 1)))
121
            goto out;
122
        VIR_FREE(vmdef->emulator);
123 124 125
        vmdef->emulator = NULL;
        if (virAsprintf(&vmdef->emulator, "%s/qemuxml2argvdata/%s",
                        abs_srcdir, emulator) < 0)
126
            goto out;
127 128
    }

129
    if (qemuCapsGet(extraFlags, QEMU_CAPS_DOMID))
130
        vmdef->id = 6;
131
    else
132
        vmdef->id = -1;
133

134
    memset(&monitor_chr, 0, sizeof(monitor_chr));
135 136 137
    monitor_chr.type = VIR_DOMAIN_CHR_TYPE_UNIX;
    monitor_chr.data.nix.path = (char *)"/tmp/test-monitor";
    monitor_chr.data.nix.listen = true;
138

139 140 141
    qemuCapsSetList(extraFlags,
                    QEMU_CAPS_VNC_COLON,
                    QEMU_CAPS_NO_REBOOT,
142
                    QEMU_CAPS_NO_ACPI,
143
                    QEMU_CAPS_LAST);
144

145
    if (qemudCanonicalizeMachine(&driver, vmdef) < 0)
146
        goto out;
147

148
    if (qemuCapsGet(extraFlags, QEMU_CAPS_DEVICE)) {
149
        if (qemuDomainAssignAddresses(vmdef, extraFlags, NULL)) {
150
            if (flags & FLAG_EXPECT_ERROR)
151
                goto ok;
152
            goto out;
153
        }
154 155
    }

156 157
    log = virtTestLogContentAndReset();
    VIR_FREE(log);
158
    virResetLastError();
J
Jiri Denemark 已提交
159

160
    /* We do not call qemuCapsExtractVersionInfo() before calling
161
     * qemuBuildCommandLine(), so we should set QEMU_CAPS_PCI_MULTIBUS for
162 163 164 165
     * x86_64 and i686 architectures here.
     */
    if (STREQLEN(vmdef->os.arch, "x86_64", 6) ||
        STREQLEN(vmdef->os.arch, "i686", 4)) {
166
        qemuCapsSet(extraFlags, QEMU_CAPS_PCI_MULTIBUS);
167 168
    }

169
    if (qemuAssignDeviceAliases(vmdef, extraFlags) < 0)
170
        goto out;
171

172 173
    if (!(cmd = qemuBuildCommandLine(conn, &driver, vmdef, &monitor_chr,
                                     (flags & FLAG_JSON), extraFlags,
174
                                     migrateFrom, migrateFd, NULL,
175
                                     VIR_NETDEV_VPORT_PROFILE_OP_NO_OP))) {
176
        if (flags & FLAG_EXPECT_FAILURE) {
177 178 179 180
            ret = 0;
            virResetLastError();
        }
        goto out;
181
    } else if (flags & FLAG_EXPECT_FAILURE) {
182 183 184 185
        if (virTestGetDebug())
            fprintf(stderr, "qemuBuildCommandLine should have failed\n");
        goto out;
    }
186

187
    if (!!virGetLastError() != !!(flags & FLAG_EXPECT_ERROR)) {
188
        if (virTestGetDebug() && (log = virtTestLogContentAndReset()))
J
Jiri Denemark 已提交
189
            fprintf(stderr, "\n%s", log);
190
        goto out;
J
Jiri Denemark 已提交
191 192
    }

E
Eric Blake 已提交
193
    if (!(actualargv = virCommandToString(cmd)))
194
        goto out;
E
Eric Blake 已提交
195 196 197 198 199 200

    if (emulator) {
        /* Skip the abs_srcdir portion of replacement emulator.  */
        char *start_skip = strstr(actualargv, abs_srcdir);
        char *end_skip = strstr(actualargv, emulator);
        if (!start_skip || !end_skip)
201
            goto out;
E
Eric Blake 已提交
202
        memmove(start_skip, end_skip, strlen(end_skip) + 1);
203 204
    }

205 206 207 208 209 210
    len = virtTestLoadFile(cmdline, &expectargv);
    if (len < 0)
        goto out;
    if (len && expectargv[len - 1] == '\n')
        expectargv[len - 1] = '\0';

211 212
    if (STRNEQ(expectargv, actualargv)) {
        virtTestDifference(stderr, expectargv, actualargv);
213
        goto out;
214 215
    }

216
 ok:
217
    if (flags & FLAG_EXPECT_ERROR) {
218 219 220 221
        /* need to suppress the errors */
        virResetLastError();
    }

222 223
    ret = 0;

224
out:
225 226 227 228
    VIR_FREE(log);
    VIR_FREE(emulator);
    VIR_FREE(expectargv);
    VIR_FREE(actualargv);
E
Eric Blake 已提交
229
    virCommandFree(cmd);
230
    virDomainDefFree(vmdef);
231
    virObjectUnref(conn);
232 233 234 235
    return ret;
}


236 237
struct testInfo {
    const char *name;
238
    virBitmapPtr extraFlags;
239
    const char *migrateFrom;
240
    int migrateFd;
241
    unsigned int flags;
242 243
};

244 245 246 247
static int
testCompareXMLToArgvHelper(const void *data)
{
    int result = -1;
248
    const struct testInfo *info = data;
249 250
    char *xml = NULL;
    char *args = NULL;
251
    unsigned int flags = info->flags;
252 253 254 255 256 257 258

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

259 260 261
    if (qemuCapsGet(info->extraFlags, QEMU_CAPS_MONITOR_JSON))
        flags |= FLAG_JSON;

262
    result = testCompareXMLToArgvFiles(xml, args, info->extraFlags,
263
                                       info->migrateFrom, info->migrateFd,
264
                                       flags);
265 266

cleanup:
267 268
    VIR_FREE(xml);
    VIR_FREE(args);
269
    return result;
270 271 272 273
}



274
static int
E
Eric Blake 已提交
275
mymain(void)
276 277
{
    int ret = 0;
278
    char *map = NULL;
279

280 281 282 283
    abs_top_srcdir = getenv("abs_top_srcdir");
    if (!abs_top_srcdir)
        abs_top_srcdir = "..";

284 285
    if ((driver.caps = testQemuCapsInit()) == NULL)
        return EXIT_FAILURE;
286 287 288 289 290
    if ((driver.stateDir = strdup("/nowhere")) == NULL)
        return EXIT_FAILURE;
    if ((driver.hugetlbfs_mount = strdup("/dev/hugepages")) == NULL)
        return EXIT_FAILURE;
    if ((driver.hugepage_path = strdup("/dev/hugepages/libvirt/qemu")) == NULL)
291
        return EXIT_FAILURE;
292 293 294 295 296
    driver.spiceTLS = 1;
    if (!(driver.spiceTLSx509certdir = strdup("/etc/pki/libvirt-spice")))
        return EXIT_FAILURE;
    if (!(driver.spicePassword = strdup("123456")))
        return EXIT_FAILURE;
297 298
    if (virAsprintf(&map, "%s/src/cpu/cpu_map.xml", abs_top_srcdir) < 0 ||
        cpuMapOverride(map) < 0) {
299
        VIR_FREE(map);
300
        return EXIT_FAILURE;
301
    }
302

303
# define DO_TEST_FULL(name, migrateFrom, migrateFd, flags, ...)         \
304
    do {                                                                \
305
        static struct testInfo info = {                                 \
306
            name, NULL, migrateFrom, migrateFd, (flags)                 \
J
Jiri Denemark 已提交
307
        };                                                              \
308 309 310
        if (!(info.extraFlags = qemuCapsNew()))                         \
            return EXIT_FAILURE;                                        \
        qemuCapsSetList(info.extraFlags, __VA_ARGS__, QEMU_CAPS_LAST);  \
311 312 313
        if (virtTestRun("QEMU XML-2-ARGV " name,                        \
                        1, testCompareXMLToArgvHelper, &info) < 0)      \
            ret = -1;                                                   \
314
        qemuCapsFree(info.extraFlags);                                  \
315 316
    } while (0)

317 318 319 320 321
# define DO_TEST(name, ...)                                             \
    DO_TEST_FULL(name, NULL, -1, 0, __VA_ARGS__)

# define DO_TEST_ERROR(name, ...)                                       \
    DO_TEST_FULL(name, NULL, -1, FLAG_EXPECT_ERROR, __VA_ARGS__)
322 323

# define DO_TEST_FAILURE(name, ...)                                     \
324 325 326 327 328 329
    DO_TEST_FULL(name, NULL, -1, FLAG_EXPECT_FAILURE, __VA_ARGS__)

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

# define NONE QEMU_CAPS_LAST
332

333 334 335
    /* 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 */
336 337 338 339 340 341 342
    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");
343 344
    unsetenv("QEMU_AUDIO_DRV");
    unsetenv("SDL_AUDIODRIVER");
345

346 347 348 349 350 351 352 353 354
    DO_TEST("minimal", QEMU_CAPS_NAME);
    DO_TEST("minimal-s390", QEMU_CAPS_NAME);
    DO_TEST("machine-aliases1", NONE);
    DO_TEST_ERROR("machine-aliases2", NONE);
    DO_TEST("boot-cdrom", NONE);
    DO_TEST("boot-network", NONE);
    DO_TEST("boot-floppy", NONE);
    DO_TEST("boot-multi", QEMU_CAPS_BOOT_MENU);
    DO_TEST("boot-menu-enable",
355
            QEMU_CAPS_BOOT_MENU, QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE);
356
    DO_TEST("boot-menu-enable",
357 358
            QEMU_CAPS_BOOT_MENU, QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE,
            QEMU_CAPS_BOOTINDEX);
359 360
    DO_TEST("boot-menu-disable", QEMU_CAPS_BOOT_MENU);
    DO_TEST("boot-menu-disable-drive",
361
            QEMU_CAPS_BOOT_MENU, QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE);
362
    DO_TEST("boot-menu-disable-drive-bootindex",
363 364
            QEMU_CAPS_BOOT_MENU, QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE,
            QEMU_CAPS_BOOTINDEX);
365
    DO_TEST("boot-order",
366 367
            QEMU_CAPS_BOOTINDEX, QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE,
            QEMU_CAPS_VIRTIO_BLK_SCSI, QEMU_CAPS_VIRTIO_BLK_SG_IO);
368
    DO_TEST("boot-complex",
369 370
            QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_BOOT,
            QEMU_CAPS_VIRTIO_BLK_SCSI, QEMU_CAPS_VIRTIO_BLK_SG_IO);
371
    DO_TEST("boot-complex-bootindex",
372
            QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_BOOT,
373 374
            QEMU_CAPS_BOOTINDEX,
            QEMU_CAPS_VIRTIO_BLK_SCSI, QEMU_CAPS_VIRTIO_BLK_SG_IO);
375 376 377 378
    DO_TEST_ERROR("bootloader", QEMU_CAPS_DOMID);
    DO_TEST("bios", QEMU_CAPS_DEVICE, QEMU_CAPS_SGA);
    DO_TEST("clock-utc", NONE);
    DO_TEST("clock-localtime", NONE);
379 380
    /*
     * Can't be enabled since the absolute timestamp changes every time
381
    DO_TEST("clock-variable", QEMU_CAPS_RTC);
382
    */
383 384 385 386 387 388 389 390 391
    DO_TEST("clock-france", QEMU_CAPS_RTC);
    DO_TEST("cpu-kvmclock", QEMU_CAPS_ENABLE_KVM);
    DO_TEST("cpu-host-kvmclock", QEMU_CAPS_ENABLE_KVM, QEMU_CAPS_CPU_HOST);
    DO_TEST("kvmclock", QEMU_CAPS_KVM);

    DO_TEST("hugepages", QEMU_CAPS_MEM_PATH);
    DO_TEST("disk-cdrom", NONE);
    DO_TEST("disk-cdrom-empty", QEMU_CAPS_DRIVE);
    DO_TEST("disk-cdrom-tray",
392
            QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_VIRTIO_TX_ALG);
393 394 395 396
    DO_TEST("disk-cdrom-tray-no-device-cap", NONE);
    DO_TEST("disk-floppy", NONE);
    DO_TEST("disk-floppy-tray-no-device-cap", NONE);
    DO_TEST("disk-floppy-tray",
397
            QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE);
398
    DO_TEST("disk-virtio-s390", QEMU_CAPS_DRIVE,
399
            QEMU_CAPS_DEVICE, QEMU_CAPS_VIRTIO_S390);
400 401 402
    DO_TEST("disk-many", NONE);
    DO_TEST("disk-virtio", QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_BOOT);
    DO_TEST("disk-order",
403 404
            QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE_BOOT,
            QEMU_CAPS_VIRTIO_BLK_SCSI, QEMU_CAPS_VIRTIO_BLK_SG_IO);
405 406
    DO_TEST("disk-xenvbd", QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_BOOT);
    DO_TEST("disk-drive-boot-disk",
407
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_BOOT);
408
    DO_TEST("disk-drive-boot-cdrom",
409
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_BOOT);
410
    DO_TEST("floppy-drive-fat",
411
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_BOOT, QEMU_CAPS_DRIVE_FORMAT);
412
    DO_TEST("disk-drive-fat",
413
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_BOOT, QEMU_CAPS_DRIVE_FORMAT);
414
    DO_TEST("disk-drive-readonly-disk",
415 416
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_READONLY,
            QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
417
    DO_TEST("disk-drive-readonly-no-device",
418
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_READONLY, QEMU_CAPS_NODEFCONFIG);
419
    DO_TEST("disk-drive-fmt-qcow",
420
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_BOOT, QEMU_CAPS_DRIVE_FORMAT);
421
    DO_TEST("disk-drive-shared",
422
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_FORMAT, QEMU_CAPS_DRIVE_SERIAL);
423
    DO_TEST("disk-drive-cache-v1-wt",
424
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_FORMAT);
425
    DO_TEST("disk-drive-cache-v1-wb",
426
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_FORMAT);
427
    DO_TEST("disk-drive-cache-v1-none",
428
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_FORMAT);
429
    DO_TEST("disk-drive-error-policy-stop",
430
            QEMU_CAPS_DRIVE, QEMU_CAPS_MONITOR_JSON, QEMU_CAPS_DRIVE_FORMAT);
431
    DO_TEST("disk-drive-error-policy-enospace",
432
            QEMU_CAPS_DRIVE, QEMU_CAPS_MONITOR_JSON, QEMU_CAPS_DRIVE_FORMAT);
433
    DO_TEST("disk-drive-error-policy-wreport-rignore",
434
            QEMU_CAPS_DRIVE, QEMU_CAPS_MONITOR_JSON, QEMU_CAPS_DRIVE_FORMAT);
435
    DO_TEST("disk-drive-cache-v2-wt",
436
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_CACHE_V2, QEMU_CAPS_DRIVE_FORMAT);
437
    DO_TEST("disk-drive-cache-v2-wb",
438
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_CACHE_V2, QEMU_CAPS_DRIVE_FORMAT);
439
    DO_TEST("disk-drive-cache-v2-none",
440
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_CACHE_V2, QEMU_CAPS_DRIVE_FORMAT);
441
    DO_TEST("disk-drive-cache-directsync",
442 443
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_CACHE_V2,
            QEMU_CAPS_DRIVE_CACHE_DIRECTSYNC, QEMU_CAPS_DRIVE_FORMAT);
444
    DO_TEST("disk-drive-cache-unsafe",
445 446
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_CACHE_V2,
            QEMU_CAPS_DRIVE_CACHE_UNSAFE, QEMU_CAPS_DRIVE_FORMAT);
447
    DO_TEST("disk-drive-network-nbd",
448
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_FORMAT);
449
    DO_TEST("disk-drive-network-rbd",
450
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_FORMAT);
451
    DO_TEST("disk-drive-network-sheepdog",
452
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_FORMAT);
453
    DO_TEST("disk-drive-network-rbd-auth",
454
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_FORMAT);
455
    DO_TEST("disk-drive-no-boot",
456
            QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_BOOTINDEX);
457 458
    DO_TEST("disk-usb",  NONE);
    DO_TEST("disk-usb-device",
459
            QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
460
    DO_TEST("disk-scsi-device",
461 462
            QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_SCSI_LSI);
463
    DO_TEST("disk-scsi-device-auto",
464 465
            QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_SCSI_LSI);
466
    DO_TEST("disk-scsi-disk-split",
467
            QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
468
            QEMU_CAPS_SCSI_CD, QEMU_CAPS_SCSI_LSI, QEMU_CAPS_VIRTIO_SCSI_PCI);
469
    DO_TEST("disk-scsi-vscsi",
470
            QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
471
    DO_TEST("disk-scsi-virtio-scsi",
472 473
            QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_VIRTIO_SCSI_PCI);
474
    DO_TEST("disk-sata-device",
J
Jim Fehlig 已提交
475 476
            QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE,
            QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_ICH9_AHCI);
477
    DO_TEST("disk-aio",
478 479
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_AIO,
            QEMU_CAPS_DRIVE_CACHE_V2, QEMU_CAPS_DRIVE_FORMAT);
480
    DO_TEST("disk-ioeventfd",
481
            QEMU_CAPS_DRIVE, QEMU_CAPS_VIRTIO_IOEVENTFD,
482
            QEMU_CAPS_VIRTIO_TX_ALG, QEMU_CAPS_DEVICE,
O
Osier Yang 已提交
483
            QEMU_CAPS_VIRTIO_BLK_SCSI, QEMU_CAPS_VIRTIO_BLK_SG_IO);
484
    DO_TEST("disk-copy_on_read",
O
Osier Yang 已提交
485 486
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_COPY_ON_READ,
            QEMU_CAPS_VIRTIO_TX_ALG, QEMU_CAPS_DEVICE,
487
            QEMU_CAPS_VIRTIO_BLK_SCSI, QEMU_CAPS_VIRTIO_BLK_SG_IO);
488
    DO_TEST("disk-snapshot",
489
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_CACHE_V2, QEMU_CAPS_DRIVE_FORMAT);
490
    DO_TEST("event_idx",
491 492 493
            QEMU_CAPS_DRIVE,
            QEMU_CAPS_VIRTIO_BLK_EVENT_IDX,
            QEMU_CAPS_VIRTIO_NET_EVENT_IDX,
494 495
            QEMU_CAPS_DEVICE,
            QEMU_CAPS_VIRTIO_BLK_SCSI, QEMU_CAPS_VIRTIO_BLK_SG_IO);
496
    DO_TEST("virtio-lun",
497 498 499
            QEMU_CAPS_DRIVE,
            QEMU_CAPS_DEVICE,
            QEMU_CAPS_VIRTIO_BLK_SCSI, QEMU_CAPS_VIRTIO_BLK_SG_IO);
500
    DO_TEST("disk-scsi-lun-passthrough",
501 502
            QEMU_CAPS_DRIVE,
            QEMU_CAPS_DEVICE,
503 504
            QEMU_CAPS_SCSI_BLOCK, QEMU_CAPS_VIRTIO_BLK_SG_IO,
            QEMU_CAPS_SCSI_LSI, QEMU_CAPS_VIRTIO_SCSI_PCI);
505

506 507
    DO_TEST("graphics-vnc", NONE);
    DO_TEST("graphics-vnc-socket", NONE);
508 509 510

    driver.vncSASL = 1;
    driver.vncSASLdir = strdup("/root/.sasl2");
511
    DO_TEST("graphics-vnc-sasl", QEMU_CAPS_VGA);
512 513 514
    driver.vncTLS = 1;
    driver.vncTLSx509verify = 1;
    driver.vncTLSx509certdir = strdup("/etc/pki/tls/qemu");
515
    DO_TEST("graphics-vnc-tls", NONE);
516
    driver.vncSASL = driver.vncTLSx509verify = driver.vncTLS = 0;
517 518
    VIR_FREE(driver.vncSASLdir);
    VIR_FREE(driver.vncTLSx509certdir);
519 520
    driver.vncSASLdir = driver.vncTLSx509certdir = NULL;

521 522 523 524
    DO_TEST("graphics-sdl", NONE);
    DO_TEST("graphics-sdl-fullscreen", NONE);
    DO_TEST("nographics", QEMU_CAPS_VGA);
    DO_TEST("nographics-vga",
525
            QEMU_CAPS_VGA, QEMU_CAPS_VGA_NONE);
526
    DO_TEST("graphics-spice",
527 528
            QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL,
            QEMU_CAPS_DEVICE, QEMU_CAPS_SPICE);
529
    DO_TEST("graphics-spice-agentmouse",
P
Peng Zhou 已提交
530
            QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL,
531 532 533
            QEMU_CAPS_DEVICE, QEMU_CAPS_SPICE,
            QEMU_CAPS_CHARDEV_SPICEVMC,
            QEMU_CAPS_NODEFCONFIG);
534
    DO_TEST("graphics-spice-compression",
535 536
            QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL,
            QEMU_CAPS_DEVICE, QEMU_CAPS_SPICE);
537
    DO_TEST("graphics-spice-timeout",
538 539 540 541
            QEMU_CAPS_DRIVE,
            QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL,
            QEMU_CAPS_DEVICE, QEMU_CAPS_SPICE,
            QEMU_CAPS_DEVICE_QXL_VGA);
542
    DO_TEST("graphics-spice-qxl-vga",
543 544 545
            QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL,
            QEMU_CAPS_DEVICE, QEMU_CAPS_SPICE,
            QEMU_CAPS_DEVICE_QXL_VGA);
546
    DO_TEST("graphics-spice-usb-redir",
547 548 549 550 551
            QEMU_CAPS_VGA, QEMU_CAPS_SPICE,
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_USB_HUB,
            QEMU_CAPS_ICH9_USB_EHCI1, QEMU_CAPS_USB_REDIR,
            QEMU_CAPS_CHARDEV_SPICEVMC);
552

553 554 555 556 557 558 559 560 561
    DO_TEST("input-usbmouse", NONE);
    DO_TEST("input-usbtablet", NONE);
    DO_TEST_ERROR("input-xen", QEMU_CAPS_DOMID);
    DO_TEST("misc-acpi", NONE);
    DO_TEST("misc-no-reboot", NONE);
    DO_TEST("misc-uuid", QEMU_CAPS_NAME, QEMU_CAPS_UUID);
    DO_TEST("net-user", NONE);
    DO_TEST("net-virtio", NONE);
    DO_TEST("net-virtio-device",
562
            QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_VIRTIO_TX_ALG);
563
    DO_TEST("net-virtio-netdev",
564
            QEMU_CAPS_DEVICE, QEMU_CAPS_NETDEV, QEMU_CAPS_NODEFCONFIG);
565
    DO_TEST("net-virtio-s390",
566
            QEMU_CAPS_DEVICE, QEMU_CAPS_VIRTIO_S390);
567 568 569 570 571 572 573
    DO_TEST("net-eth", NONE);
    DO_TEST("net-eth-ifname", NONE);
    DO_TEST("net-eth-names", QEMU_CAPS_NET_NAME);
    DO_TEST("net-client", NONE);
    DO_TEST("net-server", NONE);
    DO_TEST("net-mcast", NONE);
    DO_TEST("net-hostdev",
574
            QEMU_CAPS_PCIDEVICE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
575

576 577 578 579 580 581 582 583 584 585 586 587 588 589
    DO_TEST("serial-vc", NONE);
    DO_TEST("serial-pty", NONE);
    DO_TEST("serial-dev", NONE);
    DO_TEST("serial-file", NONE);
    DO_TEST("serial-unix", NONE);
    DO_TEST("serial-tcp", NONE);
    DO_TEST("serial-udp", NONE);
    DO_TEST("serial-tcp-telnet", NONE);
    DO_TEST("serial-many", NONE);
    DO_TEST("parallel-tcp", NONE);
    DO_TEST("console-compat", NONE);
    DO_TEST("console-compat-auto", NONE);

    DO_TEST("serial-vc-chardev",
590
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
591
    DO_TEST("serial-pty-chardev",
592
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
593
    DO_TEST("serial-dev-chardev",
594
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
595
    DO_TEST("serial-file-chardev",
596
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
597
    DO_TEST("serial-unix-chardev",
598
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
599
    DO_TEST("serial-tcp-chardev",
600
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
601
    DO_TEST("serial-udp-chardev",
602
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
603
    DO_TEST("serial-tcp-telnet-chardev",
604
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
605
    DO_TEST("serial-many-chardev",
606
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
607
    DO_TEST("parallel-tcp-chardev",
608
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
609
    DO_TEST("parallel-parport-chardev",
610
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
611
    DO_TEST("console-compat-chardev",
612 613
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);

614
    DO_TEST("channel-guestfwd",
615
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
616
    DO_TEST("channel-virtio",
617
            QEMU_CAPS_DEVICE, QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG);
618
    DO_TEST("channel-virtio-auto",
619
            QEMU_CAPS_DEVICE, QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG);
620
    DO_TEST("console-virtio",
621
            QEMU_CAPS_DEVICE, QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG);
622
    DO_TEST("console-virtio-many",
623
            QEMU_CAPS_DEVICE, QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG);
624
    DO_TEST("console-virtio-s390",
625 626
            QEMU_CAPS_DEVICE, QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_DRIVE,  QEMU_CAPS_VIRTIO_S390);
627
    DO_TEST("channel-spicevmc",
628 629
            QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_SPICE, QEMU_CAPS_CHARDEV_SPICEVMC);
630
    DO_TEST("channel-spicevmc-old",
631 632 633
            QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_SPICE, QEMU_CAPS_DEVICE_SPICEVMC);

634
    DO_TEST("smartcard-host",
635 636
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE,
            QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_CCID_EMULATED);
637
    DO_TEST("smartcard-host-certificates",
638 639
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE,
            QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_CCID_EMULATED);
640
    DO_TEST("smartcard-passthrough-tcp",
641 642
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE,
            QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_CCID_PASSTHRU);
643
    DO_TEST("smartcard-passthrough-spicevmc",
644 645
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_CCID_PASSTHRU, QEMU_CAPS_CHARDEV_SPICEVMC);
646
    DO_TEST("smartcard-controller",
647 648 649
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE,
            QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_CCID_EMULATED);

650
    DO_TEST("usb-controller",
651 652
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE,
            QEMU_CAPS_NODEFCONFIG);
653
    DO_TEST("usb-piix3-controller",
654
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_PIIX3_USB_UHCI,
655
            QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_NODEFCONFIG);
656
    DO_TEST("usb-ich9-ehci-addr",
657 658
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_ICH9_USB_EHCI1);
659
    DO_TEST("input-usbmouse-addr",
660
            QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
661
    DO_TEST("usb-ich9-companion",
662 663
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_ICH9_USB_EHCI1);
664
    DO_TEST("usb-hub",
M
Marc-André Lureau 已提交
665 666
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_USB_HUB,
            QEMU_CAPS_NODEFCONFIG);
667
    DO_TEST("usb-ports",
668 669
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_USB_HUB,
            QEMU_CAPS_NODEFCONFIG);
670
    DO_TEST("usb-redir",
671 672
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_USB_HUB,
673 674
            QEMU_CAPS_ICH9_USB_EHCI1, QEMU_CAPS_USB_REDIR,
            QEMU_CAPS_SPICE, QEMU_CAPS_CHARDEV_SPICEVMC);
675
    DO_TEST("usb1-usb2",
676 677 678
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_PIIX3_USB_UHCI,
            QEMU_CAPS_USB_HUB, QEMU_CAPS_ICH9_USB_EHCI1);
679 680 681 682 683 684 685 686 687 688
    DO_TEST("usb-none",
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
    DO_TEST_PARSE_ERROR("usb-none-other",
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
    DO_TEST_PARSE_ERROR("usb-none-hub",
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_USB_HUB);
    DO_TEST_PARSE_ERROR("usb-none-usbtablet",
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);

689

690
    DO_TEST("smbios", QEMU_CAPS_SMBIOS_TYPE);
691

692 693 694 695 696
    DO_TEST("watchdog", NONE);
    DO_TEST("watchdog-device", QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
    DO_TEST("watchdog-dump", NONE);
    DO_TEST("balloon-device", QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
    DO_TEST("balloon-device-auto",
697
            QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
698 699
    DO_TEST("sound", NONE);
    DO_TEST("sound-device",
700 701
            QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_HDA_DUPLEX, QEMU_CAPS_HDA_MICRO);
702
    DO_TEST("fs9p",
703 704
            QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_FSDEV,
            QEMU_CAPS_FSDEV_WRITEOUT);
705

706 707
    DO_TEST("hostdev-usb-address", NONE);
    DO_TEST("hostdev-usb-address-device",
708
            QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
709 710
    DO_TEST("hostdev-pci-address", QEMU_CAPS_PCIDEVICE);
    DO_TEST("hostdev-pci-address-device",
711
            QEMU_CAPS_PCIDEVICE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
712
    DO_TEST("pci-rom",
713 714
            QEMU_CAPS_PCIDEVICE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_PCI_ROMBAR);
715

716 717 718 719 720 721
    DO_TEST_FULL("restore-v1", "stdio", 7, 0, QEMU_CAPS_MIGRATE_KVM_STDIO);
    DO_TEST_FULL("restore-v2", "stdio", 7, 0, QEMU_CAPS_MIGRATE_QEMU_EXEC);
    DO_TEST_FULL("restore-v2", "exec:cat", 7, 0, QEMU_CAPS_MIGRATE_QEMU_EXEC);
    DO_TEST_FULL("restore-v2-fd", "stdio", 7, 0, QEMU_CAPS_MIGRATE_QEMU_FD);
    DO_TEST_FULL("restore-v2-fd", "fd:7", 7, 0, QEMU_CAPS_MIGRATE_QEMU_FD);
    DO_TEST_FULL("migrate", "tcp:10.0.0.1:5000", -1, 0,
722 723
            QEMU_CAPS_MIGRATE_QEMU_TCP);

724
    DO_TEST("qemu-ns", NONE);
725

726
    DO_TEST("smp", QEMU_CAPS_SMP_TOPOLOGY);
727

728 729 730 731 732 733 734 735 736
    DO_TEST("cpu-topology1", QEMU_CAPS_SMP_TOPOLOGY);
    DO_TEST("cpu-topology2", QEMU_CAPS_SMP_TOPOLOGY);
    DO_TEST("cpu-topology3", NONE);
    DO_TEST("cpu-minimum1", NONE);
    DO_TEST("cpu-minimum2", NONE);
    DO_TEST("cpu-exact1", NONE);
    DO_TEST("cpu-exact2", NONE);
    DO_TEST("cpu-exact2-nofallback", NONE);
    DO_TEST("cpu-fallback", NONE);
737
    DO_TEST_FAILURE("cpu-nofallback", NONE);
738 739 740 741 742
    DO_TEST("cpu-strict1", NONE);
    DO_TEST("cpu-numa1", NONE);
    DO_TEST("cpu-numa2", QEMU_CAPS_SMP_TOPOLOGY);
    DO_TEST("cpu-host-model", NONE);
    DO_TEST("cpu-host-model-fallback", NONE);
743
    DO_TEST_FAILURE("cpu-host-model-nofallback", NONE);
744
    DO_TEST("cpu-host-passthrough", QEMU_CAPS_KVM, QEMU_CAPS_CPU_HOST);
745 746 747
    DO_TEST_FAILURE("cpu-host-passthrough", NONE);
    DO_TEST_FAILURE("cpu-qemu-host-passthrough",
                    QEMU_CAPS_KVM, QEMU_CAPS_CPU_HOST);
748

749 750 751 752 753 754 755 756 757 758 759
    DO_TEST("memtune", QEMU_CAPS_NAME);
    DO_TEST("blkiotune", QEMU_CAPS_NAME);
    DO_TEST("blkiotune-device", QEMU_CAPS_NAME);
    DO_TEST("cputune", QEMU_CAPS_NAME);
    DO_TEST("numatune-memory", NONE);
    DO_TEST("numad", NONE);
    DO_TEST("numad-auto-vcpu-static-numatune", NONE);
    DO_TEST("numad-auto-memory-vcpu-cpuset", NONE);
    DO_TEST("numad-auto-memory-vcpu-no-cpuset-and-placement", NONE);
    DO_TEST("numad-static-memory-auto-vcpu", NONE);
    DO_TEST("blkdeviotune", QEMU_CAPS_NAME, QEMU_CAPS_DEVICE,
760
            QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_IOTUNE);
761

762
    DO_TEST("multifunction-pci-device",
763
            QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
764
            QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_SCSI_LSI);
765

766
    DO_TEST("monitor-json", QEMU_CAPS_DEVICE,
767
            QEMU_CAPS_CHARDEV, QEMU_CAPS_MONITOR_JSON, QEMU_CAPS_NODEFCONFIG);
768
    DO_TEST("no-shutdown", QEMU_CAPS_DEVICE,
769 770
            QEMU_CAPS_CHARDEV, QEMU_CAPS_MONITOR_JSON, QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_NO_SHUTDOWN);
771

772 773 774 775 776 777
    DO_TEST("seclabel-dynamic", QEMU_CAPS_NAME);
    DO_TEST("seclabel-dynamic-baselabel", QEMU_CAPS_NAME);
    DO_TEST("seclabel-dynamic-override", QEMU_CAPS_NAME);
    DO_TEST("seclabel-static", QEMU_CAPS_NAME);
    DO_TEST("seclabel-static-relabel", QEMU_CAPS_NAME);
    DO_TEST("seclabel-none", QEMU_CAPS_NAME);
778

779
    DO_TEST("pseries-basic",
780
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
781
    DO_TEST("pseries-vio", QEMU_CAPS_DRIVE,
782
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
783
    DO_TEST("pseries-vio-user-assigned", QEMU_CAPS_DRIVE,
784
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
785
    DO_TEST_ERROR("pseries-vio-address-clash", QEMU_CAPS_DRIVE,
786
            QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
787
    DO_TEST("disk-ide-drive-split",
788 789
            QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
            QEMU_CAPS_IDE_CD);
790

791 792
    DO_TEST("disk-geometry", QEMU_CAPS_DRIVE);

793
    VIR_FREE(driver.stateDir);
794
    virCapabilitiesFree(driver.caps);
795
    VIR_FREE(map);
796

797
    return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
798 799
}

800 801
VIRT_TEST_MAIN(mymain)

802
#else
E
Eric Blake 已提交
803
# include "testutils.h"
804

805 806 807 808
int main(void)
{
    return EXIT_AM_SKIP;
}
809 810

#endif /* WITH_QEMU */