From c7f35a9e9637f76fdbd3eef12c64b6e56dd7fd72 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Mon, 1 Dec 2014 17:50:58 +0200 Subject: [PATCH] tests: Make scan_for_auth more robust It was apparently possible for this test case not to do what it was supposed to do, i.e., get nl80211 Authenticate command failing due to cfg80211 BS entry missing. With the external radio work blocking fixed, this can be cleaned up by explicitly waiting for the scan event. In addition, a less used channel can be selected to avoid finding other BSS entries. Signed-off-by: Jouni Malinen --- tests/hwsim/test_scan.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/hwsim/test_scan.py b/tests/hwsim/test_scan.py index c99309fde..3fa6fde4b 100644 --- a/tests/hwsim/test_scan.py +++ b/tests/hwsim/test_scan.py @@ -288,10 +288,13 @@ def test_scan_for_auth(dev, apdev): raise Exception("Timeout while waiting radio work to start") dev[0].connect("open", key_mgmt="NONE", scan_freq="2412", wait_connect=False) + dev[0].dump_monitor() # Clear cfg80211 BSS table. - subprocess.call(['sudo', 'iw', dev[0].ifname, 'scan', 'trigger', - 'freq', '2462', 'flush']) - time.sleep(0.1) + subprocess.call(['iw', dev[0].ifname, 'scan', 'trigger', + 'freq', '2457', 'flush']) + ev = dev[0].wait_event(["CTRL-EVENT-SCAN-RESULTS"], 5) + if ev is None: + raise Exception("External flush scan timed out") # Release blocking radio work to allow connection to go through with the # cfg80211 BSS entry missing. dev[0].request("RADIO_WORK done " + id)