Skip to contentSkip to conversation

KVM test: scan_results.py: fix handling of empty result list

PATCH New Michael Goldish 1 participant 3 messages Jun 22, 2010 KVM

lore
Share & tools
lore
#1 lore raw

PATCH 1/1 KVM test: kvm_preprocessing.py: test for vm.is_alive() instead of vm.is_dead()

In reply to Michael Goldish

vm.is_alive() verifies that the monitor is responsive, which is required for taking screendumps.

---
 client/tests/kvm/kvm_preprocessing.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
client/tests/kvm/kvm_preprocessing.py +1 -1
index 1ed4ec2..ee279bd 100644
@@ -406,7 +406,7 @@ def _take_screendumps(test, params, env):
 
     while True:
         for vm in kvm_utils.env_get_all_vms(env):
-            if vm.is_dead():
+            if not vm.is_alive():
                 continue
             try:
                 vm.monitor.screendump(temp_filename)
Signature · 1 line
1.5.4.1
#2 lore raw

PATCH 1/1 KVM test: concentrate image and cdrom filename prefixes in tests.cfg.sample

Don't prefix image_name and cdrom at the end of tests_base.cfg.sample. Instead, do it all in tests.cfg.sample, to make it clearer to users editing the file.

---
 client/tests/kvm/tests.cfg.sample      |   10 ++++------
 client/tests/kvm/tests_base.cfg.sample |    2 --
 2 files changed, 4 insertions(+), 8 deletions(-)
client/tests/kvm/tests.cfg.sample +4 -6
index a55a320..b303686 100644
@@ -4,19 +4,17 @@
 include tests_base.cfg
 include cdkeys.cfg
 
-# Modify/comment the following lines if you wish to modify
-# the paths of the image files, ISO files, step files or qemu binaries.
+# Modify/comment the following lines if you wish to modify the paths of the
+# image files, ISO files or qemu binaries.
 #
 # As for the defaults:
 # * qemu and qemu-img are expected to be found under /usr/bin/qemu-kvm and
 #   /usr/bin/qemu-img respectively.
 # * All image files are expected under /tmp/kvm_autotest_root/images/
 # * All iso files are expected under /tmp/kvm_autotest_root/isos/
-# * All step files are expected under /tmp/kvm_autotest_root/steps/
 qemu_img_binary = /usr/bin/qemu-img
-image_name.* ?<= /tmp/kvm_autotest_root/
-cdrom.* ?<= /tmp/kvm_autotest_root/
-steps ?<= /tmp/kvm_autotest_root/
+image_name.* ?<= /tmp/kvm_autotest_root/images/
+cdrom.* ?<= /tmp/kvm_autotest_root/isos/
 
 # Here are the test sets variants. The variant 'qemu_kvm_windows_quick' is
 # fully commented, the following ones have comments only on noteworthy points
client/tests/kvm/tests_base.cfg.sample +0 -2
index ec61a5e..2c78cfc 100644
@@ -1447,6 +1447,4 @@ variants:
         devices_requested = 7
 
 
-image_name.* ?<= images/
-cdrom.* ?<= isos/
 steps ?<= steps/
Signature · 1 line
1.5.4.1
#0 lore raw

PATCH 1/1 KVM test: scan_results.py: fix handling of empty result list

If there are no test results, max() tries to operate on an empty sequence and throws an exception.

---
 client/tests/kvm/scan_results.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
client/tests/kvm/scan_results.py +1 -1
index f7073e4..a339a85 100755
@@ -74,7 +74,7 @@ def main(resfiles):
             continue
         results = parse_results(text)
         result_lists.append((resfile, results))
-        name_width = max(name_width, max(len(r[0]) for r in results))
+        name_width = max([name_width] + [len(r[0]) for r in results])
 
     print_result(("Test", "Status", "Seconds", "Info"), name_width)
     print_result(("----", "------", "-------", "----"), name_width)
Signature · 1 line
1.5.4.1