[09/12] tests: qemuxml2xml: Use standard file comparison helpers

Message ID a85a6d4f57e17d6fcdb5ee8f11ee200bc243fa2d.1452224621.git.crobinso@redhat.com
State New
Headers show

Commit Message

Cole Robinson Jan. 8, 2016, 3:50 a.m.
This also makes VIR_TEST_REGENERATE_OUTPUT work
---
 tests/qemuxml2xmltest.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

-- 
2.5.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Comments

Cole Robinson Jan. 9, 2016, 12:14 a.m. | #1
On 01/08/2016 02:09 AM, Peter Krempa wrote:
> On Thu, Jan 07, 2016 at 22:50:03 -0500, Cole Robinson wrote:

>> This also makes VIR_TEST_REGENERATE_OUTPUT work

>> ---

>>  tests/qemuxml2xmltest.c | 6 ++----

>>  1 file changed, 2 insertions(+), 4 deletions(-)

>>

>> diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c

>> index f967ceb..e3bd9c2 100644

>> --- a/tests/qemuxml2xmltest.c

>> +++ b/tests/qemuxml2xmltest.c

>> @@ -43,7 +43,7 @@ static int

>>  testXML2XMLHelper(const char *inxml,

>>                    const char *inXmlData,

>>                    const char *outxml,

>> -                  const char *outXmlData,

>> +                  const char *outXmlData ATTRIBUTE_UNUSED,

> 

> Since there are just two callers of this you might as well as remove

> this argument rather than making it unused.

> 


Good point. I dropped this in favor of a bigger cleanup anyways, see just
posted patches

Thanks,
Cole

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Patch

diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index f967ceb..e3bd9c2 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -43,7 +43,7 @@  static int
 testXML2XMLHelper(const char *inxml,
                   const char *inXmlData,
                   const char *outxml,
-                  const char *outXmlData,
+                  const char *outXmlData ATTRIBUTE_UNUSED,
                   bool live)
 {
     char *actual = NULL;
@@ -66,10 +66,8 @@  testXML2XMLHelper(const char *inxml,
     if (!(actual = virDomainDefFormat(def, format_flags)))
         goto fail;
 
-    if (STRNEQ(outXmlData, actual)) {
-        virtTestDifferenceFull(stderr, outXmlData, outxml, actual, inxml);
+    if (virtTestCompareToFile(actual, outxml) < 0)
         goto fail;
-    }
 
     ret = 0;