From mboxrd@z Thu Jan 1 00:00:00 1970 From: Uri Lublin Subject: Re: [KVM-AUTOTEST PATCH 2/4] kvm_guest_wizard: pass 'params' directly to barrier_2() Date: Tue, 16 Jun 2009 17:57:19 +0300 Message-ID: <4A37B2CF.3050800@redhat.com> References: <1245095119-29942-1-git-send-email-mgoldish@redhat.com> <68e819f64657acbf6126dee50c5a241f9228acc1.1245094830.git.mgoldish@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: autotest@test.kernel.org, kvm@vger.kernel.org To: Michael Goldish Return-path: Received: from mx2.redhat.com ([66.187.237.31]:47331 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758907AbZFPO5U (ORCPT ); Tue, 16 Jun 2009 10:57:20 -0400 In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: 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 > --- > 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)) Regards, Uri