From patchwork Wed Oct 28 09:30:32 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Cao, Chen" X-Patchwork-Id: 56256 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 n9S9VxfN002880 for ; Wed, 28 Oct 2009 09:31:59 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757040AbZJ1Jbw (ORCPT ); Wed, 28 Oct 2009 05:31:52 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757026AbZJ1Jbw (ORCPT ); Wed, 28 Oct 2009 05:31:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36651 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756849AbZJ1Jbv (ORCPT ); Wed, 28 Oct 2009 05:31:51 -0400 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n9S9Vt69005639; Wed, 28 Oct 2009 05:31:56 -0400 Received: from localhost.localdomain (dhcp-66-70-146.nay.redhat.com [10.66.70.146] (may be forged)) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n9S9VqbV021226; Wed, 28 Oct 2009 05:31:53 -0400 From: "Cao, Chen" To: lmr@redhat.com, autotest@test.kernel.org Cc: kvm@vger.kernel.org, mgoldish@redhat.com, "Cao, Chen" Subject: [KVM-Autotest Patch] KVM Test: Add re.IGNORECASE to re.compile to verify_ip_address_ in kvm_utils.py - v2 Date: Wed, 28 Oct 2009 17:30:32 +0800 Message-Id: <1256722232-12246-1-git-send-email-kcao@redhat.com> In-Reply-To: <1256616216-7179-1-git-send-email-kcao@redhat.com> References: <1256616216-7179-1-git-send-email-kcao@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.17 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org diff --git a/client/tests/kvm/kvm_utils.py b/client/tests/kvm/kvm_utils.py index f72984a..b9219f6 100644 --- a/client/tests/kvm/kvm_utils.py +++ b/client/tests/kvm/kvm_utils.py @@ -190,11 +190,11 @@ def verify_ip_address_ownership(ip, macs, timeout=10.0): # Compile a regex that matches the given IP address and any of the given # MAC addresses mac_regex = "|".join("(%s)" % mac for mac in macs) - regex = re.compile(r"\b%s\b.*\b(%s)\b" % (ip, mac_regex)) + regex = re.compile(r"\b%s\b.*\b(%s)\b" % (ip, mac_regex), re.IGNORECASE) # Check the ARP cache o = commands.getoutput("/sbin/arp -n") - if re.search(regex, o, re.IGNORECASE): + if regex.search(o): return True # Get the name of the bridge device for arping @@ -206,7 +206,7 @@ def verify_ip_address_ownership(ip, macs, timeout=10.0): # Send an ARP request o = commands.getoutput("/sbin/arping -f -c 3 -I %s %s" % (dev, ip)) - return bool(re.search(regex, o, re.IGNORECASE)) + return bool(regex.search(o)) # Functions for working with the environment (a dict-like object)