public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM Test: Fix invalid literal bug in ioquit
@ 2010-06-21 10:07 Feng Yang
  2010-06-21 11:19 ` Michael Goldish
  0 siblings, 1 reply; 3+ messages in thread
From: Feng Yang @ 2010-06-21 10:07 UTC (permalink / raw)
  To: autotest; +Cc: kvm, Feng Yang

Sometime check_cmd could not finish in setting time.
Then o="", so int(o) will cause ValueError:
invalid literal for int() with base 10: ''
So change to check return status.

Signed-off-by: Feng Yang <fyang@redhat.com>
---
 client/tests/kvm/tests/ioquit.py       |    6 +++---
 client/tests/kvm/tests_base.cfg.sample |    2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/client/tests/kvm/tests/ioquit.py b/client/tests/kvm/tests/ioquit.py
index 389a867..8126139 100644
--- a/client/tests/kvm/tests/ioquit.py
+++ b/client/tests/kvm/tests/ioquit.py
@@ -23,13 +23,13 @@ def run_ioquit(test, params, env):
         (s, o) = session.get_command_status_output(bg_cmd, timeout=60)
         check_cmd = params.get("check_cmd")
         (s, o) = session2.get_command_status_output(check_cmd, timeout=60)
-        if int(o) <= 0:
+        if s:
             raise error.TestError("Fail to add IO workload for Guest OS")
 
         logging.info("Sleep for a while")
         time.sleep(random.randrange(30,100))
-        (s, o) = session2.get_command_status_output(check_cmd, timeout=300)
-        if int(o) <= 0:
+        (s, o) = session2.get_command_status_output(check_cmd, timeout=60)
+        if s:
             logging.info("IO workload finished before the VM was killed")
         logging.info("Kill the virtual machine")
         vm.process.close()
diff --git a/client/tests/kvm/tests_base.cfg.sample b/client/tests/kvm/tests_base.cfg.sample
index ce88235..0fd5543 100644
--- a/client/tests/kvm/tests_base.cfg.sample
+++ b/client/tests/kvm/tests_base.cfg.sample
@@ -411,7 +411,7 @@ variants:
     - ioquit:
         type = ioquit
         background_cmd = "for i in 1 2 3 4; do (nohup dd if=/dev/urandom of=/tmp/file bs=102400 count=10000000 &) done"
-        check_cmd = ps -a |grep dd |wc -l
+        check_cmd = ps -a |grep dd
         login_timeout = 360
 
     - qemu_img:
-- 
1.5.5.6


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] KVM Test: Fix invalid literal bug in ioquit
  2010-06-21 10:07 [PATCH] KVM Test: Fix invalid literal bug in ioquit Feng Yang
@ 2010-06-21 11:19 ` Michael Goldish
  0 siblings, 0 replies; 3+ messages in thread
From: Michael Goldish @ 2010-06-21 11:19 UTC (permalink / raw)
  To: Feng Yang; +Cc: autotest, kvm

On 06/21/2010 01:07 PM, Feng Yang wrote:
> Sometime check_cmd could not finish in setting time.
> Then o="", so int(o) will cause ValueError:
> invalid literal for int() with base 10: ''
> So change to check return status.
> 
> Signed-off-by: Feng Yang <fyang@redhat.com>
> ---
>  client/tests/kvm/tests/ioquit.py       |    6 +++---
>  client/tests/kvm/tests_base.cfg.sample |    2 +-
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/client/tests/kvm/tests/ioquit.py b/client/tests/kvm/tests/ioquit.py
> index 389a867..8126139 100644
> --- a/client/tests/kvm/tests/ioquit.py
> +++ b/client/tests/kvm/tests/ioquit.py
> @@ -23,13 +23,13 @@ def run_ioquit(test, params, env):
>          (s, o) = session.get_command_status_output(bg_cmd, timeout=60)
>          check_cmd = params.get("check_cmd")
>          (s, o) = session2.get_command_status_output(check_cmd, timeout=60)
> -        if int(o) <= 0:
> +        if s:
>              raise error.TestError("Fail to add IO workload for Guest OS")

Please use 'if s != 0' because in case of a timeout s is None.

>          logging.info("Sleep for a while")
>          time.sleep(random.randrange(30,100))
> -        (s, o) = session2.get_command_status_output(check_cmd, timeout=300)
> -        if int(o) <= 0:
> +        (s, o) = session2.get_command_status_output(check_cmd, timeout=60)
> +        if s:

Same here.

