Re: [KVM-AUTOTEST][PATCH 2/2][virtio-console] Fix compatibility with python 2.4.

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

 



----- "JiÅÃ Åupka" <jzupka@xxxxxxxxxx> wrote:

> ---
>  client/tests/kvm/scripts/virtio_guest.py |   22
> ++++++++++++----------
>  1 files changed, 12 insertions(+), 10 deletions(-)
> 
> diff --git a/client/tests/kvm/scripts/virtio_guest.py
> b/client/tests/kvm/scripts/virtio_guest.py
> index 87727c7..b039ec9 100755
> --- a/client/tests/kvm/scripts/virtio_guest.py
> +++ b/client/tests/kvm/scripts/virtio_guest.py
> @@ -248,7 +248,7 @@ class VirtioGuest:
>                          print os.system("stty -F %s raw -echo" %
> (name))
>                          print os.system("stty -F %s -a" % (name))
>                      f.append(self.files[name])
> -                except Exception as inst:
> +                except Exception, inst:
>                      print "FAIL: Failed to open file %s" % (name)
>                      raise inst
>          return f
> @@ -316,12 +316,14 @@ class VirtioGuest:
>              else:
>                  fcntl.fcntl(fd, fcntl.F_SETFL, fl & ~os.O_NONBLOCK)
>  
> -        except Exception as inst:
> +        except Exception, inst:
>              print "FAIL: Setting (non)blocking mode: " + str(inst)
>              return
>  
> -        print ("PASS: set blocking mode to %s mode" %
> -               ("blocking" if mode else "nonblocking"))
> +        if mode:
> +            print "PASS: set to blocking mode"
> +        else:
> +            print "PASS: set to nonblocking mode"

After loading your this patch, virtio_console also could not work with older python.

Something are not fixed, such as:
  "return True if self.failed > 0 else False"
  "PASS"if result[0] else "FAIL"
  ...

I'm testing with 'Python 2.4.3'

>      def close(self, file):
> @@ -339,7 +341,7 @@ class VirtioGuest:
>              if descriptor != None:
>                  try:
>                      os.close(descriptor)
> -                except Exception as inst:
> +                except Exception, inst:
>                      print "FAIL: Closing the file: " + str(inst)
>                      return
>          print "PASS: Close"
> @@ -359,7 +361,7 @@ class VirtioGuest:
>                  print os.system("stty -F %s raw -echo" % (name))
>                  print os.system("stty -F %s -a" % (name))
>              print "PASS: Open all filles correctly."
> -        except Exception as inst:
> +        except Exception, inst:
>              print "%s\nFAIL: Failed open file %s" % (str(inst),
> name)
>  
>  
> @@ -443,7 +445,7 @@ class VirtioGuest:
>              data += "%c" % random.randrange(255)
>          try:
>              writes = os.write(in_f[0], data)
> -        except Exception as inst:
> +        except Exception, inst:
>              print inst
>          if not writes:
>              writes = 0
> @@ -451,7 +453,7 @@ class VirtioGuest:
>              while (writes < length):
>                  try:
>                      writes += os.write(in_f[0], data)
> -                except Exception as inst:
> +                except Exception, inst:
>                      print inst
>          if writes >= length:
>              print "PASS: Send data length %d" % writes
> @@ -473,13 +475,13 @@ class VirtioGuest:
>          recvs = ""
>          try:
>              recvs = os.read(in_f[0], buffer)
> -        except Exception as inst:
> +        except Exception, inst:
>              print inst
>          if mode:
>              while (len(recvs) < length):
>                  try:
>                      recvs += os.read(in_f[0], buffer)
> -                except Exception as inst:
> +                except Exception, inst:
>                      print inst
>          if len(recvs) >= length:
>              print "PASS: Recv data length %d" % len(recvs)
> -- 
> 1.7.3.2
--
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