提交 b25027ba 编写于 作者: C Cole Robinson

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.
上级 7973c0ef
<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>
......
<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>
......
<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>
......
<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>
......
<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>
......
<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>
......
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册