>              logging.info("IO workload finished before the VM was killed")
>          logging.info("Kill the virtual machine")
>          vm.process.close()
> diff --git a/client/tests/kvm/tests_base.cfg.sample b/client/tests/kvm/tests_base.cfg.sample
> index ce88235..0fd5543 100644
> --- a/client/tests/kvm/tests_base.cfg.sample
> +++ b/client/tests/kvm/tests_base.cfg.sample
> @@ -411,7 +411,7 @@ variants:
>      - ioquit:
>          type = ioquit
>          background_cmd = "for i in 1 2 3 4; do (nohup dd if=/dev/urandom of=/tmp/file bs=102400 count=10000000 &) done"
> -        check_cmd = ps -a |grep dd |wc -l
> +        check_cmd = ps -a |grep dd
>          login_timeout = 360
>  
>      - qemu_img:


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] KVM Test: Fix invalid literal bug in ioquit
       [not found] <89654694.590411277173047710.JavaMail.root@zmail04.collab.prod.int.phx2.redhat.com>
@ 2010-06-22  2:20 ` Feng Yang
  0 siblings, 0 replies; 3+ messages in thread
From: Feng Yang @ 2010-06-22  2:20 UTC (permalink / raw)
  To: Michael Goldish; +Cc: autotest, kvm


----- "Michael Goldish" <mgoldish@redhat.com> wrote:

> From: "Michael Goldish" <mgoldish@redhat.com>
> To: "Feng Yang" <fyang@redhat.com>
> Cc: autotest@test.kernel.org, kvm@vger.kernel.org
> Sent: Monday, June 21, 2010 7:19:58 PM GMT +08:00 Beijing / Chongqing / Hong Kong / Urumqi
> Subject: Re: [PATCH] KVM Test: Fix invalid literal bug in ioquit
>
> On 06/21/2010 01:07 PM, Feng Yang wrote:
> > Sometime check_cmd could not finish in setting time.
> > Then o="", so int(o) will cause ValueError:
> > invalid literal for int() with base 10: ''
> > So change to check return status.
> > 
> > Signed-off-by: Feng Yang <fyang@redhat.com>
> > ---
> >  client/tests/kvm/tests/ioquit.py       |    6 +++---
> >  client/tests/kvm/tests_base.cfg.sample |    2 +-
> >  2 files changed, 4 insertions(+), 4 deletions(-)
> > 
> > diff --git a/client/tests/kvm/tests/ioquit.py
> b/client/tests/kvm/tests/ioquit.py
> > index 389a867..8126139 100644
> > --- a/client/tests/kvm/tests/ioquit.py
> > +++ b/client/tests/kvm/tests/ioquit.py
> > @@ -23,13 +23,13 @@ def run_ioquit(test, params, env):
> >          (s, o) = session.get_command_status_output(bg_cmd,
> timeout=60)
> >          check_cmd = params.get("check_cmd")
> >          (s, o) = session2.get_command_status_output(check_cmd,
> timeout=60)
> > -        if int(o) <= 0:
> > +        if s:
> >              raise error.TestError("Fail to add IO workload for
> Guest OS")
> 
> Please use 'if s != 0' because in case of a timeout s is None.
Hi Michael, thanks for your comments!
But here, I think 'if s:' is better.
get_command_status_output(check_cmd, timeout=60) timeout should caused by workload is bigger in the guest. This just what we want.
Should not throw an error here.

Only 'if s:' match, we can say 'Fail to add IO workload for Guest OS'.

Thanks!

> 
> >          logging.info("Sleep for a while")
> >          time.sleep(random.randrange(30,100))
> > -        (s, o) = session2.get_command_status_output(check_cmd,
> timeout=300)
> > -        if int(o) <= 0:
> > +        (s, o) = session2.get_command_status_output(check_cmd,
> timeout=60)
> > +        if s:
> 
> Same here.
> 
> >              logging.info("IO workload finished before the VM was
> killed")
> >          logging.info("Kill the virtual machine")
> >          vm.process.close()
> > diff --git a/client/tests/kvm/tests_base.cfg.sample
> b/client/tests/kvm/tests_base.cfg.sample
> > index ce88235..0fd5543 100644
> > --- a/client/tests/kvm/tests_base.cfg.sample
> > +++ b/client/tests/kvm/tests_base.cfg.sample
> > @@ -411,7 +411,7 @@ variants:
> >      - ioquit:
> >          type = ioquit
> >          background_cmd = "for i in 1 2 3 4; do (nohup dd
> if=/dev/urandom of=/tmp/file bs=102400 count=10000000 &) done"
> > -        check_cmd = ps -a |grep dd |wc -l
> > +        check_cmd = ps -a |grep dd
> >          login_timeout = 360
> >  
> >      - qemu_img:
> 
> --
> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-06-22  2:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-21 10:07 [PATCH] KVM Test: Fix invalid literal bug in ioquit Feng Yang
2010-06-21 11:19 ` Michael Goldish
     [not found] <89654694.590411277173047710.JavaMail.root@zmail04.collab.prod.int.phx2.redhat.com>
2010-06-22  2:20 ` Feng Yang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox