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:
parent
1d20c66e45
commit
8251be17be
3 changed files with 13 additions and 5 deletions
|
@ -285,11 +285,12 @@ def test_nfc_p2p_both_go(dev):
|
||||||
def test_nfc_p2p_client(dev):
|
def test_nfc_p2p_client(dev):
|
||||||
"""NFC connection handover when one device is P2P client"""
|
"""NFC connection handover when one device is P2P client"""
|
||||||
logger.info("Start autonomous GOs")
|
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")
|
logger.info("Connect one device as a P2P client")
|
||||||
pin = dev[1].wps_read_pin()
|
pin = dev[1].wps_read_pin()
|
||||||
dev[0].p2p_go_authorize_client(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")
|
logger.info("Client connected")
|
||||||
hwsim_utils.test_connectivity_p2p(dev[0], dev[1])
|
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")
|
logger.info("Connect to group based on upper layer trigger")
|
||||||
pin = dev[2].wps_read_pin()
|
pin = dev[2].wps_read_pin()
|
||||||
dev[0].p2p_go_authorize_client(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")
|
logger.info("Client connected")
|
||||||
hwsim_utils.test_connectivity_p2p(dev[0], dev[1])
|
hwsim_utils.test_connectivity_p2p(dev[0], dev[1])
|
||||||
hwsim_utils.test_connectivity_p2p(dev[1], dev[2])
|
hwsim_utils.test_connectivity_p2p(dev[1], dev[2])
|
||||||
|
|
|
@ -119,7 +119,8 @@ def test_discovery_group_client(dev):
|
||||||
logger.info("Connect a client to the GO")
|
logger.info("Connect a client to the GO")
|
||||||
pin = dev[1].wps_read_pin()
|
pin = dev[1].wps_read_pin()
|
||||||
dev[0].p2p_go_authorize_client(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")
|
logger.info("Client connected")
|
||||||
hwsim_utils.test_connectivity_p2p(dev[0], dev[1])
|
hwsim_utils.test_connectivity_p2p(dev[0], dev[1])
|
||||||
logger.info("Try to discover a P2P client in a group")
|
logger.info("Try to discover a P2P client in a group")
|
||||||
|
|
|
@ -776,6 +776,7 @@ class WpaSupplicant:
|
||||||
if not self.discover_peer(go_addr, social=social, freq=freq):
|
if not self.discover_peer(go_addr, social=social, freq=freq):
|
||||||
if social or not self.discover_peer(go_addr, social=social):
|
if social or not self.discover_peer(go_addr, social=social):
|
||||||
raise Exception("GO " + go_addr + " not found")
|
raise Exception("GO " + go_addr + " not found")
|
||||||
|
self.p2p_stop_find()
|
||||||
self.dump_monitor()
|
self.dump_monitor()
|
||||||
cmd = "P2P_CONNECT " + go_addr + " " + pin + " join"
|
cmd = "P2P_CONNECT " + go_addr + " " + pin + " join"
|
||||||
if freq:
|
if freq:
|
||||||
|
@ -784,9 +785,13 @@ class WpaSupplicant:
|
||||||
if timeout == 0:
|
if timeout == 0:
|
||||||
self.dump_monitor()
|
self.dump_monitor()
|
||||||
return None
|
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:
|
if ev is None:
|
||||||
raise Exception("Joining the group timed out")
|
raise Exception("Joining the group timed out")
|
||||||
|
if "P2P-GROUP-STARTED" not in ev:
|
||||||
|
raise Exception("Failed to join the group")
|
||||||
self.dump_monitor()
|
self.dump_monitor()
|
||||||
return self.group_form_result(ev)
|
return self.group_form_result(ev)
|
||||||
raise Exception("P2P_CONNECT(join) failed")
|
raise Exception("P2P_CONNECT(join) failed")
|
||||||
|
|
Loading…
Reference in a new issue