From 7b8e850bc0a702f4ee8084edb75bea203fd486ae Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Sat, 6 Dec 2014 16:32:10 -0500 Subject: [PATCH] clitest: Sanitize diff output some more --- .../cli-test-xml/compare/virt-xml-edit-clear-clock.xml | 2 +- tests/cli-test-xml/compare/virt-xml-edit-clear-cpu.xml | 2 +- .../cli-test-xml/compare/virt-xml-edit-simple-cpu.xml | 2 +- .../compare/virt-xml-edit-simple-memory.xml | 2 +- .../compare/virt-xml-edit-simple-metadata.xml | 2 +- .../compare/virt-xml-edit-simple-vcpus.xml | 2 +- .../cli-test-xml/compare/virt-xml-remove-disk-path.xml | 2 +- tests/clitest.py | 10 +++++++++- 8 files changed, 16 insertions(+), 8 deletions(-) diff --git a/tests/cli-test-xml/compare/virt-xml-edit-clear-clock.xml b/tests/cli-test-xml/compare/virt-xml-edit-clear-clock.xml index 537419492..6a613cf49 100644 --- a/tests/cli-test-xml/compare/virt-xml-edit-clear-clock.xml +++ b/tests/cli-test-xml/compare/virt-xml-edit-clear-clock.xml @@ -9,7 +9,7 @@ destroy restart restart -@@ -369,4 +364,5 @@ +@@
diff --git a/tests/cli-test-xml/compare/virt-xml-edit-clear-cpu.xml b/tests/cli-test-xml/compare/virt-xml-edit-clear-cpu.xml index c9470458f..cb39731b4 100644 --- a/tests/cli-test-xml/compare/virt-xml-edit-clear-cpu.xml +++ b/tests/cli-test-xml/compare/virt-xml-edit-clear-cpu.xml @@ -21,7 +21,7 @@ -@@ -369,4 +352,5 @@ +@@
diff --git a/tests/cli-test-xml/compare/virt-xml-edit-simple-cpu.xml b/tests/cli-test-xml/compare/virt-xml-edit-simple-cpu.xml index e4433f75e..48d250e38 100644 --- a/tests/cli-test-xml/compare/virt-xml-edit-simple-cpu.xml +++ b/tests/cli-test-xml/compare/virt-xml-edit-simple-cpu.xml @@ -9,7 +9,7 @@ -@@ -53,6 +53,7 @@ +@@ diff --git a/tests/cli-test-xml/compare/virt-xml-edit-simple-memory.xml b/tests/cli-test-xml/compare/virt-xml-edit-simple-memory.xml index 7eb08ab6f..9e0430ce3 100644 --- a/tests/cli-test-xml/compare/virt-xml-edit-simple-memory.xml +++ b/tests/cli-test-xml/compare/virt-xml-edit-simple-memory.xml @@ -8,7 +8,7 @@ 100 -@@ -14,7 +14,6 @@ +@@ diff --git a/tests/cli-test-xml/compare/virt-xml-edit-simple-metadata.xml b/tests/cli-test-xml/compare/virt-xml-edit-simple-metadata.xml index d0f8d6ccf..d4fe5e933 100644 --- a/tests/cli-test-xml/compare/virt-xml-edit-simple-metadata.xml +++ b/tests/cli-test-xml/compare/virt-xml-edit-simple-metadata.xml @@ -12,7 +12,7 @@ 409600 204800 -@@ -369,4 +369,5 @@ +@@
diff --git a/tests/cli-test-xml/compare/virt-xml-edit-simple-vcpus.xml b/tests/cli-test-xml/compare/virt-xml-edit-simple-vcpus.xml index 20989f215..d24ef9fa6 100644 --- a/tests/cli-test-xml/compare/virt-xml-edit-simple-vcpus.xml +++ b/tests/cli-test-xml/compare/virt-xml-edit-simple-vcpus.xml @@ -6,7 +6,7 @@ -@@ -53,6 +53,7 @@ +@@ diff --git a/tests/cli-test-xml/compare/virt-xml-remove-disk-path.xml b/tests/cli-test-xml/compare/virt-xml-remove-disk-path.xml index 30bd40d78..187f857a6 100644 --- a/tests/cli-test-xml/compare/virt-xml-remove-disk-path.xml +++ b/tests/cli-test-xml/compare/virt-xml-remove-disk-path.xml @@ -10,7 +10,7 @@ -@@ -92,12 +86,6 @@ +@@
diff --git a/tests/clitest.py b/tests/clitest.py index feaf4138a..15b4bea92 100644 --- a/tests/clitest.py +++ b/tests/clitest.py @@ -248,7 +248,15 @@ class Command(object): file(filename, "w").write(output) if "--print-diff" in self.argv and output.count("\n") > 3: - output = "\n".join(output.splitlines()[3:]) + # 1) Strip header + # 2) Simplify context lines to reduce churn when + # libvirt or testdriver changes + newlines = [] + for line in output.splitlines()[3:]: + if line.startswith("@@"): + line = "@@" + newlines.append(line) + output = "\n".join(newlines) utils.diff_compare(output, filename)