[PATCH 07/14] tests: Change some p2p_ext_vendor_elem_* tests

Ilan Peer ilan.peer
Wed Oct 14 08:43:13 PDT 2015


From: Avraham Stern <avraham.stern at intel.com>

Use the global control interface for MGMT_RX events to support
configurations that use a dedicated P2P Device interface.

In addition clear ext_mgmt_frame_handling at the end of tests
that set it to avoid interference with other tests.

The modified tests are:

p2p_ext_vendor_elem_probe_req
p2p_ext_vendor_elem_probe_pd_rq
p2p_ext_vendor_elem_probe_pd_resp
p2p_ext_vendor_elem_go_neg_req
p2p_ext_vendor_elem_go_neg_resp
p2p_ext_vendor_elem_invitation

Signed-off-by: Avraham Stern <avraham.stern at intel.com>
---
 tests/hwsim/test_p2p_ext.py | 36 +++++++++++++++++++++---------------
 1 file changed, 21 insertions(+), 15 deletions(-)

diff --git a/tests/hwsim/test_p2p_ext.py b/tests/hwsim/test_p2p_ext.py
index 7385e97..ab59ff4 100644
--- a/tests/hwsim/test_p2p_ext.py
+++ b/tests/hwsim/test_p2p_ext.py
@@ -102,6 +102,7 @@ def test_p2p_ext_vendor_elem_probe_req(dev):
         _test_p2p_ext_vendor_elem_probe_req(dev)
     finally:
         dev[0].request("VENDOR_ELEM_REMOVE 0 *")
+        dev[1].global_request("SET ext_mgmt_frame_handling 0")
 
 def _test_p2p_ext_vendor_elem_probe_req(dev):
     addr1 = dev[1].p2p_dev_addr()
@@ -110,9 +111,9 @@ def _test_p2p_ext_vendor_elem_probe_req(dev):
     dev[1].p2p_listen()
     if not dev[0].discover_peer(addr1):
         raise Exception("Device discovery timed out")
-    if "FAIL" in dev[1].request("SET ext_mgmt_frame_handling 1"):
+    if "FAIL" in dev[1].global_request("SET ext_mgmt_frame_handling 1"):
         raise Exception("Failed to enable external management frame handling")
-    ev = dev[1].wait_event(["MGMT-RX"], timeout=5)
+    ev = dev[1].wait_global_event(["MGMT-RX"], timeout=5)
     if ev is None:
         raise Exception("MGMT-RX timeout")
     if " 40" not in ev:
@@ -128,6 +129,7 @@ def test_p2p_ext_vendor_elem_pd_req(dev):
         _test_p2p_ext_vendor_elem_pd_req(dev)
     finally:
         dev[0].request("VENDOR_ELEM_REMOVE 4 *")
+        dev[1].global_request("SET ext_mgmt_frame_handling 0")
 
 def _test_p2p_ext_vendor_elem_pd_req(dev):
     addr0 = dev[0].p2p_dev_addr()
@@ -138,11 +140,11 @@ def _test_p2p_ext_vendor_elem_pd_req(dev):
     if not dev[0].discover_peer(addr1):
         raise Exception("Device discovery timed out")
     dev[0].p2p_stop_find()
-    if "FAIL" in dev[1].request("SET ext_mgmt_frame_handling 1"):
+    if "FAIL" in dev[1].global_request("SET ext_mgmt_frame_handling 1"):
         raise Exception("Failed to enable external management frame handling")
     dev[0].global_request("P2P_PROV_DISC " + addr1 + " display")
     for i in range(5):
-        ev = dev[1].wait_event(["MGMT-RX"], timeout=5)
+        ev = dev[1].wait_global_event(["MGMT-RX"], timeout=5)
         if ev is None:
             raise Exception("MGMT-RX timeout")
         if " d0" in ev:
@@ -158,6 +160,7 @@ def test_p2p_ext_vendor_elem_pd_resp(dev):
         _test_p2p_ext_vendor_elem_pd_resp(dev)
     finally:
         dev[0].request("VENDOR_ELEM_REMOVE 5 *")
+        dev[1].global_request("SET ext_mgmt_frame_handling 0")
 
 def _test_p2p_ext_vendor_elem_pd_resp(dev):
     addr0 = dev[0].p2p_dev_addr()
@@ -168,11 +171,11 @@ def _test_p2p_ext_vendor_elem_pd_resp(dev):
     if not dev[1].discover_peer(addr0):
         raise Exception("Device discovery timed out")
     dev[1].p2p_stop_find()
-    if "FAIL" in dev[1].request("SET ext_mgmt_frame_handling 1"):
+    if "FAIL" in dev[1].global_request("SET ext_mgmt_frame_handling 1"):
         raise Exception("Failed to enable external management frame handling")
     dev[1].global_request("P2P_PROV_DISC " + addr0 + " display")
     for i in range(5):
-        ev = dev[1].wait_event(["MGMT-RX"], timeout=5)
+        ev = dev[1].wait_global_event(["MGMT-RX"], timeout=5)
         if ev is None:
             raise Exception("MGMT-RX timeout")
         if " d0" in ev:
