From: Lucas Meneghel Rodrigues Subject: Re: [Autotest] [PATCH] KVM Test: Add re.IGNORECASE to re.compile to verify_ip_address_ in kvm_utils.py Date: Wed, 28 Oct 2009 14:53:39 -0200 Message-ID: <6ac58f4f0910280953s294dd158l5644d0988b5aae4b@mail.gmail.com> References: <1162344679.1122961256714375025.JavaMail.root@zmail05.collab.prod.int.phx2.redhat.com> <1125320135.1122981256714441354.JavaMail.root@zmail05.collab.prod.int.phx2.redhat.com> <20091028093013.GB3135@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Michael Goldish , autotest@test.kernel.org, kvm@vger.kernel.org To: "Cao, Chen" Return-path: Received: from mail-pw0-f42.google.com ([209.85.160.42]:44621 "EHLO mail-pw0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754979AbZJ1Qxf convert rfc822-to-8bit (ORCPT ); Wed, 28 Oct 2009 12:53:35 -0400 Received: by pwj9 with SMTP id 9so895200pwj.21 for ; Wed, 28 Oct 2009 09:53:40 -0700 (PDT) In-Reply-To: <20091028093013.GB3135@localhost.localdomain> Sender: kvm-owner@vger.kernel.org List-ID: Thanks guys, applied! On Wed, Oct 28, 2009 at 7:30 AM, Cao, Chen wrote: > On Wed, Oct 28, 2009 at 03:20:41AM -0400, Michael Goldish wrote: >> Thanks for catching this. >> While we're at it, why not remove the 2 occurrences of re.IGNORECASE >> that have no effect? > > I just chose to ignore the code that does not break the tests. > > I'd like to send a patch to remove the 2 're.IGNORECASE's and > use regex.search(o), as you recommended, to let Lucas to decide > the perferred way to fix. :-) > > Thanks for your advice. > > Cao, Chen > 2009/10/28 > >> We can also replace re.search(regex, o) with the slightly shorter >> regex.search(o), but that's just a cosmetic change. >> > > > >> ----- Original Message ----- >> From: "Chen Cao" >> To: lmr@redhat.com, autotest@test.kernel.org >> Cc: kvm@vger.kernel.org, "Chen Cao" >> Sent: Tuesday, October 27, 2009 6:03:36 AM (GMT+0200) Auto-Detected >> Subject: [PATCH] KVM Test: Add re.IGNORECASE to re.compile to verify= _ip_address_ in kvm_utils.py >> >> Since the mac address is (changed to) lowercase and the output of >> 'arping' is in uppercase, we need re.IGNORECASE in the re.compile. >> >> (the re.IGNORECASE in the re.search function takes no effect on the >> compiled regex.) >> >> Signed-off-by: Cao, Chen >> --- >> =A0client/tests/kvm/kvm_utils.py | =A0 =A02 +- >> =A01 files changed, 1 insertions(+), 1 deletions(-) >> >> diff --git a/client/tests/kvm/kvm_utils.py b/client/tests/kvm/kvm_ut= ils.py >> index f72984a..934f223 100644 >> --- a/client/tests/kvm/kvm_utils.py >> +++ b/client/tests/kvm/kvm_utils.py >> @@ -190,7 +190,7 @@ def verify_ip_address_ownership(ip, macs, timeou= t=3D10.0): >> =A0 =A0 =A0# Compile a regex that matches the given IP address and a= ny of the given >> =A0 =A0 =A0# MAC addresses >> =A0 =A0 =A0mac_regex =3D "|".join("(%s)" % mac for mac in macs) >> - =A0 =A0regex =3D re.compile(r"\b%s\b.*\b(%s)\b" % (ip, mac_regex)) >> + =A0 =A0regex =3D re.compile(r"\b%s\b.*\b(%s)\b" % (ip, mac_regex),= re.IGNORECASE) >> >> =A0 =A0 =A0# Check the ARP cache >> =A0 =A0 =A0o =3D commands.getoutput("/sbin/arp -n") >> -- >> 1.6.0.6 >> >> -- >> To unsubscribe from this list: send the line "unsubscribe kvm" in >> the body of a message to majordomo@vger.kernel.org >> More majordomo info at =A0http://vger.kernel.org/majordomo-info.html >> -- >> To unsubscribe from this list: send the line "unsubscribe kvm" in >> the body of a message to majordomo@vger.kernel.org >> More majordomo info at =A0http://vger.kernel.org/majordomo-info.html > _______________________________________________ > Autotest mailing list > Autotest@test.kernel.org > http://test.kernel.org/cgi-bin/mailman/listinfo/autotest > --=20 Lucas