]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Make wpas_mesh_max_peering more robust
authorJouni Malinen <j@w1.fi>
Fri, 2 Jan 2015 20:12:38 +0000 (22:12 +0200)
committerJouni Malinen <j@w1.fi>
Fri, 2 Jan 2015 20:50:27 +0000 (22:50 +0200)
The previous version was enabling all three stations at the same time
and left dev[1] and dev[2] competing on getting connected with dev[0]
that allowed only one pairing. This was not exactly robust and the pass
criteria depended on an extra event from either dev[1] or dev[2]. Fix
that by first connecting dev[0] and dev[1] and only after that, start
dev[2]. This allows proper validation of both the peering limit on
dev[0] and no extra event on dev[2].

Signed-off-by: Jouni Malinen <j@w1.fi>
tests/hwsim/test_wpas_mesh.py

index 06f4c2bb42db9d83702c93589ac782bfa7b4dcbf..08baeb6ab62fff082c3da30a1763257132a432ca 100644 (file)
@@ -459,14 +459,18 @@ def test_wpas_mesh_max_peering(dev, apdev):
         return "skip"
     try:
         dev[0].request("SET max_peer_links 1")
-        for i in range(3):
-            add_open_mesh_network(dev[i])
 
-        for i in range(3):
+        # first, connect dev[0] and dev[1]
+        add_open_mesh_network(dev[0])
+        add_open_mesh_network(dev[1])
+        for i in range(2):
             ev = dev[i].wait_event(["MESH-PEER-CONNECTED"])
             if ev is None:
                 raise Exception("dev%d did not connect with any peer" % i)
 
+        # add dev[2] which will try to connect with both dev[0] and dev[1],
+        # but can complete connection only with dev[1]
+        add_open_mesh_network(dev[2])
         for i in range(1, 3):
             ev = dev[i].wait_event(["MESH-PEER-CONNECTED"])
             if ev is None:
@@ -476,6 +480,10 @@ def test_wpas_mesh_max_peering(dev, apdev):
         if ev is not None:
             raise Exception("dev0 connection beyond max peering limit")
 
+        ev = dev[2].wait_event(["MESH-PEER-CONNECTED"], timeout=0.1)
+        if ev is not None:
+            raise Exception("dev2 reported unexpected peering: " + ev)
+
         for i in range(3):
             dev[i].mesh_group_remove()
             check_mesh_group_removed(dev[i])