From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Goldish Subject: Re: [PATCH] KVM Test: Fix invalid literal bug in ioquit Date: Mon, 21 Jun 2010 14:19:58 +0300 Message-ID: <4C1F4ADE.2050608@redhat.com> References: <1277114861-21737-1-git-send-email-fyang@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: autotest@test.kernel.org, kvm@vger.kernel.org To: Feng Yang Return-path: Received: from mx1.redhat.com ([209.132.183.28]:63740 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757523Ab0FULVY (ORCPT ); Mon, 21 Jun 2010 07:21:24 -0400 In-Reply-To: <1277114861-21737-1-git-send-email-fyang@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: 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 > --- > 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: