From patchwork Mon Jul 20 15:07:14 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Goldish X-Patchwork-Id: 36348 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n6KF4Jv5016769 for ; Mon, 20 Jul 2009 15:04:21 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751988AbZGTPD3 (ORCPT ); Mon, 20 Jul 2009 11:03:29 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751613AbZGTPD3 (ORCPT ); Mon, 20 Jul 2009 11:03:29 -0400 Received: from mx2.redhat.com ([66.187.237.31]:59915 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751932AbZGTPDW (ORCPT ); Mon, 20 Jul 2009 11:03:22 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n6KF3M4G000539; Mon, 20 Jul 2009 11:03:22 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n6KF3LHO025186; Mon, 20 Jul 2009 11:03:21 -0400 Received: from localhost.localdomain (dhcp-1-188.tlv.redhat.com [10.35.1.188]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n6KF39lK007669; Mon, 20 Jul 2009 11:03:20 -0400 From: Michael Goldish To: autotest@test.kernel.org, kvm@vger.kernel.org Cc: Michael Goldish Subject: [KVM-AUTOTEST PATCH 07/17] kvm_guest_wizard: pass 'params' directly to barrier_2() Date: Mon, 20 Jul 2009 18:07:14 +0300 Message-Id: In-Reply-To: <7c14834269583764af3beb2e811ac62bec3a2c96.1248102188.git.mgoldish@redhat.com> References: <1248102444-31111-1-git-send-email-mgoldish@redhat.com> <4980fdb4f9630c89ba21bd4af49a3b7626fb29f1.1248102188.git.mgoldish@redhat.com> <747abbb55932d4fde553cf5187f7481aaced4d8c.1248102188.git.mgoldish@redhat.com> <53d7f316f181c7efb429e7b9f138ed3e8b239cce.1248102188.git.mgoldish@redhat.com> <7c14834269583764af3beb2e811ac62bec3a2c96.1248102188.git.mgoldish@redhat.com> In-Reply-To: References: X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org 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 @@ -17,8 +17,8 @@ def handle_var(vm, params, varname): return True -def barrier_2(vm, words, fail_if_stuck_for, stuck_detection_history, - debug_dir, data_scrdump_filename, current_step_num): +def barrier_2(vm, words, params, debug_dir, data_scrdump_filename, + current_step_num): if len(words) < 7: logging.error("Bad barrier_2 command line") return False @@ -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 + end_time = time.time() + timeout end_time_stuck = time.time() + fail_if_stuck_for start_time = time.time() @@ -151,18 +163,6 @@ def run_steps(test, params, env): if not os.path.exists(steps_filename): raise error.TestError("Steps file not found: %s" % steps_filename) - 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 - sf = open(steps_filename, "r") lines = sf.readlines() sf.close() @@ -201,13 +201,12 @@ def run_steps(test, params, env): logging.error("Variable not defined: %s" % words[1]) elif words[0] == "barrier_2": if current_screendump: - scrdump_filename = ( - os.path.join(ppm_utils.get_data_dir(steps_filename), - current_screendump)) + scrdump_filename = os.path.join( + ppm_utils.get_data_dir(steps_filename), + current_screendump) else: scrdump_filename = None - if not barrier_2(vm, words, fail_if_stuck_for, - stuck_detection_history, test.debugdir, + if not barrier_2(vm, words, params, test.debugdir, scrdump_filename, current_step_num): skip_current_step = True else: