* [KVM-AUTOTEST][PATCH 2/2][virtio-console] Fix compatibility with python 2.4.
2010-11-22 13:38 [KVM-AUTOTEST][PATCH 1/2][virtio-console] Add subtest layer and prepare to add new tests Jiří Župka
@ 2010-11-22 13:38 ` Jiří Župka
0 siblings, 0 replies; 4+ messages in thread
From: Jiří Župka @ 2010-11-22 13:38 UTC (permalink / raw)
To: ldoktor, kvm-autotest, kvm, autotest
---
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"
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [KVM-AUTOTEST][PATCH 2/2][virtio-console] Fix compatibility with python 2.4.
[not found] <1185845527.152951290479344136.JavaMail.root@zmail05.collab.prod.int.phx2.redhat.com>
@ 2010-11-23 2:30 ` Amos Kong
2010-11-25 16:22 ` Lukáš Doktor
0 siblings, 1 reply; 4+ messages in thread
From: Amos Kong @ 2010-11-23 2:30 UTC (permalink / raw)
To: Jiří Župka; +Cc: autotest, kvm, kvm-autotest
----- "Jiří Župka" <jzupka@redhat.com> 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
_______________________________________________
Autotest mailing list
Autotest@test.kernel.org
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [KVM-AUTOTEST][PATCH 2/2][virtio-console] Fix compatibility with python 2.4.
2010-11-23 2:30 ` [KVM-AUTOTEST][PATCH 2/2][virtio-console] Fix compatibility with python 2.4 Amos Kong
@ 2010-11-25 16:22 ` Lukáš Doktor
2010-11-25 19:04 ` [KVM-AUTOTEST] [PATCH " Lucas Meneghel Rodrigues
0 siblings, 1 reply; 4+ messages in thread
From: Lukáš Doktor @ 2010-11-25 16:22 UTC (permalink / raw)
To: Amos Kong; +Cc: autotest, kvm, kvm-autotest
Dne 23.11.2010 03:30, Amos Kong napsal(a):
> ----- "Jiří Župka"<jzupka@redhat.com> wrote:
>
>> ---
>
> 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'
Hi,
this fixes only the GUEST (virtio_guest.py) side of the virtio_console
test. (tested with python 2.4.3 and 2.4.6)
It's possible to fix the host side too but distributions which supports
only python 2.4 usually supports older versions of KVM without the
'-device' option we use in the HOST side of the test for creating the
devices. This change would only make the code less readable with minimal
income.
Anyway if there's a real demand, we can fix the HOST side too.
Cheers,
Lukáš
>
>> def close(self, file):
>> @@ -339,7 +341,7 @@ class VirtioGuest:
>> if descriptor != None:
>> --
>> 1.7.3.2
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
_______________________________________________
Autotest mailing list
Autotest@test.kernel.org
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [KVM-AUTOTEST] [PATCH 2/2][virtio-console] Fix compatibility with python 2.4.
2010-11-25 16:22 ` Lukáš Doktor
@ 2010-11-25 19:04 ` Lucas Meneghel Rodrigues
0 siblings, 0 replies; 4+ messages in thread
From: Lucas Meneghel Rodrigues @ 2010-11-25 19:04 UTC (permalink / raw)
To: Lukáš Doktor; +Cc: autotest, kvm-autotest, kvm
On Thu, 2010-11-25 at 17:22 +0100, Lukáš Doktor wrote:
> Dne 23.11.2010 03:30, Amos Kong napsal(a):
> > ----- "Jiří Župka"<jzupka@redhat.com> wrote:
> >
> >> ---
> >
> > 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'
>
> Hi,
>
> this fixes only the GUEST (virtio_guest.py) side of the virtio_console
> test. (tested with python 2.4.3 and 2.4.6)
>
> It's possible to fix the host side too but distributions which supports
> only python 2.4 usually supports older versions of KVM without the
> '-device' option we use in the HOST side of the test for creating the
> devices. This change would only make the code less readable with minimal
> income.
>
> Anyway if there's a real demand, we can fix the HOST side too.
The point here is that we're under a larger project, autotest, which
strives to keep py 2.4 compatibility. So yes, we're going to need to fix
the host side too. However, I'd like to point out that you guys have
done an excellent job with the virtio_console test, great code quality.
Cheers,
Lucas
> Cheers,
> Lukáš
> >
> >> def close(self, file):
> >> @@ -339,7 +341,7 @@ class VirtioGuest:
> >> if descriptor != None:
>
> >> --
> >> 1.7.3.2
> > --
> > To unsubscribe from this list: send the line "unsubscribe kvm" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
>
_______________________________________________
Autotest mailing list
Autotest@test.kernel.org
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-11-25 19:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1185845527.152951290479344136.JavaMail.root@zmail05.collab.prod.int.phx2.redhat.com>
2010-11-23 2:30 ` [KVM-AUTOTEST][PATCH 2/2][virtio-console] Fix compatibility with python 2.4 Amos Kong
2010-11-25 16:22 ` Lukáš Doktor
2010-11-25 19:04 ` [KVM-AUTOTEST] [PATCH " Lucas Meneghel Rodrigues
2010-11-22 13:38 [KVM-AUTOTEST][PATCH 1/2][virtio-console] Add subtest layer and prepare to add new tests Jiří Župka
2010-11-22 13:38 ` [KVM-AUTOTEST][PATCH 2/2][virtio-console] Fix compatibility with python 2.4 Jiří Župka
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox