1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-20 06:50:22 +03:00

tests: qemuargv2xml: Remove UUID randomness

Overwrite any randomly generated UUID to use a hardcoded value, so
we don't need to blank it when comparing XML.
This commit is contained in:
Cole Robinson 2016-02-16 11:13:21 -05:00
parent 7973c0efdf
commit b25027ba5d
7 changed files with 23 additions and 8 deletions

View File

@ -1,6 +1,6 @@
<domain type='qemu'>
<name>QEMUGuest2</name>
<uuid>c7a5fdbd-edaf-9466-926a-d65c16db1809</uuid>
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
<memory unit='KiB'>219100</memory>
<currentMemory unit='KiB'>219100</currentMemory>
<vcpu placement='static'>1</vcpu>

View File

@ -1,6 +1,6 @@
<domain type='qemu'>
<name>QEMUGuest1</name>
<uuid>8caaa98c-e7bf-5845-126a-1fc316bd1089</uuid>
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
<memory unit='KiB'>219100</memory>
<currentMemory unit='KiB'>219100</currentMemory>
<vcpu placement='static'>1</vcpu>

View File

@ -1,6 +1,6 @@
<domain type='qemu'>
<name>QEMUGuest1</name>
<uuid>8caaa98c-e7bf-5845-126a-1fc316bd1089</uuid>
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
<memory unit='KiB'>219100</memory>
<currentMemory unit='KiB'>219100</currentMemory>
<vcpu placement='static'>1</vcpu>

View File

@ -1,6 +1,6 @@
<domain type='qemu'>
<name>QEMUGuest1</name>
<uuid>8caaa98c-e7bf-5845-126a-1fc316bd1089</uuid>
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
<memory unit='KiB'>219100</memory>
<currentMemory unit='KiB'>219100</currentMemory>
<vcpu placement='static'>1</vcpu>

View File

@ -1,6 +1,6 @@
<domain type='qemu'>
<name>QEMUGuest1</name>
<uuid>87eedafe-eedc-4336-8130-ed9fe5dc90c8</uuid>
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
<memory unit='KiB'>524288</memory>
<currentMemory unit='KiB'>524288</currentMemory>
<vcpu placement='static'>1</vcpu>

View File

@ -1,6 +1,6 @@
<domain type='qemu'>
<name>QEMUGuest1</name>
<uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid>
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
<memory unit='KiB'>524288</memory>
<currentMemory unit='KiB'>524288</currentMemory>
<vcpu placement='static'>1</vcpu>

View File

@ -23,8 +23,7 @@ static virQEMUDriver driver;
static int blankProblemElements(char *data)
{
if (virtTestClearLineRegex("<uuid>([[:alnum:]]|-)+</uuid>", data) < 0 ||
virtTestClearLineRegex("<memory.*>[[:digit:]]+</memory>", data) < 0 ||
if (virtTestClearLineRegex("<memory.*>[[:digit:]]+</memory>", data) < 0 ||
virtTestClearLineRegex("<secret.*>", data) < 0 ||
virtTestClearLineRegex("<currentMemory.*>[[:digit:]]+</currentMemory>",
data) < 0)
@ -32,6 +31,19 @@ static int blankProblemElements(char *data)
return 0;
}
static int testSanitizeDef(virDomainDefPtr vmdef)
{
int ret = -1;
/* Remove UUID randomness */
if (virUUIDParse("c7a5fdbd-edaf-9455-926a-d65c16db1809", vmdef->uuid) < 0)
goto fail;
ret = 0;
fail:
return ret;
}
typedef enum {
FLAG_EXPECT_WARNING = 1 << 0,
} virQemuXML2ArgvTestFlags;
@ -79,6 +91,9 @@ static int testCompareXMLToArgvFiles(const char *xml,
}
}
if (testSanitizeDef(vmdef) < 0)
goto fail;
if (!virDomainDefCheckABIStability(vmdef, vmdef)) {
VIR_TEST_DEBUG("ABI stability check failed on %s", xml);
goto fail;