tests: Make flush_scan_cache() more robust
Handle the cases where the first attempt to start scan fails due to an ongoing scan. Stop such scan and try again instead of failing the test case immediately. Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
This commit is contained in:
parent
4f65f66aeb
commit
a46c5738bc
1 changed files with 9 additions and 2 deletions
|
@ -1196,8 +1196,15 @@ class WpaSupplicant:
|
|||
raise Exception("Could not find BSS " + bssid + " in scan")
|
||||
|
||||
def flush_scan_cache(self, freq=2417):
|
||||
self.request("BSS_FLUSH 0")
|
||||
self.scan(freq=freq, only_new=True)
|
||||
for i in range(3):
|
||||
self.request("BSS_FLUSH 0")
|
||||
try:
|
||||
self.scan(freq=freq, only_new=True)
|
||||
except Exception as e:
|
||||
if i < 2:
|
||||
logger.info("flush_scan_cache: Failed to start scan: " + str(e))
|
||||
self.request("ABORT_SCAN")
|
||||
time.sleep(0.1)
|
||||
res = self.request("SCAN_RESULTS")
|
||||
if len(res.splitlines()) > 1:
|
||||
logger.debug("Scan results remaining after first attempt to flush the results:\n" + res)
|
||||
|
|
Loading…
Reference in a new issue