From: Mike Burns <mburns@redhat.com>
To: Avi Kivity <avi@redhat.com>
Cc: Lucas Meneghel Rodrigues <lmr@redhat.com>,
kvm@vger.kernel.org, dhuff@redhat.com, ulublin@redhat.com
Subject: Re: [PATCH][KVM-AUTOTEST] Check exit status of custom install script and fail if script failed.
Date: Mon, 01 Jun 2009 14:22:11 -0400 [thread overview]
Message-ID: <4A241C53.2080604@redhat.com> (raw)
In-Reply-To: <4A2389FB.7050009@redhat.com>
Avi Kivity wrote:
> Lucas Meneghel Rodrigues wrote:
>> On Sun, 2009-05-24 at 17:48 +0300, Avi Kivity wrote:
>>
>>> Mike Burns wrote:
>>>
>>>> Signed-off-by: Mike Burns <mburns@redhat.com>
>>>> ---
>>>> client/tests/kvm_runtest_2/kvm_install.py | 7 ++++++-
>>>> 1 files changed, 6 insertions(+), 1 deletions(-)
>>>>
>>>> diff --git a/client/tests/kvm_runtest_2/kvm_install.py
>>>> b/client/tests/kvm_runtest_2/kvm_install.py
>>>> index ebd8b7d..392ef0c 100755
>>>> --- a/client/tests/kvm_runtest_2/kvm_install.py
>>>> +++ b/client/tests/kvm_runtest_2/kvm_install.py
>>>> @@ -90,7 +90,12 @@ def run_kvm_install(test, params, env):
>>>> kvm_log.info("Adding KVM_INSTALL_%s to Environment" % (k))
>>>> os.putenv("KVM_INSTALL_%s" % (k), str(params[k]))
>>>> kvm_log.info("Running " + script + " to install kvm")
>>>> - os.system("cd %s; %s" % (test.bindir, script))
>>>> + install_result = os.system("cd %s; %s" % (test.bindir,
>>>> script))
>>>> + if os.WEXITSTATUS(install_result) != 0:
>>>> + message = "Custom Script encountered an error"
>>>> + kvm_log.error(message)
>>>> + raise error.TestError, message
>>>> +
>>>>
>>> How about a helper that does os.system() (or rather,
>>> commands.getstatusoutput()) and throws an exception on failure? I
>>> imagine it could be used in many places.
>>>
>>
>> utils.system() does that. If we have exit code != 0, it throws an
>> error.CmdError exception.
>>
>
> Well let's use it then. Every time I see 'raise' used I'm going to
> complain, so it will be a lot more efficient as well as smaller code.
>
Agreed. I'll rework this and my other patches and get them re-posted in
the next day or two.
Mike
next prev parent reply other threads:[~2009-06-01 18:22 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-20 20:38 [PATCH][KVM-AUTOTEST] Have Custom install chdir to test.bindir Mike Burns
2009-05-20 20:38 ` [PATCH][KVM-AUTOTEST] Check exit status of custom install script and fail if script failed Mike Burns
2009-05-24 14:48 ` Avi Kivity
2009-05-28 6:25 ` Lucas Meneghel Rodrigues
2009-06-01 7:57 ` Avi Kivity
2009-06-01 18:22 ` Mike Burns [this message]
2009-05-24 14:51 ` [PATCH][KVM-AUTOTEST] Have Custom install chdir to test.bindir Avi Kivity
2009-06-01 18:39 ` Mike Burns
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A241C53.2080604@redhat.com \
--to=mburns@redhat.com \
--cc=avi@redhat.com \
--cc=dhuff@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=lmr@redhat.com \
--cc=ulublin@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox