]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Make scan_for_auth more robust
authorJouni Malinen <jouni@qca.qualcomm.com>
Mon, 1 Dec 2014 15:50:58 +0000 (17:50 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 1 Dec 2014 18:17:08 +0000 (20:17 +0200)
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 <jouni@qca.qualcomm.com>
tests/hwsim/test_scan.py

index c99309fde569b0c368feb2afe7f35aef3d9f5ae8..3fa6fde4b5aeb91b0fb4235158e978ab6c34f935 100644 (file)
@@ -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)