Re: [PATCH] KVM Test: Add re.IGNORECASE to re.compile to verify_ip_address_ in kvm_utils.py

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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" <kcao@xxxxxxxxxx>
> To: lmr@xxxxxxxxxx, autotest@xxxxxxxxxxxxxxx
> Cc: kvm@xxxxxxxxxxxxxxx, "Chen Cao" <kcao@xxxxxxxxxx>
> 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 <kcao@xxxxxxxxxx>
> ---
>  client/tests/kvm/kvm_utils.py |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/client/tests/kvm/kvm_utils.py b/client/tests/kvm/kvm_utils.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, 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")
> -- 
> 1.6.0.6
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux