[PATCH 4/7] tests: Modify test_p2p_discovery to use global and group interfaces
Ilan Peer
ilan.peer
Thu Feb 5 17:30:59 PST 2015
Modify the tests in test_p2p_discovery to use the global
control interface and group interface.
Change-Id: Ie35531e26e7d118f8a4aa0f477441f6834cb9762
Signed-off-by: Ilan Peer <ilan.peer at intel.com>
---
tests/hwsim/test_p2p_discovery.py | 30 ++++++++++++++++--------------
1 file changed, 16 insertions(+), 14 deletions(-)
diff --git a/tests/hwsim/test_p2p_discovery.py b/tests/hwsim/test_p2p_discovery.py
index f538411..83ab09f 100644
--- a/tests/hwsim/test_p2p_discovery.py
+++ b/tests/hwsim/test_p2p_discovery.py
@@ -99,7 +99,7 @@ def test_discovery_pd_retries(dev):
dev[1].p2p_stop_find()
dev[0].p2p_stop_find()
dev[0].global_request("P2P_PROV_DISC " + addr1 + " display")
- ev = dev[0].wait_event(["P2P-PROV-DISC-FAILURE"], timeout=60)
+ ev = dev[0].wait_global_event(["P2P-PROV-DISC-FAILURE"], timeout=60)
if ev is None:
raise Exception("No PD failure reported")
@@ -132,19 +132,21 @@ def test_discovery_group_client(dev):
# make group client non-responsive on operating channel
dev[1].dump_monitor()
dev[1].group_request("DISCONNECT")
- dev[1].wait_disconnected(timeout=10)
+ ev = dev[1].wait_group_event(["CTRL-EVENT-DISCONNECTED"], timeout=10)
+ if ev is None:
+ raise Exception("Timeout on waiting disconnection")
dev[2].request("P2P_CONNECT {} {} display".format(dev[1].p2p_dev_addr(),
pin))
- ev = dev[1].wait_event(["P2P-GO-NEG-REQUEST"], timeout=2)
+ ev = dev[1].wait_global_event(["P2P-GO-NEG-REQUEST"], timeout=2)
if ev:
raise Exception("Unexpected frame RX on P2P client")
# make group client available on operating channe
- dev[1].request("REASSOCIATE")
- ev = dev[1].wait_event(["CTRL-EVENT-CONNECTED", "P2P-GO-NEG-REQUEST"])
+ dev[1].group_request("REASSOCIATE")
+ ev = dev[1].wait_global_event(["CTRL-EVENT-CONNECTED", "P2P-GO-NEG-REQUEST"], timeout=10)
if ev is None:
raise Exception("Timeout on reconnection to group")
if "P2P-GO-NEG-REQUEST" not in ev:
- ev = dev[1].wait_event(["P2P-GO-NEG-REQUEST"])
+ ev = dev[1].wait_global_event(["P2P-GO-NEG-REQUEST"], timeout=10)
if ev is None:
raise Exception("Timeout on waiting for GO Negotiation Request")
@@ -153,11 +155,11 @@ def test_discovery_dev_type(dev):
dev[1].request("SET sec_device_type 1-0050F204-2")
dev[1].p2p_listen()
dev[0].p2p_find(social=True, dev_type="5-0050F204-1")
- ev = dev[0].wait_event(['P2P-DEVICE-FOUND'], timeout=1)
+ ev = dev[0].wait_global_event(['P2P-DEVICE-FOUND'], timeout=1)
if ev:
raise Exception("Unexpected P2P device found")
dev[0].p2p_find(social=True, dev_type="1-0050F204-2")
- ev = dev[0].wait_event(['P2P-DEVICE-FOUND'], timeout=2)
+ ev = dev[0].wait_global_event(['P2P-DEVICE-FOUND'], timeout=2)
if ev is None:
raise Exception("P2P device not found")
peer = dev[0].get_peer(dev[1].p2p_dev_addr())
@@ -174,11 +176,11 @@ def test_discovery_dev_type_go(dev):
dev[1].p2p_connect_group(dev[0].p2p_dev_addr(), pin, timeout=60)
dev[2].p2p_find(social=True, dev_type="5-0050F204-1")
- ev = dev[2].wait_event(['P2P-DEVICE-FOUND'], timeout=1)
+ ev = dev[2].wait_global_event(['P2P-DEVICE-FOUND'], timeout=1)
if ev:
raise Exception("Unexpected P2P device found")
dev[2].p2p_find(social=True, dev_type="1-0050F204-2")
- ev = dev[2].wait_event(['P2P-DEVICE-FOUND ' + addr1], timeout=2)
+ ev = dev[2].wait_global_event(['P2P-DEVICE-FOUND ' + addr1], timeout=2)
if ev is None:
raise Exception("P2P device not found")
@@ -220,11 +222,11 @@ def test_discovery_dev_id_go(dev):
dev[1].p2p_connect_group(dev[0].p2p_dev_addr(), pin, timeout=60)
dev[2].p2p_find(social=True, dev_id="02:03:04:05:06:07")
- ev = dev[2].wait_event(['P2P-DEVICE-FOUND'], timeout=1)
+ ev = dev[2].wait_global_event(['P2P-DEVICE-FOUND'], timeout=1)
if ev:
raise Exception("Unexpected P2P device found")
dev[2].p2p_find(social=True, dev_id=addr1)
- ev = dev[2].wait_event(['P2P-DEVICE-FOUND ' + addr1], timeout=2)
+ ev = dev[2].wait_global_event(['P2P-DEVICE-FOUND ' + addr1], timeout=2)
if ev is None:
raise Exception("P2P device not found")
@@ -234,8 +236,8 @@ def test_discovery_social_plus_one(dev):
dev[1].p2p_find(social=True)
dev[0].p2p_find(progressive=True)
logger.info("Wait for initial progressive find phases")
- dev[0].wait_event(["CTRL-EVENT-SCAN-STARTED"])
- dev[0].wait_event(["CTRL-EVENT-SCAN-STARTED"])
+ dev[0].wait_global_event(["CTRL-EVENT-SCAN-STARTED"], timeout=1)
+ dev[0].wait_global_event(["CTRL-EVENT-SCAN-STARTED"], timeout=1)
go = dev[2].p2p_dev_addr()
dev[2].p2p_start_go(freq="2422")
logger.info("Verify whether the GO on non-social channel can be found")
--
1.8.3.2
More information about the Hostap
mailing list