[libvirt] [PATCH 04/10] tests.testutils: use virTestDifferenceFull in virtTestCompareToFile

Pavel Hrdina phrdina at redhat.com
Thu Jan 7 11:32:36 UTC 2016


Let's use the new virTestDifferenceFull function that will regenerate
the expected output and fail the test to let developer know that there
something was updated.

Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
---
 tests/testutils.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/tests/testutils.c b/tests/testutils.c
index 70e3456..6645d61 100644
--- a/tests/testutils.c
+++ b/tests/testutils.c
@@ -670,16 +670,12 @@ virtTestCompareToFile(const char *strcontent,
 
     if (STRNEQ_NULLABLE(fixedcontent ? fixedcontent : strcontent,
                         filecontent)) {
-        if (virTestGetRegenerate()) {
-            if (virFileWriteStr(filename, strcontent, 0666) < 0)
-                goto failure;
-            goto out;
-        }
-        virtTestDifference(stderr, filecontent, strcontent);
+        virtTestDifferenceFull(stderr,
+                               filecontent, filename,
+                               strcontent, NULL);
         goto failure;
     }
 
- out:
     ret = 0;
  failure:
     VIR_FREE(fixedcontent);
-- 
2.7.0




More information about the libvir-list mailing list