Browse Source

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 <jouni@qca.qualcomm.com>
Jouni Malinen 10 years ago
parent
commit
c7f35a9e96
1 changed files with 6 additions and 3 deletions
  1. 6 3
      tests/hwsim/test_scan.py

+ 6 - 3
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)