Re: [Autotest] [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]

 



GOOD/FAIL/ERROR lines are always preceded by START lines, and info_list
is appended a "" when parsing a START line, so it seems unreasonable
for info_list to be empty when parsing a GOOD/FAIL/ERROR line.
What file did you parse when you got that exception?  Can you reproduce
the problem and show me the file that caused it?
I guess the file was either corrupt, or of an unknown new format.
If the latter is true, we should study the new format and modify the
code accordingly.

----- "Yolkfull Chow" <yzhou@xxxxxxxxxx> wrote:

> 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
> 
> _______________________________________________
> Autotest mailing list
> Autotest@xxxxxxxxxxxxxxx
> http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
--
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