From 792eafa04723c19d51bdccd5711070c04cf207fb Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Thu, 12 Feb 2015 15:50:52 +0200 Subject: [PATCH] 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 --- tests/hwsim/test_wpas_mesh.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/tests/hwsim/test_wpas_mesh.py b/tests/hwsim/test_wpas_mesh.py index 19d503bf0..f9b12139c 100644 --- a/tests/hwsim/test_wpas_mesh.py +++ b/tests/hwsim/test_wpas_mesh.py @@ -537,17 +537,22 @@ def test_wpas_mesh_password_mismatch(dev, apdev): if ev is None: raise Exception("dev2 did not report auth failure (2)") + count = 0 ev = dev[0].wait_event(["MESH-SAE-AUTH-FAILURE"], timeout=1) if ev is None: - raise Exception("dev0 did not report auth failure") - if "addr=" + dev[2].own_addr() not in ev: - raise Exception("Unexpected peer address in dev0 event: " + ev) + logger.info("dev0 did not report auth failure") + else: + if "addr=" + dev[2].own_addr() not in ev: + raise Exception("Unexpected peer address in dev0 event: " + ev) + count += 1 ev = dev[1].wait_event(["MESH-SAE-AUTH-FAILURE"], timeout=1) if ev is None: - raise Exception("dev1 did not report auth failure") - if "addr=" + dev[2].own_addr() not in ev: - raise Exception("Unexpected peer address in dev1 event: " + ev) + logger.info("dev1 did not report auth failure") + else: + if "addr=" + dev[2].own_addr() not in ev: + raise Exception("Unexpected peer address in dev1 event: " + ev) + count += 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): raise + if count == 0: + raise Exception("Neither dev0 nor dev1 reported auth failure") + def test_wpas_mesh_password_mismatch_retry(dev, apdev, params): """Mesh password mismatch and retry [long]""" if not params['long']: