mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 17:34:18 +03:00
tests: Rename virtTestCompareToFile to virTestCompareToFile.
This function doesn't follow our convention of naming functions.
This commit is contained in:
parent
401bb813bd
commit
239caffb1d
@ -66,14 +66,14 @@ static int testCompareXMLToArgvFiles(const char *xml,
|
|||||||
if (!(actualld = virCommandToString(ldcmd)))
|
if (!(actualld = virCommandToString(ldcmd)))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (virtTestCompareToFile(actualargv, cmdline) < 0)
|
if (virTestCompareToFile(actualargv, cmdline) < 0)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (virtTestCompareToFile(actualld, ldcmdline) < 0)
|
if (virTestCompareToFile(actualld, ldcmdline) < 0)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (virFileExists(dmcmdline) || actualdm) {
|
if (virFileExists(dmcmdline) || actualdm) {
|
||||||
if (virtTestCompareToFile(actualdm, dmcmdline) < 0)
|
if (virTestCompareToFile(actualdm, dmcmdline) < 0)
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,7 +168,7 @@ cpuTestCompareXML(const char *arch,
|
|||||||
if (!(actual = virCPUDefFormat(cpu, NULL, updateCPU)))
|
if (!(actual = virCPUDefFormat(cpu, NULL, updateCPU)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (virtTestCompareToFile(actual, xml) < 0)
|
if (virTestCompareToFile(actual, xml) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
@ -217,7 +217,7 @@ test_virDomainCapsFormat(const void *opaque)
|
|||||||
if (!(domCapsXML = virDomainCapsFormat(domCaps)))
|
if (!(domCapsXML = virDomainCapsFormat(domCaps)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (virtTestCompareToFile(domCapsXML, path) < 0)
|
if (virTestCompareToFile(domCapsXML, path) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
@ -45,7 +45,7 @@ testCompareXMLToConfigFiles(const char *xmlfile,
|
|||||||
if (!(actualxml = virDomainDefFormat(vmdef, caps, 0)))
|
if (!(actualxml = virDomainDefFormat(vmdef, caps, 0)))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (virtTestCompareToFile(actualxml, xmlfile) < 0)
|
if (virTestCompareToFile(actualxml, xmlfile) < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ testCompareXMLToConfFiles(const char *inxml, const char *outconf, dnsmasqCapsPtr
|
|||||||
dctx, caps) < 0)
|
dctx, caps) < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (virtTestCompareToFile(actual, outconf) < 0)
|
if (virTestCompareToFile(actual, outconf) < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
@ -68,7 +68,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
|
|||||||
virtTestClearCommandPath(actualargv);
|
virtTestClearCommandPath(actualargv);
|
||||||
virCommandSetDryRun(NULL, NULL, NULL);
|
virCommandSetDryRun(NULL, NULL, NULL);
|
||||||
|
|
||||||
if (virtTestCompareToFile(actualargv, cmdline) < 0)
|
if (virTestCompareToFile(actualargv, cmdline) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
@ -47,7 +47,7 @@ testCompareXMLToXMLFiles(const char *inxml, const char *outxml,
|
|||||||
if (expectResult == TEST_COMPARE_NET_XML2XML_RESULT_FAIL_FORMAT)
|
if (expectResult == TEST_COMPARE_NET_XML2XML_RESULT_FAIL_FORMAT)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (virtTestCompareToFile(actual, outxml) < 0) {
|
if (virTestCompareToFile(actual, outxml) < 0) {
|
||||||
result = TEST_COMPARE_NET_XML2XML_RESULT_FAIL_COMPARE;
|
result = TEST_COMPARE_NET_XML2XML_RESULT_FAIL_COMPARE;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ testCompareXMLToXMLFiles(const char *netxml, const char *updatexml,
|
|||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (!expectFailure) {
|
if (!expectFailure) {
|
||||||
if (virtTestCompareToFile(actual, outxml) < 0)
|
if (virTestCompareToFile(actual, outxml) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ linuxTestCompareFiles(char *sysfs_prefix,
|
|||||||
nodeinfo.cores, nodeinfo.threads) < 0)
|
nodeinfo.cores, nodeinfo.threads) < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (virtTestCompareToFile(actualData, outputfile) < 0)
|
if (virTestCompareToFile(actualData, outputfile) < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
@ -137,7 +137,7 @@ linuxCPUStatsCompareFiles(const char *cpustatfile,
|
|||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virtTestCompareToFile(actualData, outfile) < 0)
|
if (virTestCompareToFile(actualData, outfile) < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
@ -405,7 +405,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
|
|||||||
|
|
||||||
testRemoveCommonRules(actualargv);
|
testRemoveCommonRules(actualargv);
|
||||||
|
|
||||||
if (virtTestCompareToFile(actualargv, cmdline) < 0)
|
if (virTestCompareToFile(actualargv, cmdline) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
@ -40,7 +40,7 @@ testCompareXMLToXMLFiles(const char *inxml, const char *outxml,
|
|||||||
if (!(actual = virNWFilterDefFormat(dev)))
|
if (!(actual = virNWFilterDefFormat(dev)))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (virtTestCompareToFile(actual, outxml) < 0)
|
if (virTestCompareToFile(actual, outxml) < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
@ -103,7 +103,7 @@ static int testCompareXMLToArgvFiles(const char *xmlfile,
|
|||||||
if (!(actualxml = virDomainDefFormat(vmdef, driver.caps, 0)))
|
if (!(actualxml = virDomainDefFormat(vmdef, driver.caps, 0)))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (virtTestCompareToFile(actualxml, xmlfile) < 0)
|
if (virTestCompareToFile(actualxml, xmlfile) < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
@ -118,7 +118,7 @@ testQemuCaps(const void *opaque)
|
|||||||
if (!(actual = virQEMUCapsFormatCache(capsActual, 0, 0)))
|
if (!(actual = virQEMUCapsFormatCache(capsActual, 0, 0)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (virtTestCompareToFile(actual, capsFile) < 0)
|
if (virTestCompareToFile(actual, capsFile) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
@ -145,7 +145,7 @@ testQemuCapsXML(const void *opaque)
|
|||||||
if (!capsXml)
|
if (!capsXml)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (virtTestCompareToFile(capsXml, xmlFile) < 0)
|
if (virTestCompareToFile(capsXml, xmlFile) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
@ -2189,7 +2189,7 @@ testQemuMonitorJSONGetCPUData(const void *opaque)
|
|||||||
if (!(actual = cpuDataFormat(cpuData)))
|
if (!(actual = cpuDataFormat(cpuData)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (virtTestCompareToFile(actual, dataFile) < 0)
|
if (virTestCompareToFile(actual, dataFile) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
@ -340,7 +340,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
|
|||||||
if (!(actualargv = virCommandToString(cmd)))
|
if (!(actualargv = virCommandToString(cmd)))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (virtTestCompareToFile(actualargv, cmdline) < 0)
|
if (virTestCompareToFile(actualargv, cmdline) < 0)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
@ -21,7 +21,7 @@ testCompareXMLToXMLFiles(const char *inxml, const char *outxml)
|
|||||||
if (!(actual = virSecretDefFormat(secret)))
|
if (!(actual = virSecretDefFormat(secret)))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (virtTestCompareToFile(actual, outxml) < 0)
|
if (virTestCompareToFile(actual, outxml) < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
@ -65,7 +65,7 @@ testCompareFiles(const char *xml, const char *sexpr)
|
|||||||
if (!(gotxml = virDomainDefFormat(def, caps, 0)))
|
if (!(gotxml = virDomainDefFormat(def, caps, 0)))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (virtTestCompareToFile(gotxml, xml) < 0)
|
if (virTestCompareToFile(gotxml, xml) < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
@ -29,7 +29,7 @@ testCompareXMLToXMLFiles(const char *inxml, const char *outxml)
|
|||||||
if (!(actual = virStoragePoolDefFormat(dev)))
|
if (!(actual = virStoragePoolDefFormat(dev)))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (virtTestCompareToFile(actual, outxml) < 0)
|
if (virTestCompareToFile(actual, outxml) < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
@ -95,7 +95,7 @@ testCompareXMLToArgvFiles(bool shouldFail,
|
|||||||
if (!(actualCmdline = virCommandToString(cmd)))
|
if (!(actualCmdline = virCommandToString(cmd)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (virtTestCompareToFile(actualCmdline, cmdline) < 0)
|
if (virTestCompareToFile(actualCmdline, cmdline) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
@ -34,7 +34,7 @@ testCompareXMLToXMLFiles(const char *poolxml, const char *inxml,
|
|||||||
if (!(actual = virStorageVolDefFormat(pool, dev)))
|
if (!(actual = virStorageVolDefFormat(pool, dev)))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (virtTestCompareToFile(actual, outxml) < 0)
|
if (virTestCompareToFile(actual, outxml) < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
@ -79,7 +79,7 @@ testSysinfo(const void *data)
|
|||||||
if (!(sysfsActualData = virBufferCurrentContent(&buf)))
|
if (!(sysfsActualData = virBufferCurrentContent(&buf)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (virtTestCompareToFile(sysfsActualData, testdata->expected) < 0)
|
if (virTestCompareToFile(sysfsActualData, testdata->expected) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
result = 0;
|
result = 0;
|
||||||
|
@ -686,8 +686,8 @@ int virtTestDifferenceBin(FILE *stream,
|
|||||||
* @param filename: File to compare strcontent against
|
* @param filename: File to compare strcontent against
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
virtTestCompareToFile(const char *strcontent,
|
virTestCompareToFile(const char *strcontent,
|
||||||
const char *filename)
|
const char *filename)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
char *filecontent = NULL;
|
char *filecontent = NULL;
|
||||||
@ -1138,7 +1138,7 @@ testCompareDomXML2XMLFiles(virCapsPtr caps, virDomainXMLOptionPtr xmlopt,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virtTestCompareToFile(actual, outfile) < 0) {
|
if (virTestCompareToFile(actual, outfile) < 0) {
|
||||||
result = TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_COMPARE;
|
result = TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_COMPARE;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -73,8 +73,8 @@ int virtTestDifferenceBin(FILE *stream,
|
|||||||
const char *expect,
|
const char *expect,
|
||||||
const char *actual,
|
const char *actual,
|
||||||
size_t length);
|
size_t length);
|
||||||
int virtTestCompareToFile(const char *strcontent,
|
int virTestCompareToFile(const char *strcontent,
|
||||||
const char *filename);
|
const char *filename);
|
||||||
|
|
||||||
unsigned int virTestGetDebug(void);
|
unsigned int virTestGetDebug(void);
|
||||||
unsigned int virTestGetVerbose(void);
|
unsigned int virTestGetVerbose(void);
|
||||||
|
@ -120,7 +120,7 @@ test_virCapabilitiesFormat(const void *opaque)
|
|||||||
abs_srcdir, data->filename) < 0)
|
abs_srcdir, data->filename) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (virtTestCompareToFile(capsXML, path) < 0)
|
if (virTestCompareToFile(capsXML, path) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
@ -190,7 +190,7 @@ testCgroupDetectMounts(const void *args)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
actual = virBufferCurrentContent(&buf);
|
actual = virBufferCurrentContent(&buf);
|
||||||
if (virtTestCompareToFile(actual, parsed) < 0)
|
if (virTestCompareToFile(actual, parsed) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
result = 0;
|
result = 0;
|
||||||
|
@ -258,7 +258,7 @@ static int testExecRestart(const void *opaque)
|
|||||||
if (!(outjsonstr = virJSONValueToString(outjson, true)))
|
if (!(outjsonstr = virJSONValueToString(outjson, true)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (virtTestCompareToFile(outjsonstr, outfile) < 0)
|
if (virTestCompareToFile(outjsonstr, outfile) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
@ -90,7 +90,7 @@ testCompareFiles(const char *vmx, const char *xml)
|
|||||||
VIR_DOMAIN_DEF_FORMAT_SECURE)))
|
VIR_DOMAIN_DEF_FORMAT_SECURE)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (virtTestCompareToFile(formatted, xml) < 0)
|
if (virTestCompareToFile(formatted, xml) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
@ -45,7 +45,7 @@ testCompareFiles(virArch hostmachine, const char *xml_rel,
|
|||||||
if (!(actualxml = virCapabilitiesFormatXML(caps)))
|
if (!(actualxml = virCapabilitiesFormatXML(caps)))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (virtTestCompareToFile(actualxml, xml) < 0)
|
if (virTestCompareToFile(actualxml, xml) < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
@ -79,7 +79,7 @@ testCompareParseXML(const char *xlcfg, const char *xml)
|
|||||||
goto fail;
|
goto fail;
|
||||||
gotxlcfgData[wrote] = '\0';
|
gotxlcfgData[wrote] = '\0';
|
||||||
|
|
||||||
if (virtTestCompareToFile(gotxlcfgData, xlcfg) < 0)
|
if (virTestCompareToFile(gotxlcfgData, xlcfg) < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
@ -124,7 +124,7 @@ testCompareFormatXML(const char *xlcfg, const char *xml)
|
|||||||
VIR_DOMAIN_XML_SECURE)))
|
VIR_DOMAIN_XML_SECURE)))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (virtTestCompareToFile(gotxml, xml) < 0)
|
if (virTestCompareToFile(gotxml, xml) < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
@ -79,7 +79,7 @@ testCompareParseXML(const char *xmcfg, const char *xml)
|
|||||||
goto fail;
|
goto fail;
|
||||||
gotxmcfgData[wrote] = '\0';
|
gotxmcfgData[wrote] = '\0';
|
||||||
|
|
||||||
if (virtTestCompareToFile(gotxmcfgData, xmcfg) < 0)
|
if (virTestCompareToFile(gotxmcfgData, xmcfg) < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
@ -124,7 +124,7 @@ testCompareFormatXML(const char *xmcfg, const char *xml)
|
|||||||
if (!(gotxml = virDomainDefFormat(def, caps, VIR_DOMAIN_DEF_FORMAT_SECURE)))
|
if (!(gotxml = virDomainDefFormat(def, caps, VIR_DOMAIN_DEF_FORMAT_SECURE)))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (virtTestCompareToFile(gotxml, xml) < 0)
|
if (virTestCompareToFile(gotxml, xml) < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
@ -39,7 +39,7 @@ testCompareFiles(const char *xml, const char *sexpr)
|
|||||||
if (!(gotsexpr = xenFormatSxpr(NULL, def)))
|
if (!(gotsexpr = xenFormatSxpr(NULL, def)))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (virtTestCompareToFile(gotsexpr, sexpr) < 0)
|
if (virTestCompareToFile(gotsexpr, sexpr) < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
@ -91,7 +91,7 @@ testCompareFiles(const char *xml, const char *vmx, int virtualHW_version)
|
|||||||
if (formatted == NULL)
|
if (formatted == NULL)
|
||||||
goto failure;
|
goto failure;
|
||||||
|
|
||||||
if (virtTestCompareToFile(formatted, vmx) < 0)
|
if (virTestCompareToFile(formatted, vmx) < 0)
|
||||||
goto failure;
|
goto failure;
|
||||||
|
|
||||||
result = 0;
|
result = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user