summaryrefslogtreecommitdiff
path: root/tests/sexpr2xmltest.c
diff options
context:
space:
mode:
authorCole Robinson <crobinso@redhat.com>2015-04-23 11:14:26 -0400
committerCole Robinson <crobinso@redhat.com>2015-04-23 17:08:48 -0400
commitca32929908bbc94116493ad8915e7cd7ae0f57d5 (patch)
tree8a16bac5dff57315ae91b10d3fdf7cc007419e43 /tests/sexpr2xmltest.c
parentbdbe26b50423f8c5df6f9f2804a0e93c87577394 (diff)
downloadlibvirt-ca32929908bbc94116493ad8915e7cd7ae0f57d5.tar.gz
tests: Add virtTestCompareToFile
Replaces a common pattern used in many test files
Diffstat (limited to 'tests/sexpr2xmltest.c')
-rw-r--r--tests/sexpr2xmltest.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/tests/sexpr2xmltest.c b/tests/sexpr2xmltest.c
index 7247414c19..99999f1e6a 100644
--- a/tests/sexpr2xmltest.c
+++ b/tests/sexpr2xmltest.c
@@ -21,7 +21,6 @@ static virCapsPtr caps;
static int
testCompareFiles(const char *xml, const char *sexpr, int xendConfigVersion)
{
- char *xmlData = NULL;
char *sexprData = NULL;
char *gotxml = NULL;
int id;
@@ -36,9 +35,6 @@ testCompareFiles(const char *xml, const char *sexpr, int xendConfigVersion)
conn = virGetConnect();
if (!conn) goto fail;
- if (virtTestLoadFile(xml, &xmlData) < 0)
- goto fail;
-
if (virtTestLoadFile(sexpr, &sexprData) < 0)
goto fail;
@@ -68,15 +64,12 @@ testCompareFiles(const char *xml, const char *sexpr, int xendConfigVersion)
if (!(gotxml = virDomainDefFormat(def, 0)))
goto fail;
- if (STRNEQ(xmlData, gotxml)) {
- virtTestDifference(stderr, xmlData, gotxml);
+ if (virtTestCompareToFile(gotxml, xml) < 0)
goto fail;
- }
ret = 0;
fail:
- VIR_FREE(xmlData);
VIR_FREE(sexprData);
VIR_FREE(gotxml);
virDomainDefFree(def);