tests: Make wpas_mesh_password_mismatch more robust

It seems to be possible for dev2 (the one with incorrect password) to
stop retries before either dev0 or dev1 reports the authentication
failure event. For now, allow the test case pass if either dev0 or dev1
reports the event rather than requiring both to report this. The
expected behavior can be fine-tuned in the future if the reporting
behavior is modified to be more consistent.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2015-02-12 15:50:52 +02:00 committed by Jouni Malinen
parent 480994dafb
commit 792eafa047

View file

@ -537,17 +537,22 @@ def test_wpas_mesh_password_mismatch(dev, apdev):
if ev is None: if ev is None:
raise Exception("dev2 did not report auth failure (2)") raise Exception("dev2 did not report auth failure (2)")
count = 0
ev = dev[0].wait_event(["MESH-SAE-AUTH-FAILURE"], timeout=1) ev = dev[0].wait_event(["MESH-SAE-AUTH-FAILURE"], timeout=1)
if ev is None: if ev is None:
raise Exception("dev0 did not report auth failure") logger.info("dev0 did not report auth failure")
else:
if "addr=" + dev[2].own_addr() not in ev: if "addr=" + dev[2].own_addr() not in ev:
raise Exception("Unexpected peer address in dev0 event: " + ev) raise Exception("Unexpected peer address in dev0 event: " + ev)
count += 1
ev = dev[1].wait_event(["MESH-SAE-AUTH-FAILURE"], timeout=1) ev = dev[1].wait_event(["MESH-SAE-AUTH-FAILURE"], timeout=1)
if ev is None: if ev is None:
raise Exception("dev1 did not report auth failure") logger.info("dev1 did not report auth failure")
else:
if "addr=" + dev[2].own_addr() not in ev: if "addr=" + dev[2].own_addr() not in ev:
raise Exception("Unexpected peer address in dev1 event: " + ev) raise Exception("Unexpected peer address in dev1 event: " + ev)
count += 1
hwsim_utils.test_connectivity(dev[0], dev[1]) hwsim_utils.test_connectivity(dev[0], dev[1])
@ -559,6 +564,9 @@ def test_wpas_mesh_password_mismatch(dev, apdev):
if "data delivery failed" not in str(e): if "data delivery failed" not in str(e):
raise raise
if count == 0:
raise Exception("Neither dev0 nor dev1 reported auth failure")
def test_wpas_mesh_password_mismatch_retry(dev, apdev, params): def test_wpas_mesh_password_mismatch_retry(dev, apdev, params):
"""Mesh password mismatch and retry [long]""" """Mesh password mismatch and retry [long]"""
if not params['long']: if not params['long']: