Re: [KVM-AUTOTEST PATCH 2/4] kvm_guest_wizard: pass 'params' directly to barrier_2()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



----- "Uri Lublin" <uril@xxxxxxxxxx> wrote:

> On 06/15/2009 10:45 PM, Michael Goldish wrote:
> > Currently parameters for barrier_2() are extracted from 'params' in
> the main
> > run_steps() test routine, and then passed to barrier_2().
> > Instead, let barrier_2() extract parameters from 'params' as it sees
> fit.
> > This will make adding new parameters slightly easier and cleaner.
> >
> > Signed-off-by: Michael Goldish<mgoldish@xxxxxxxxxx>
> > ---
> >   client/tests/kvm/kvm_guest_wizard.py |   37
> ++++++++++++++++-----------------
> >   1 files changed, 18 insertions(+), 19 deletions(-)
> >
> > diff --git a/client/tests/kvm/kvm_guest_wizard.py
> b/client/tests/kvm/kvm_guest_wizard.py
> > index 143e61e..eb0e2d5 100644
> > --- a/client/tests/kvm/kvm_guest_wizard.py
> > +++ b/client/tests/kvm/kvm_guest_wizard.py
> 
> 
> > @@ -41,6 +41,18 @@ def barrier_2(vm, words, fail_if_stuck_for,
> stuck_detection_history,
> >                                                   
> "cropped_scrdump_expected.ppm")
> >       comparison_filename = os.path.join(debug_dir,
> "comparison.ppm")
> >
> > +    fail_if_stuck_for = params.get("fail_if_stuck_for")
> > +    if fail_if_stuck_for:
> > +        fail_if_stuck_for = float(fail_if_stuck_for)
> > +    else:
> > +        fail_if_stuck_for = 1e308
> > +
> > +    stuck_detection_history =
> params.get("stuck_detection_history")
> > +    if stuck_detection_history:
> > +        stuck_detection_history = int(stuck_detection_history)
> > +    else:
> > +        stuck_detection_history = 2
> > +
> 
> Could be simplified by (preferably in a separate patch):
>         fail_if_stuck_for = params.get("fail_if_stuck_for", 1e308)
>         fail_if_stuck_for = float(fail_if_stuck_for)
> 
>         stuck_detection_history =
> params.get("stuck_detection_history", 2)
>         stuck_detection_history = int(stuck_detection_history)
> 
> or even with a single line for each param:
>         var = cast(params.get(var_name, default_value))

But what if the user wants to disable the feature or use the default
value by setting fail_if_stuck_for = ''?
This is required, for example, when the param is set to 300 for all
tests, and the user wants to disable it only for Fedora tests.
In that case params.get("fail_if_stuck_for", 1e308) would return ''
and the following cast would raise an exception.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux