[virt-tools-list] [virt-manager PATCH] virt-xml: fix a terminal_width depends issue

Chen Hanxiao chenhanxiao at cn.fujitsu.com
Fri Feb 7 07:02:27 UTC 2014


From: Chen Hanxiao <chenhanxiao at cn.fujitsu.com>

One of virt-xml test case will output logs by
urlgrabber.process, which will get the real width of
terminals.
If we resize terminal, of who is running test, from
80 to other size, test case will fail.
This patch will screen it when running test case.

Signed-off-by: Chen Hanxiao <chenhanxiao at cn.fujitsu.com>
---
 tests/__init__.py                                              |  1 +
 tests/cli-test-xml/compare/virtxml-add-disk-create-storage.xml |  2 --
 virt-xml                                                       | 10 +++++++---
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/tests/__init__.py b/tests/__init__.py
index 237cbb8..92f429b 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -22,6 +22,7 @@ import os
 
 os.environ["VIRTINST_TEST_TRACKPROPS"] = "1"
 os.environ["VIRTINST_TEST_SUITE"] = "1"
+os.environ["VIRTINST_TEST_CLI_VIRTXML"] = "1"
 
 import virtinst
 virtinst.stable_defaults = False
diff --git a/tests/cli-test-xml/compare/virtxml-add-disk-create-storage.xml b/tests/cli-test-xml/compare/virtxml-add-disk-create-storage.xml
index 85cfbfc..687df17 100644
--- a/tests/cli-test-xml/compare/virtxml-add-disk-create-storage.xml
+++ b/tests/cli-test-xml/compare/virtxml-add-disk-create-storage.xml
@@ -8,7 +8,5 @@
    </devices>
  </domain>
 
-
-Creating storage file __virtinst_cli_new1.img            |  10 MB     00:00     
 Domain 'test-many-devices' defined successfully.
 Changes will take effect after the next domain shutdown.
\ No newline at end of file
diff --git a/virt-xml b/virt-xml
index fdb0113..8ca0fc4 100755
--- a/virt-xml
+++ b/virt-xml
@@ -240,9 +240,13 @@ def setup_device(dev):
         return
 
     logging.debug("Doing setup for disk=%s", dev)
-    meter = (cli.quiet and
-             progress.BaseMeter() or
-             progress.TextMeter(fo=sys.stdout))
+
+    if "VIRTINST_TEST_CLI_VIRTXML" in os.environ:
+        meter = progress.BaseMeter()
+    else:
+        meter = (cli.quiet and
+                 progress.BaseMeter() or
+                 progress.TextMeter(fo=sys.stdout))
 
     dev.setup(meter)
     dev.virt_xml_setup = True
-- 
1.8.2.1




More information about the virt-tools-list mailing list