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>
This commit is contained in:
Jouni Malinen 2016-01-06 18:56:31 +02:00
parent 1d20c66e45
commit 8251be17be
3 changed files with 13 additions and 5 deletions

View file

@ -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])

View file

@ -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")

View file

@ -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")