aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2016-01-06 16:56:31 (GMT)
committerJouni Malinen <j@w1.fi>2016-01-06 16:56:31 (GMT)
commit8251be17bece5bbfbc0c6d4d6a0ff74dc6a69f78 (patch)
treeb9c55d298d220b9b6ecf4a30f626b4f6c09f2804 /tests
parent1d20c66e45c8b17cbdbb161c663fb3d2914ce80e (diff)
downloadhostap-8251be17bece5bbfbc0c6d4d6a0ff74dc6a69f78.zip
hostap-8251be17bece5bbfbc0c6d4d6a0ff74dc6a69f78.tar.gz
hostap-8251be17bece5bbfbc0c6d4d6a0ff74dc6a69f78.tar.bz2
tests: Speed up discovery_group_client and nfc_p2p_client
There is no need for these to go through a full scan when the GO operating channel is known. Signed-off-by: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'tests')
-rw-r--r--tests/hwsim/test_nfc_p2p.py8
-rw-r--r--tests/hwsim/test_p2p_discovery.py3
-rw-r--r--tests/hwsim/wpasupplicant.py7
3 files changed, 13 insertions, 5 deletions
diff --git a/tests/hwsim/test_nfc_p2p.py b/tests/hwsim/test_nfc_p2p.py
index 318066a..3236ce2 100644
--- a/tests/hwsim/test_nfc_p2p.py
+++ b/tests/hwsim/test_nfc_p2p.py
@@ -285,11 +285,12 @@ def test_nfc_p2p_both_go(dev):
def test_nfc_p2p_client(dev):
"""NFC connection handover when one device is P2P client"""
logger.info("Start autonomous GOs")
- dev[0].p2p_start_go()
+ go_res = dev[0].p2p_start_go()
logger.info("Connect one device as a P2P client")
pin = dev[1].wps_read_pin()
dev[0].p2p_go_authorize_client(pin)
- dev[1].p2p_connect_group(dev[0].p2p_dev_addr(), pin, timeout=60)
+ dev[1].p2p_connect_group(dev[0].p2p_dev_addr(), pin,
+ freq=int(go_res['freq']), timeout=60)
logger.info("Client connected")
hwsim_utils.test_connectivity_p2p(dev[0], dev[1])
@@ -319,7 +320,8 @@ def test_nfc_p2p_client(dev):
logger.info("Connect to group based on upper layer trigger")
pin = dev[2].wps_read_pin()
dev[0].p2p_go_authorize_client(pin)
- dev[2].p2p_connect_group(dev[0].p2p_dev_addr(), pin, timeout=60)
+ dev[2].p2p_connect_group(dev[0].p2p_dev_addr(), pin,
+ freq=int(go_res['freq']), timeout=60)
logger.info("Client connected")
hwsim_utils.test_connectivity_p2p(dev[0], dev[1])
hwsim_utils.test_connectivity_p2p(dev[1], dev[2])
diff --git a/tests/hwsim/test_p2p_discovery.py b/tests/hwsim/test_p2p_discovery.py
index 22ce173..23b18d2 100644
--- a/tests/hwsim/test_p2p_discovery.py
+++ b/tests/hwsim/test_p2p_discovery.py
@@ -119,7 +119,8 @@ def test_discovery_group_client(dev):
logger.info("Connect a client to the GO")
pin = dev[1].wps_read_pin()
dev[0].p2p_go_authorize_client(pin)
- dev[1].p2p_connect_group(dev[0].p2p_dev_addr(), pin, timeout=60)
+ dev[1].p2p_connect_group(dev[0].p2p_dev_addr(), pin, freq=int(res['freq']),
+ timeout=60)
logger.info("Client connected")
hwsim_utils.test_connectivity_p2p(dev[0], dev[1])
logger.info("Try to discover a P2P client in a group")
diff --git a/tests/hwsim/wpasupplicant.py b/tests/hwsim/wpasupplicant.py
index 42bca46..da90ffd 100644
--- a/tests/hwsim/wpasupplicant.py
+++ b/tests/hwsim/wpasupplicant.py
@@ -776,6 +776,7 @@ class WpaSupplicant:
if not self.discover_peer(go_addr, social=social, freq=freq):
if social or not self.discover_peer(go_addr, social=social):
raise Exception("GO " + go_addr + " not found")
+ self.p2p_stop_find()
self.dump_monitor()
cmd = "P2P_CONNECT " + go_addr + " " + pin + " join"
if freq:
@@ -784,9 +785,13 @@ class WpaSupplicant:
if timeout == 0:
self.dump_monitor()
return None
- ev = self.wait_global_event(["P2P-GROUP-STARTED"], timeout)
+ ev = self.wait_global_event(["P2P-GROUP-STARTED",
+ "P2P-GROUP-FORMATION-FAILURE"],
+ timeout)
if ev is None:
raise Exception("Joining the group timed out")
+ if "P2P-GROUP-STARTED" not in ev:
+ raise Exception("Failed to join the group")
self.dump_monitor()
return self.group_form_result(ev)
raise Exception("P2P_CONNECT(join) failed")