From 4905f1ebfe8a621e059ae54edc49ba37010faf22 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Tue, 23 Dec 2014 17:20:18 +0200 Subject: [PATCH] tests: Optimize multi_check() waits in ap_bss_add* and ap_multi_bss* There is no need to wait for the longer fixed duration for each STA when an event message or an earlier wait for another STA can be used instead. Signed-off-by: Jouni Malinen --- tests/hwsim/test_ap_dynamic.py | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/tests/hwsim/test_ap_dynamic.py b/tests/hwsim/test_ap_dynamic.py index 79aa5f749..c0b8aa886 100644 --- a/tests/hwsim/test_ap_dynamic.py +++ b/tests/hwsim/test_ap_dynamic.py @@ -40,18 +40,30 @@ def multi_check(dev, check): for i in range(0, num_bss): dev[i].request("BSS_FLUSH 0") dev[i].dump_monitor() - id.append(dev[i].connect("bss-" + str(i + 1), key_mgmt="NONE", - scan_freq="2412", wait_connect=check[i])) for i in range(0, num_bss): + if check[i]: + continue + id.append(dev[i].connect("bss-" + str(i + 1), key_mgmt="NONE", + scan_freq="2412", wait_connect=False)) + for i in range(num_bss): if not check[i]: - ev = dev[i].wait_event(["CTRL-EVENT-CONNECTED"], timeout=0.2) + continue + id.append(dev[i].connect("bss-" + str(i + 1), key_mgmt="NONE", + scan_freq="2412", wait_connect=True)) + first = True + for i in range(num_bss): + if not check[i]: + timeout=0.2 if first else 0.01 + first = False + ev = dev[i].wait_event(["CTRL-EVENT-CONNECTED"], timeout=timeout) if ev: raise Exception("Unexpected connection") for i in range(0, num_bss): dev[i].remove_network(id[i]) - - time.sleep(0.3) + for i in range(num_bss): + if check[i]: + dev[i].wait_disconnected(timeout=5) res = '' for i in range(0, num_bss):