@@ -188,6 +191,7 @@ def test_p2p_ext_vendor_elem_go_neg_req(dev):
         _test_p2p_ext_vendor_elem_go_neg_req(dev)
     finally:
         dev[0].request("VENDOR_ELEM_REMOVE 6 *")
+        dev[1].global_request("SET ext_mgmt_frame_handling 0")
 
 def _test_p2p_ext_vendor_elem_go_neg_req(dev):
     addr0 = dev[0].p2p_dev_addr()
@@ -198,11 +202,11 @@ def _test_p2p_ext_vendor_elem_go_neg_req(dev):
     if not dev[0].discover_peer(addr1):
         raise Exception("Device discovery timed out")
     dev[0].p2p_stop_find()
-    if "FAIL" in dev[1].request("SET ext_mgmt_frame_handling 1"):
+    if "FAIL" in dev[1].global_request("SET ext_mgmt_frame_handling 1"):
         raise Exception("Failed to enable external management frame handling")
     dev[0].global_request("P2P_CONNECT " + addr1 + " 12345670 display")
     for i in range(5):
-        ev = dev[1].wait_event(["MGMT-RX"], timeout=5)
+        ev = dev[1].wait_global_event(["MGMT-RX"], timeout=5)
         if ev is None:
             raise Exception("MGMT-RX timeout")
         if " d0" in ev:
@@ -218,6 +222,7 @@ def test_p2p_ext_vendor_elem_go_neg_resp(dev):
         _test_p2p_ext_vendor_elem_go_neg_resp(dev)
     finally:
         dev[0].request("VENDOR_ELEM_REMOVE 7 *")
+        dev[1].global_request("SET ext_mgmt_frame_handling 0")
 
 def _test_p2p_ext_vendor_elem_go_neg_resp(dev):
     addr0 = dev[0].p2p_dev_addr()
@@ -228,11 +233,11 @@ def _test_p2p_ext_vendor_elem_go_neg_resp(dev):
     if not dev[1].discover_peer(addr0):
         raise Exception("Device discovery timed out")
     dev[1].p2p_stop_find()
-    if "FAIL" in dev[1].request("SET ext_mgmt_frame_handling 1"):
+    if "FAIL" in dev[1].global_request("SET ext_mgmt_frame_handling 1"):
         raise Exception("Failed to enable external management frame handling")
     dev[1].global_request("P2P_CONNECT " + addr0 + " 12345670 display")
     for i in range(5):
-        ev = dev[1].wait_event(["MGMT-RX"], timeout=5)
+        ev = dev[1].wait_global_event(["MGMT-RX"], timeout=5)
         if ev is None:
             raise Exception("MGMT-RX timeout")
         if " d0" in ev:
@@ -272,6 +277,7 @@ def test_p2p_ext_vendor_elem_invitation(dev):
     finally:
         dev[0].request("VENDOR_ELEM_REMOVE 9 *")
         dev[0].request("VENDOR_ELEM_REMOVE 10 *")
+        dev[1].global_request("SET ext_mgmt_frame_handling 0")
 
 def _test_p2p_ext_vendor_elem_invitation(dev):
     addr0 = dev[0].p2p_dev_addr()
@@ -286,11 +292,11 @@ def _test_p2p_ext_vendor_elem_invitation(dev):
         raise Exception("Device discovery timed out")
     peer = dev[0].get_peer(addr1)
     dev[0].p2p_stop_find()
-    if "FAIL" in dev[1].request("SET ext_mgmt_frame_handling 1"):
+    if "FAIL" in dev[1].global_request("SET ext_mgmt_frame_handling 1"):
         raise Exception("Failed to enable external management frame handling")
     dev[0].global_request("P2P_INVITE persistent=" + peer['persistent'] + " peer=" + addr1)
     for i in range(5):
-        ev = dev[1].wait_event(["MGMT-RX"], timeout=5)
+        ev = dev[1].wait_global_event(["MGMT-RX"], timeout=5)
         if ev is None:
             raise Exception("MGMT-RX timeout")
         if " d0" in ev:
@@ -301,17 +307,17 @@ def _test_p2p_ext_vendor_elem_invitation(dev):
     dev[1].p2p_stop_find()
 
     dev[0].p2p_listen()
-    if "FAIL" in dev[1].request("SET ext_mgmt_frame_handling 0"):
+    if "FAIL" in dev[1].global_request("SET ext_mgmt_frame_handling 0"):
         raise Exception("Failed to disable external management frame handling")
     if not dev[1].discover_peer(addr0):
         raise Exception("Device discovery timed out")
     peer = dev[1].get_peer(addr0)
     dev[1].p2p_stop_find()
-    if "FAIL" in dev[1].request("SET ext_mgmt_frame_handling 1"):
+    if "FAIL" in dev[1].global_request("SET ext_mgmt_frame_handling 1"):
         raise Exception("Failed to enable external management frame handling")
     dev[1].global_request("P2P_INVITE persistent=" + peer['persistent'] + " peer=" + addr0)
     for i in range(5):
-        ev = dev[1].wait_event(["MGMT-RX"], timeout=5)
+        ev = dev[1].wait_global_event(["MGMT-RX"], timeout=5)
         if ev is None:
             raise Exception("MGMT-RX timeout")
         if " d0" in ev:
-- 
1.9.1




More information about the Hostap mailing list