[KVM-AUTOTEST PATCH] KVM test: scan_results.py: fix handling of empty result list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Signed-off-by: Michael Goldish <mgoldish@xxxxxxxxxx>
---
 client/tests/kvm/scan_results.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/client/tests/kvm/scan_results.py b/client/tests/kvm/scan_results.py
index f7073e4..a339a85 100755
--- a/client/tests/kvm/scan_results.py
+++ b/client/tests/kvm/scan_results.py
@@ -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)
-- 
1.5.4.1

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux