summaryrefslogtreecommitdiff
path: root/x11-wm/xpra/files/xpra-4.2.2-dup-ip.patch
blob: f689166dec9deb6ac99e831c9144e2932e9a8820 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
diff --git a/tests/unittests/unit/net/net_util_test.py b/tests/unittests/unit/net/net_util_test.py
index 1ceaf4573..870801666 100755
--- a/tests/unittests/unit/net/net_util_test.py
+++ b/tests/unittests/unit/net/net_util_test.py
@@ -6,6 +6,7 @@

 import unittest

+from collections import defaultdict
 from xpra.net.net_util import (
     get_info, get_interfaces, get_interfaces_addresses, #get_interface,
     get_gateways, get_bind_IPs, do_get_bind_ifacemask,
@@ -26,10 +27,8 @@ class TestVersionUtilModule(unittest.TestCase):
         ifaces = get_interfaces()
         if not ifaces:
             return
+        ip_ifaces = defaultdict(list)
         for iface in ifaces:
-            ipmasks = do_get_bind_ifacemask(iface)
-            for ip, _ in ipmasks:
-                assert get_iface(ip)==iface
             if if_nametoindex:
                 try:
                     i = if_nametoindex(iface)
@@ -37,7 +36,14 @@ class TestVersionUtilModule(unittest.TestCase):
                     pass
                 else:
                     if if_indextoname:
-                        assert if_indextoname(i)==iface
+                        assert if_indextoname(i)==iface, "expected interface %s for index %i but got %s" % (
+                            iface, i, if_indextoname(i))
+            ipmasks = do_get_bind_ifacemask(iface)
+            for ip, _ in ipmasks:
+                ip_ifaces[ip].append(iface)
+        for ip, ifaces in ip_ifaces.items():
+            assert get_iface(ip) in ifaces, "expected interface for ip %s to be one of %s but got %s" % (
+                    ip, ifaces, get_iface(ip))
         ia = get_interfaces_addresses()
         assert ia
         #for iface, address in ia.items():