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>
This commit is contained in:
Jouni Malinen 2014-12-01 17:50:58 +02:00 committed by Jouni Malinen
parent e374522827
commit c7f35a9e96

View File

@ -288,10 +288,13 @@ def test_scan_for_auth(dev, apdev):
raise Exception("Timeout while waiting radio work to start") raise Exception("Timeout while waiting radio work to start")
dev[0].connect("open", key_mgmt="NONE", scan_freq="2412", dev[0].connect("open", key_mgmt="NONE", scan_freq="2412",
wait_connect=False) wait_connect=False)
dev[0].dump_monitor()
# Clear cfg80211 BSS table. # Clear cfg80211 BSS table.
subprocess.call(['sudo', 'iw', dev[0].ifname, 'scan', 'trigger', subprocess.call(['iw', dev[0].ifname, 'scan', 'trigger',
'freq', '2462', 'flush']) 'freq', '2457', 'flush'])
time.sleep(0.1) 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 # Release blocking radio work to allow connection to go through with the
# cfg80211 BSS entry missing. # cfg80211 BSS entry missing.
dev[0].request("RADIO_WORK done " + id) dev[0].request("RADIO_WORK done " + id)