[AUTOTEST PATCH 1/2] KVM-test: Fix a bug that about list slice in scan_results.py

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

 



If 'info_list' is empty slice operation can result in traceback:

...
      info_list[-1] = parts[5]
  IndexError: list assignment index out of range

Signed-off-by: Yolkfull Chow <yzhou@xxxxxxxxxx>
---
 client/tests/kvm/scan_results.py |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/client/tests/kvm/scan_results.py b/client/tests/kvm/scan_results.py
index f7bafa9..1daff2f 100755
--- a/client/tests/kvm/scan_results.py
+++ b/client/tests/kvm/scan_results.py
@@ -45,6 +45,7 @@ def parse_results(text):
         # Found a FAIL/ERROR/GOOD line -- get failure/success info
         elif (len(parts) >= 6 and parts[3].startswith("timestamp") and
               parts[4].startswith("localtime")):
+            info_list.append("")
             info_list[-1] = parts[5]
 
     return result_list
-- 
1.6.6

--
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