From patchwork Mon Jul 20 15:07:20 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Goldish X-Patchwork-Id: 36355 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 n6KF4JvC016769 for ; Mon, 20 Jul 2009 15:04:23 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751640AbZGTPDj (ORCPT ); Mon, 20 Jul 2009 11:03:39 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751537AbZGTPDj (ORCPT ); Mon, 20 Jul 2009 11:03:39 -0400 Received: from mx2.redhat.com ([66.187.237.31]:59930 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752014AbZGTPDc (ORCPT ); Mon, 20 Jul 2009 11:03:32 -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 n6KF3WCH000591; Mon, 20 Jul 2009 11:03:32 -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 n6KF3VK9025223; Mon, 20 Jul 2009 11:03:31 -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 n6KF39lQ007669; Mon, 20 Jul 2009 11:03:30 -0400 From: Michael Goldish To: autotest@test.kernel.org, kvm@vger.kernel.org Cc: Michael Goldish Subject: [KVM-AUTOTEST PATCH 13/17] KVM test: fix a parsing problem in kvm_config.py Date: Mon, 20 Jul 2009 18:07:20 +0300 Message-Id: In-Reply-To: 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> <7f24fe107f3dc8e2693e12142ba97010c7063166.1248102188.git.mgoldish@redhat.com> <79d9f4e9e8ca62388f1a8be1a0f450a2f2329fc3.1248102188.git.mgoldish@redhat.com> <8cb328ac5429d808714dd252a456e6d3dd3a96b2.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 Allow kvm_config to parse weird lines that seem to contain several operators, such as: time_filter_re = "(?<=TIME: ...)" The '?<=' is recognized as the operator instead of the '='. To fix this, select the operator closest to the beginning of the line. Signed-off-by: Michael Goldish --- client/tests/kvm/kvm_config.py | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/client/tests/kvm/kvm_config.py b/client/tests/kvm/kvm_config.py index 95eefcb..99ccb2a 100755 --- a/client/tests/kvm/kvm_config.py +++ b/client/tests/kvm/kvm_config.py @@ -294,10 +294,12 @@ class config: # Look for a known operator in the line operators = ["?+=", "?<=", "?=", "+=", "<=", "="] op_found = None + op_pos = len(line) for op in operators: - if op in line: + pos = line.find(op) + if pos >= 0 and pos < op_pos: op_found = op - break + op_pos = pos # Found an operator? if op_found: