From 180cd73dc8888741fe6194d7ba615e32e3c72c39 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Thu, 27 Feb 2014 18:01:32 +0200 Subject: [PATCH] tests: Optimize ap_wps_init_through_wps_config Wait a bit between WPS_CONFIG command and the first scan. This can avoid an extra five second wait due to having to scan again if the initial scan operations happens to be quick enough to happen before the AP has updated its configuration. Signed-off-by: Jouni Malinen --- tests/hwsim/test_ap_wps.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/hwsim/test_ap_wps.py b/tests/hwsim/test_ap_wps.py index e4d93d89b..ee82f6ec2 100644 --- a/tests/hwsim/test_ap_wps.py +++ b/tests/hwsim/test_ap_wps.py @@ -130,6 +130,14 @@ def test_ap_wps_init_through_wps_config(dev, apdev): hapd = hostapd.Hostapd(apdev[0]['ifname']) if "FAIL" in hapd.request("WPS_CONFIG " + ssid.encode("hex") + " WPA2PSK CCMP " + "12345678".encode("hex")): raise Exception("WPS_CONFIG command failed") + ev = hapd.wait_event(["WPS-NEW-AP-SETTINGS"], timeout=5) + if ev is None: + raise Exception("Timeout on WPS-NEW-AP-SETTINGS events") + # It takes some time for the AP to update Beacon and Probe Response frames, + # so wait here before requesting the scan to be started to avoid adding + # extra five second wait to the test due to fetching obsolete scan results. + hapd.ping() + time.sleep(0.2) dev[0].connect(ssid, psk="12345678", scan_freq="2412", proto="WPA2", pairwise="CCMP", group="CCMP")