tests: Merge grpform_cred_ready_timeout test cases into a single one
These test cases had a long 120 seconds wait for the GO Negotiation initiator to time out. This can be done using two devices in parallel to save two minutes from total test execution time. Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
267ac3bcd6
commit
a69d0cdc72
2 changed files with 38 additions and 35 deletions
|
@ -14,6 +14,7 @@ import os
|
|||
import hostapd
|
||||
import hwsim_utils
|
||||
import utils
|
||||
from wpasupplicant import WpaSupplicant
|
||||
|
||||
def check_grpform_results(i_res, r_res):
|
||||
if i_res['result'] != 'success' or r_res['result'] != 'success':
|
||||
|
@ -734,52 +735,55 @@ def test_grpform_cred_ready_timeout(dev, apdev, params):
|
|||
addr1 = dev[1].p2p_dev_addr()
|
||||
if not dev[0].discover_peer(addr1):
|
||||
raise Exception("Peer " + addr1 + " not found")
|
||||
start = os.times()[4]
|
||||
if "OK" not in dev[0].request("P2P_CONNECT " + addr1 + " 12345670 display"):
|
||||
raise Exception("Failed to initiate GO Neg")
|
||||
ev = dev[0].wait_global_event(["P2P-GO-NEG-FAILURE"], timeout=200)
|
||||
if ev is None:
|
||||
raise Exception("GO Negotiation failure timed out")
|
||||
end = os.times()[4]
|
||||
logger.info("GO Negotiation wait time: {} seconds".format(end - start))
|
||||
if end - start < 120:
|
||||
raise Exception("Too short GO Negotiation wait time: {}".format(end - start))
|
||||
if not dev[2].discover_peer(addr1):
|
||||
raise Exception("Peer " + addr1 + " not found(2)")
|
||||
|
||||
def test_grpform_cred_ready_timeout2(dev, apdev, params):
|
||||
"""P2P GO Negotiation wait for credentials to become ready (2) [long]"""
|
||||
if not params['long']:
|
||||
logger.info("Skip test case with long duration due to --long not specified")
|
||||
return "skip"
|
||||
|
||||
dev[1].p2p_listen()
|
||||
addr1 = dev[1].p2p_dev_addr()
|
||||
if not dev[0].discover_peer(addr1):
|
||||
raise Exception("Peer " + addr1 + " not found")
|
||||
start = os.times()[4]
|
||||
if "OK" not in dev[0].global_request("P2P_CONNECT " + addr1 + " 12345670 display"):
|
||||
|
||||
cmd = "P2P_CONNECT " + addr1 + " 12345670 display"
|
||||
if "OK" not in dev[0].global_request(cmd):
|
||||
raise Exception("Failed to initiate GO Neg")
|
||||
ev = dev[0].wait_global_event(["P2P-GO-NEG-FAILURE"], timeout=30)
|
||||
|
||||
if "OK" not in dev[2].global_request(cmd):
|
||||
raise Exception("Failed to initiate GO Neg(2)")
|
||||
|
||||
# First, check with p2p_find
|
||||
ev = dev[2].wait_global_event(["P2P-GO-NEG-FAILURE"], timeout=30)
|
||||
if ev is not None:
|
||||
raise Exception("Too early GO Negotiation timeout reported")
|
||||
dev[0].dump_monitor()
|
||||
raise Exception("Too early GO Negotiation timeout reported(2)")
|
||||
dev[2].dump_monitor()
|
||||
logger.info("Starting p2p_find to change state")
|
||||
dev[0].p2p_find()
|
||||
ev = dev[0].wait_global_event(["P2P-GO-NEG-FAILURE"], timeout=100)
|
||||
dev[2].p2p_find()
|
||||
ev = dev[2].wait_global_event(["P2P-GO-NEG-FAILURE"], timeout=100)
|
||||
if ev is None:
|
||||
raise Exception("GO Negotiation failure timed out(2)")
|
||||
dev[2].dump_monitor()
|
||||
end = os.times()[4]
|
||||
logger.info("GO Negotiation wait time: {} seconds(2)".format(end - start))
|
||||
if end - start < 120:
|
||||
raise Exception("Too short GO Negotiation wait time(2): {}".format(end - start))
|
||||
|
||||
wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
|
||||
wpas.interface_add("wlan5")
|
||||
|
||||
wpas.p2p_listen()
|
||||
ev = dev[2].wait_global_event(["P2P-DEVICE-FOUND"], timeout=10)
|
||||
if ev is None:
|
||||
raise Exception("Did not discover new device after GO Negotiation failure")
|
||||
if wpas.p2p_dev_addr() not in ev:
|
||||
raise Exception("Unexpected device found: " + ev)
|
||||
dev[2].p2p_stop_find()
|
||||
wpas.p2p_stop_find()
|
||||
|
||||
# Finally, verify without p2p_find
|
||||
ev = dev[0].wait_global_event(["P2P-GO-NEG-FAILURE"], timeout=120)
|
||||
if ev is None:
|
||||
raise Exception("GO Negotiation failure timed out")
|
||||
dev[0].dump_monitor()
|
||||
end = os.times()[4]
|
||||
logger.info("GO Negotiation wait time: {} seconds".format(end - start))
|
||||
if end - start < 120:
|
||||
raise Exception("Too short GO Negotiation wait time: {}".format(end - start))
|
||||
|
||||
dev[2].p2p_listen()
|
||||
ev = dev[0].wait_global_event(["P2P-DEVICE-FOUND"], timeout=10)
|
||||
if ev is None:
|
||||
raise Exception("Did not discovery new device after GO Negotiation failure")
|
||||
if dev[2].p2p_dev_addr() not in ev:
|
||||
raise Exception("Unexpected device found: " + ev)
|
||||
|
||||
def test_grpform_no_wsc_done(dev):
|
||||
"""P2P group formation with WSC-Done not sent"""
|
||||
addr0 = dev[0].p2p_dev_addr()
|
||||
|
|
|
@ -172,7 +172,6 @@ def main():
|
|||
# completed their work.
|
||||
long = [ "ap_wps_pbc_timeout",
|
||||
"grpform_cred_ready_timeout",
|
||||
"grpform_cred_ready_timeout2",
|
||||
"discovery_pd_retries",
|
||||
"ibss_wpa_none",
|
||||
"concurrent_p2pcli",
|
||||
|
|
Loading…
Reference in a new issue