[PATCH 06/16] tests: Modify test_auto_m2d waiting for WPS-M2D

Ilan Peer ilan.peer
Wed Jun 17 06:24:52 PDT 2015


In case a dedicated P2P Device interface is used,
the test needs to wait on the group interface, but since
a group is not formed, the wpasupplicant object does not
have the group interface name so it waits on the wrong
interface for the event.

Fix this by explicitly waiting on the right interface,
based on the driver capabilities.

Signed-off-by: Ilan Peer <ilan.peer at intel.com>
---
 tests/hwsim/test_p2p_autogo.py | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/tests/hwsim/test_p2p_autogo.py b/tests/hwsim/test_p2p_autogo.py
index 50ef071..2f27f09 100644
--- a/tests/hwsim/test_p2p_autogo.py
+++ b/tests/hwsim/test_p2p_autogo.py
@@ -186,7 +186,16 @@ def test_autogo_m2d(dev):
     ev = dev[2].wait_global_event(["WPS-M2D"], timeout=10)
     if ev is None:
         raise Exception("No global M2D event (2)")
-    ev = dev[2].wait_event(["WPS-M2D"], timeout=10)
+
+    ifaces = dev[2].request("INTERFACES").splitlines()
+    res = dev[2].get_driver_status()
+    if (int(res['capa.flags'], 0) & 0x20000000):
+        iface = ifaces[0] if "p2p-wlan" in ifaces[0] else ifaces[1]
+    else:
+        iface = ifaces[0]
+
+    wpas = WpaSupplicant(ifname=iface)
+    ev = wpas.wait_event(["WPS-M2D"], timeout=10)
     if ev is None:
         raise Exception("No M2D event on group interface (2)")
 
-- 
1.9.1




More information about the Hostap mailing list