]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Make discovery_group_client more robust
authorJouni Malinen <j@w1.fi>
Thu, 15 May 2014 11:13:39 +0000 (14:13 +0300)
committerJouni Malinen <j@w1.fi>
Thu, 15 May 2014 15:38:11 +0000 (18:38 +0300)
Allow three P2P_FIND attempts for discovering the GO on a non-social
channels since the single Probe Response frame can be missed easily
under heavy CPU load.

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

index c159aad244cca454be29acd85ed74f04bb6a5aef..803f830b9a2035e9e4992ffdfee4e9b539cc4254 100644 (file)
@@ -100,8 +100,10 @@ def test_discovery_group_client(dev):
     logger.info("Client connected")
     hwsim_utils.test_connectivity_p2p(dev[0], dev[1])
     logger.info("Try to discover a P2P client in a group")
-    if not dev[2].discover_peer(dev[1].p2p_dev_addr(), social=False):
-        raise Exception("Could not discover group client")
+    if not dev[2].discover_peer(dev[1].p2p_dev_addr(), social=False, timeout=10):
+        if not dev[2].discover_peer(dev[1].p2p_dev_addr(), social=False, timeout=10):
+            if not dev[2].discover_peer(dev[1].p2p_dev_addr(), social=False, timeout=10):
+                raise Exception("Could not discover group client")
 
     # This is not really perfect, but something to get a bit more testing
     # coverage.. For proper discoverability mechanism validation, the P2P
index a1a32fb5fbfdffde3e31cdd70e2d2bdcc9e47f68..fb77e9b792866fcc9888cea165fb9998406e2bbb 100644 (file)
@@ -613,7 +613,8 @@ class WpaSupplicant:
     def p2p_connect_group(self, go_addr, pin, timeout=0, social=False):
         self.dump_monitor()
         if not self.discover_peer(go_addr, social=social):
-            raise Exception("GO " + go_addr + " not found")
+            if social or not self.discover_peer(go_addr, social=social):
+                raise Exception("GO " + go_addr + " not found")
         self.dump_monitor()
         cmd = "P2P_CONNECT " + go_addr + " " + pin + " join"
         if "OK" in self.global_request(cmd):