mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
qemuxml2argvtest: drop FLAG_EXPECT_ERROR
It is only used for failed address allocation Since we already have FLAG_EXPECT_FAILURE, use that instead. Also unify the output to print the whole log buffer instead of just the last error message.
This commit is contained in:
parent
f36c9f7b6c
commit
1922d2f11e
@ -242,11 +242,10 @@ static virStorageDriver fakeStorageDriver = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
FLAG_EXPECT_ERROR = 1 << 0,
|
FLAG_EXPECT_FAILURE = 1 << 0,
|
||||||
FLAG_EXPECT_FAILURE = 1 << 1,
|
FLAG_EXPECT_PARSE_ERROR = 1 << 1,
|
||||||
FLAG_EXPECT_PARSE_ERROR = 1 << 2,
|
FLAG_JSON = 1 << 2,
|
||||||
FLAG_JSON = 1 << 3,
|
FLAG_FIPS = 1 << 3,
|
||||||
FLAG_FIPS = 1 << 4,
|
|
||||||
} virQemuXML2ArgvTestFlags;
|
} virQemuXML2ArgvTestFlags;
|
||||||
|
|
||||||
static int testCompareXMLToArgvFiles(const char *xml,
|
static int testCompareXMLToArgvFiles(const char *xml,
|
||||||
@ -313,7 +312,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
|
|||||||
virQEMUCapsFilterByMachineType(extraFlags, vm->def->os.machine);
|
virQEMUCapsFilterByMachineType(extraFlags, vm->def->os.machine);
|
||||||
|
|
||||||
if (qemuDomainAssignAddresses(vm->def, extraFlags, NULL)) {
|
if (qemuDomainAssignAddresses(vm->def, extraFlags, NULL)) {
|
||||||
if (flags & FLAG_EXPECT_ERROR)
|
if (flags & FLAG_EXPECT_FAILURE)
|
||||||
goto ok;
|
goto ok;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@ -354,20 +353,15 @@ static int testCompareXMLToArgvFiles(const char *xml,
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
ok:
|
ok:
|
||||||
if (ret == 0 &&
|
if (ret == 0 && flags & FLAG_EXPECT_FAILURE) {
|
||||||
((flags & FLAG_EXPECT_ERROR) ||
|
|
||||||
(flags & FLAG_EXPECT_FAILURE))) {
|
|
||||||
ret = -1;
|
ret = -1;
|
||||||
VIR_TEST_DEBUG("Error expected but there wasn't any.\n");
|
VIR_TEST_DEBUG("Error expected but there wasn't any.\n");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (!virtTestOOMActive()) {
|
if (!virtTestOOMActive()) {
|
||||||
if (flags & FLAG_EXPECT_ERROR) {
|
if (flags & FLAG_EXPECT_FAILURE) {
|
||||||
if ((log = virtTestLogContentAndReset()))
|
if ((log = virtTestLogContentAndReset()))
|
||||||
VIR_TEST_DEBUG("Got expected error: \n%s", log);
|
VIR_TEST_DEBUG("Got expected error: \n%s", log);
|
||||||
} else if (flags & FLAG_EXPECT_FAILURE) {
|
|
||||||
VIR_TEST_DEBUG("Got expected failure: %s\n",
|
|
||||||
virGetLastErrorMessage());
|
|
||||||
}
|
}
|
||||||
virResetLastError();
|
virResetLastError();
|
||||||
ret = 0;
|
ret = 0;
|
||||||
@ -533,20 +527,17 @@ mymain(void)
|
|||||||
# define DO_TEST(name, ...) \
|
# define DO_TEST(name, ...) \
|
||||||
DO_TEST_FULL(name, NULL, -1, 0, 0, __VA_ARGS__)
|
DO_TEST_FULL(name, NULL, -1, 0, 0, __VA_ARGS__)
|
||||||
|
|
||||||
# define DO_TEST_ERROR(name, ...) \
|
|
||||||
DO_TEST_FULL(name, NULL, -1, FLAG_EXPECT_ERROR, 0, __VA_ARGS__)
|
|
||||||
|
|
||||||
# define DO_TEST_FAILURE(name, ...) \
|
# define DO_TEST_FAILURE(name, ...) \
|
||||||
DO_TEST_FULL(name, NULL, -1, FLAG_EXPECT_FAILURE, 0, __VA_ARGS__)
|
DO_TEST_FULL(name, NULL, -1, FLAG_EXPECT_FAILURE, 0, __VA_ARGS__)
|
||||||
|
|
||||||
# define DO_TEST_PARSE_ERROR(name, ...) \
|
# define DO_TEST_PARSE_ERROR(name, ...) \
|
||||||
DO_TEST_FULL(name, NULL, -1, \
|
DO_TEST_FULL(name, NULL, -1, \
|
||||||
FLAG_EXPECT_PARSE_ERROR | FLAG_EXPECT_ERROR, \
|
FLAG_EXPECT_PARSE_ERROR | FLAG_EXPECT_FAILURE, \
|
||||||
0, __VA_ARGS__)
|
0, __VA_ARGS__)
|
||||||
|
|
||||||
# define DO_TEST_PARSE_FLAGS_ERROR(name, parseFlags, ...) \
|
# define DO_TEST_PARSE_FLAGS_ERROR(name, parseFlags, ...) \
|
||||||
DO_TEST_FULL(name, NULL, -1, \
|
DO_TEST_FULL(name, NULL, -1, \
|
||||||
FLAG_EXPECT_PARSE_ERROR | FLAG_EXPECT_ERROR, \
|
FLAG_EXPECT_PARSE_ERROR | FLAG_EXPECT_FAILURE, \
|
||||||
parseFlags, __VA_ARGS__)
|
parseFlags, __VA_ARGS__)
|
||||||
|
|
||||||
# define DO_TEST_LINUX(name, ...) \
|
# define DO_TEST_LINUX(name, ...) \
|
||||||
@ -1389,7 +1380,7 @@ mymain(void)
|
|||||||
QEMU_CAPS_PCI_OHCI, QEMU_CAPS_PCI_MULTIFUNCTION);
|
QEMU_CAPS_PCI_OHCI, QEMU_CAPS_PCI_MULTIFUNCTION);
|
||||||
DO_TEST("pseries-vio-user-assigned",
|
DO_TEST("pseries-vio-user-assigned",
|
||||||
QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG);
|
QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG);
|
||||||
DO_TEST_ERROR("pseries-vio-address-clash",
|
DO_TEST_FAILURE("pseries-vio-address-clash",
|
||||||
QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG);
|
QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG);
|
||||||
DO_TEST("pseries-nvram", QEMU_CAPS_DEVICE_NVRAM);
|
DO_TEST("pseries-nvram", QEMU_CAPS_DEVICE_NVRAM);
|
||||||
DO_TEST("pseries-usb-kbd", QEMU_CAPS_PCI_OHCI,
|
DO_TEST("pseries-usb-kbd", QEMU_CAPS_PCI_OHCI,
|
||||||
@ -1552,7 +1543,7 @@ mymain(void)
|
|||||||
QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
|
QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
|
||||||
QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL);
|
QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL);
|
||||||
|
|
||||||
DO_TEST_ERROR("pcie-root-port-too-many",
|
DO_TEST_FAILURE("pcie-root-port-too-many",
|
||||||
QEMU_CAPS_DEVICE_PCI_BRIDGE,
|
QEMU_CAPS_DEVICE_PCI_BRIDGE,
|
||||||
QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
|
QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
|
||||||
QEMU_CAPS_DEVICE_IOH3420,
|
QEMU_CAPS_DEVICE_IOH3420,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user