tests: Make scan test cases more robust by allowing retries
These test caases depended on a single active scan round finding the AP. It is possible for the Probe Response frame to get delayed sufficiently to miss the response especially when testing under heavy load with multiple parallel VMs. Allow couple of scan retries to avoid reporting failures from these test cases. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
parent
dd4feaad2a
commit
96425ea502
1 changed files with 25 additions and 9 deletions
|
@ -169,7 +169,11 @@ def test_scan_bss_expiration_age(dev, apdev):
|
||||||
raise Exception("BSS_EXPIRE_AGE failed")
|
raise Exception("BSS_EXPIRE_AGE failed")
|
||||||
hapd = hostapd.add_ap(apdev[0]['ifname'], { "ssid": "test-scan" })
|
hapd = hostapd.add_ap(apdev[0]['ifname'], { "ssid": "test-scan" })
|
||||||
bssid = apdev[0]['bssid']
|
bssid = apdev[0]['bssid']
|
||||||
dev[0].scan(freq="2412")
|
# Allow couple more retries to avoid reporting errors during heavy load
|
||||||
|
for i in range(5):
|
||||||
|
dev[0].scan(freq="2412")
|
||||||
|
if bssid in dev[0].request("SCAN_RESULTS"):
|
||||||
|
break
|
||||||
if bssid not in dev[0].request("SCAN_RESULTS"):
|
if bssid not in dev[0].request("SCAN_RESULTS"):
|
||||||
raise Exception("BSS not found in initial scan")
|
raise Exception("BSS not found in initial scan")
|
||||||
hapd.request("DISABLE")
|
hapd.request("DISABLE")
|
||||||
|
@ -633,13 +637,21 @@ def test_scan_setband(dev, apdev):
|
||||||
if "OK" not in dev[2].request("SET setband 2G"):
|
if "OK" not in dev[2].request("SET setband 2G"):
|
||||||
raise Exception("Failed to set setband")
|
raise Exception("Failed to set setband")
|
||||||
|
|
||||||
for i in range(3):
|
# Allow a retry to avoid reporting errors during heavy load
|
||||||
dev[i].request("SCAN only_new=1")
|
for j in range(5):
|
||||||
|
for i in range(3):
|
||||||
|
dev[i].request("SCAN only_new=1")
|
||||||
|
|
||||||
for i in range(3):
|
for i in range(3):
|
||||||
ev = dev[i].wait_event(["CTRL-EVENT-SCAN-RESULTS"], 15)
|
ev = dev[i].wait_event(["CTRL-EVENT-SCAN-RESULTS"], 15)
|
||||||
if ev is None:
|
if ev is None:
|
||||||
raise Exception("Scan timed out")
|
raise Exception("Scan timed out")
|
||||||
|
|
||||||
|
res0 = dev[0].request("SCAN_RESULTS")
|
||||||
|
res1 = dev[1].request("SCAN_RESULTS")
|
||||||
|
res2 = dev[2].request("SCAN_RESULTS")
|
||||||
|
if bssid in res0 and bssid2 in res0 and bssid in res1 and bssid2 in res2:
|
||||||
|
break
|
||||||
|
|
||||||
res = dev[0].request("SCAN_RESULTS")
|
res = dev[0].request("SCAN_RESULTS")
|
||||||
if bssid not in res or bssid2 not in res:
|
if bssid not in res or bssid2 not in res:
|
||||||
|
@ -816,8 +828,12 @@ def test_scan_specify_ssid(dev, apdev):
|
||||||
bss = dev[0].get_bss(bssid)
|
bss = dev[0].get_bss(bssid)
|
||||||
if bss is not None and bss['ssid'] == 'test-hidden':
|
if bss is not None and bss['ssid'] == 'test-hidden':
|
||||||
raise Exception("BSS entry for hidden AP present unexpectedly")
|
raise Exception("BSS entry for hidden AP present unexpectedly")
|
||||||
check_scan(dev[0], "freq=2412 ssid 414243 ssid 746573742d68696464656e ssid 616263313233 use_id=1")
|
# Allow couple more retries to avoid reporting errors during heavy load
|
||||||
bss = dev[0].get_bss(bssid)
|
for i in range(5):
|
||||||
|
check_scan(dev[0], "freq=2412 ssid 414243 ssid 746573742d68696464656e ssid 616263313233 use_id=1")
|
||||||
|
bss = dev[0].get_bss(bssid)
|
||||||
|
if bss and 'test-hidden' in dev[0].request("SCAN_RESULTS"):
|
||||||
|
break
|
||||||
if bss is None:
|
if bss is None:
|
||||||
raise Exception("BSS entry for hidden AP not found")
|
raise Exception("BSS entry for hidden AP not found")
|
||||||
if 'test-hidden' not in dev[0].request("SCAN_RESULTS"):
|
if 'test-hidden' not in dev[0].request("SCAN_RESULTS"):
|
||||||
|
|
Loading…
Reference in a new issue