diff mbox series

[ovs-dev,branch-2.17] xenserver: Fix tests with Python 3.12.

Message ID 20240409202410.2644936-1-i.maximets@ovn.org
State Accepted
Commit 10588fed098032ee1f8c02b203367d924f3a7f83
Delegated to: Ilya Maximets
Headers show
Series [ovs-dev,branch-2.17] xenserver: Fix tests with Python 3.12. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed

Commit Message

Ilya Maximets April 9, 2024, 8:24 p.m. UTC
Without this change many unit tests are failing on systems with
Python 3.12:

  +++ /tests/testsuite.dir/at-groups/2352/stdout
  @@ -1,3 +1,5 @@
  +/./interface-reconfigure:98: SyntaxWarning: invalid escape sequence '\s'
  +  p = re.compile(".*\s%(MAC)s\s.*" % pifrec, re.IGNORECASE)

Converting to a raw string to avoid the issue.

This only affects OVS 2.17, support for XenServer was removed
in OVS 3.0.

Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
---
 xenserver/opt_xensource_libexec_interface-reconfigure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Simon Horman April 10, 2024, 4:17 p.m. UTC | #1
On Tue, Apr 09, 2024 at 10:24:09PM +0200, Ilya Maximets wrote:
> Without this change many unit tests are failing on systems with
> Python 3.12:
> 
>   +++ /tests/testsuite.dir/at-groups/2352/stdout
>   @@ -1,3 +1,5 @@
>   +/./interface-reconfigure:98: SyntaxWarning: invalid escape sequence '\s'
>   +  p = re.compile(".*\s%(MAC)s\s.*" % pifrec, re.IGNORECASE)
> 
> Converting to a raw string to avoid the issue.
> 
> This only affects OVS 2.17, support for XenServer was removed
> in OVS 3.0.
> 
> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>

Thanks Ilya,

I confirmed that on Fedora 41, which has Python 3.12.2,
the following tests fail without this patch and succeed with it.
Or more to the point, all tests pass with this patch applied.

2353: VLAN, non-bond                                  ok
2354: Bond, non-VLAN                                  ok
2355: VLAN on bond                                    ok
2352: non-VLAN, non-bond                              ok

Acked-by: Simon Horman <horms@ovn.org>
Tested-by: Simon Horman <horms@ovn.org>
Ilya Maximets April 10, 2024, 8:26 p.m. UTC | #2
On 4/10/24 18:17, Simon Horman wrote:
> On Tue, Apr 09, 2024 at 10:24:09PM +0200, Ilya Maximets wrote:
>> Without this change many unit tests are failing on systems with
>> Python 3.12:
>>
>>   +++ /tests/testsuite.dir/at-groups/2352/stdout
>>   @@ -1,3 +1,5 @@
>>   +/./interface-reconfigure:98: SyntaxWarning: invalid escape sequence '\s'
>>   +  p = re.compile(".*\s%(MAC)s\s.*" % pifrec, re.IGNORECASE)
>>
>> Converting to a raw string to avoid the issue.
>>
>> This only affects OVS 2.17, support for XenServer was removed
>> in OVS 3.0.
>>
>> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
> 
> Thanks Ilya,
> 
> I confirmed that on Fedora 41, which has Python 3.12.2,
> the following tests fail without this patch and succeed with it.
> Or more to the point, all tests pass with this patch applied.
> 
> 2353: VLAN, non-bond                                  ok
> 2354: Bond, non-VLAN                                  ok
> 2355: VLAN on bond                                    ok
> 2352: non-VLAN, non-bond                              ok
> 
> Acked-by: Simon Horman <horms@ovn.org>
> Tested-by: Simon Horman <horms@ovn.org>

Thanks, Simon!  Applied to branch-2.17.

Best regards, Ilya Maximets.
diff mbox series

Patch

diff --git a/xenserver/opt_xensource_libexec_interface-reconfigure b/xenserver/opt_xensource_libexec_interface-reconfigure
index 9c20725de..49d208296 100755
--- a/xenserver/opt_xensource_libexec_interface-reconfigure
+++ b/xenserver/opt_xensource_libexec_interface-reconfigure
@@ -95,7 +95,7 @@  def check_allowed(pif):
         macline = filter(lambda x: x.startswith("HWaddr:"), f.readlines())
         f.close()
         if len(macline) == 1:
-            p = re.compile(".*\s%(MAC)s\s.*" % pifrec, re.IGNORECASE)
+            p = re.compile(r".*\s%(MAC)s\s.*" % pifrec, re.IGNORECASE)
             if p.match(macline[0]):
                 log("Skipping PVS device %(device)s (%(MAC)s)" % pifrec)
                 return False