From: Avi Kivity <avi@redhat.com>
To: Michael Goldish <mgoldish@redhat.com>
Cc: kvm@vger.kernel.org, David Huff <dhuff@redhat.com>
Subject: Re: [PATCH][KVM_AUTOTEST] Added functionality to the preprocessor to run scripts
Date: Wed, 03 Jun 2009 11:13:37 +0300 [thread overview]
Message-ID: <4A2630B1.80403@redhat.com> (raw)
In-Reply-To: <1580897273.1063661244013718354.JavaMail.root@zmail05.collab.prod.int.phx2.redhat.com>
Michael Goldish wrote:
>>>>
>>>>
>>> - What if we're interested in the status for some reason? Its value
>>> may indicate what went wrong with the child process.
>>>
>>>
>> Put it in the exception string.
>>
>
> But I want its value to be examined programmatically in the code.
> It's less comfortable to retrieve it from a string.
>
Then create a custom exception object and put it in a field.
>
>>> - If we throw an exception we should add a parameter that controls
>>> whether an exception should be thrown (something like
>>>
>> "ignore_status")
>>
>>> because in some cases we don't want to throw an exception.
>>>
>>>
>> I'll complain every time I see it. If you don't care if the command
>> succeeds or not, why run it in the first place?
>>
>
> I care, but sometimes I don't want to fail the test when a command fails.
> I can put every run_bg() call in a try-except statement, but that misses the
> point of raising exceptions in the first place.
>
I think it's very rare to want to let the test continue even if some
command fails.
Can you give examples?
>>> exception such as "something failed after migration"?
>>>
>>>
>> Chained exceptions can provide detailed information.
>>
>
> Wouldn't it complicate the test code?
> How can I provide a detailed message such as "test command failed after migration" --
> can you illustrate this in a small example?
>
try:
code
code
code
except e:
raise ChainedException('exception while running migration test', e)
Instead of checking each code line, you provide a wrapper for the entire
test.
>>>> But if status != 0, will there actually be a pid to kill?
>>>>
>>>>
>>> If the timeout expires and the process is still running, status is
>>>
>> None.
>>
>>>
>>>
>> functions which can return with three possible outcomes are difficult
>> to use.
>>
>
> I tend to see it as two possible outcomes: completion or timeout. In the former
> case, status is returned. In the latter, None is returned.
>
The caller has to test for three possible outcomes. Success, failure,
and 'command is running in the background'. If your callsites don't
check for all three, something's wrong.
--
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
next prev parent reply other threads:[~2009-06-03 8:13 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1788153169.1063471244013561944.JavaMail.root@zmail05.collab.prod.int.phx2.redhat.com>
2009-06-03 7:21 ` [PATCH][KVM_AUTOTEST] Added functionality to the preprocessor to run scripts Michael Goldish
2009-06-03 8:13 ` Avi Kivity [this message]
[not found] <837206814.1138871244056506696.JavaMail.root@zmail05.collab.prod.int.phx2.redhat.com>
2009-06-03 19:15 ` Michael Goldish
[not found] <1680667705.1130361244052268822.JavaMail.root@zmail05.collab.prod.int.phx2.redhat.com>
2009-06-03 18:05 ` Michael Goldish
2009-06-03 18:17 ` Avi Kivity
[not found] <91999434.1061671244009504146.JavaMail.root@zmail05.collab.prod.int.phx2.redhat.com>
2009-06-03 6:14 ` Michael Goldish
2009-06-03 6:45 ` Avi Kivity
2009-06-03 23:31 ` Lucas Meneghel Rodrigues
[not found] <1222268607.226581242993156722.JavaMail.root@zmail05.collab.prod.int.phx2.redhat.com>
2009-05-22 11:58 ` [PATCH] [KVM_Autotest] " Michael Goldish
2009-05-26 16:07 ` David Huff
2009-05-26 21:08 ` [PATCH][KVM_AUTOTEST] " David Huff
2009-05-31 11:23 ` Avi Kivity
2009-05-27 17:13 ` [PATCH] [KVM_Autotest] " sudhir kumar
2009-05-21 20:22 David Huff
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=4A2630B1.80403@redhat.com \
--to=avi@redhat.com \
--cc=dhuff@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mgoldish@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.