tests: Make dpp_two_initiators more robust
This test case has a race condition between the first and second initiated DPP exchange. New kernel scheduling with UML time-travel is making the first exchange complete before the first one can be started. Making this fully robust would likely need ext_mgmt_frame_handling=1 and more complex test script, but as an initial workaround, split URI parsing from dev[2] to happen before dev[1] is started so that only a single DPP_AUTH_INIT command is needed during the race window. In addition, detect the race condition and SKIP the test instead of reporting FAIL. Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
b0fc0154f5
commit
97f7f9ce9b
1 changed files with 14 additions and 3 deletions
|
@ -5488,13 +5488,21 @@ def test_dpp_two_initiators(dev, apdev):
|
|||
id = dev[0].dpp_bootstrap_gen(chan="81/1", mac=True)
|
||||
uri = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id)
|
||||
dev[0].dpp_listen(2412)
|
||||
peer = dev[2].dpp_qr_code(uri)
|
||||
dev[1].dpp_auth_init(uri=uri)
|
||||
ev = dev[0].wait_event(["DPP-RX"], timeout=5)
|
||||
if ev is None:
|
||||
raise Exeption("No DPP Authentication Request seen")
|
||||
dev[2].dpp_auth_init(uri=uri)
|
||||
wait_dpp_fail(dev[0],
|
||||
"DPP-FAIL Already in DPP authentication exchange - ignore new one")
|
||||
dev[2].dpp_auth_init(uri=uri, peer=peer)
|
||||
ev = dev[0].wait_event(["DPP-FAIL"], timeout=5)
|
||||
if ev is None:
|
||||
raise Exception("Failure not reported")
|
||||
skip = False
|
||||
if "Configurator rejected configuration" in ev:
|
||||
# Race condition prevented real test from being executed
|
||||
skip = True
|
||||
elif "DPP-FAIL Already in DPP authentication exchange - ignore new one" not in ev:
|
||||
raise Exception("Unexpected result: " + ev)
|
||||
|
||||
ev = dev[0].wait_event(["DPP-CONF-FAILED"], timeout=2)
|
||||
if ev is None:
|
||||
|
@ -5507,6 +5515,9 @@ def test_dpp_two_initiators(dev, apdev):
|
|||
dev[1].request("DPP_STOP_LISTEN")
|
||||
dev[2].request("DPP_STOP_LISTEN")
|
||||
|
||||
if skip:
|
||||
raise HwsimSkip("dpp_two_initiators not fully executed due to race condition")
|
||||
|
||||
def test_dpp_conf_file_update(dev, apdev, params):
|
||||
"""DPP provisioning updating wpa_supplicant configuration file"""
|
||||
config = os.path.join(params['logdir'], 'dpp_conf_file_update.conf')
|
||||
|
|
Loading…
Reference in a new issue