aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJouni Malinen <jouni@qca.qualcomm.com>2015-12-30 17:52:42 (GMT)
committerJouni Malinen <j@w1.fi>2015-12-30 17:52:42 (GMT)
commit96425ea5027fc9d25ddafe1794bbb48185b6484d (patch)
tree8f649204319d755d305964bc05ad017ed703d26f /tests
parentdd4feaad2abf570b31c61cc1ac25529e6656fbb2 (diff)
downloadhostap-96425ea5027fc9d25ddafe1794bbb48185b6484d.zip
hostap-96425ea5027fc9d25ddafe1794bbb48185b6484d.tar.gz
hostap-96425ea5027fc9d25ddafe1794bbb48185b6484d.tar.bz2
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>
Diffstat (limited to 'tests')
-rw-r--r--tests/hwsim/test_scan.py36
1 files changed, 26 insertions, 10 deletions
diff --git a/tests/hwsim/test_scan.py b/tests/hwsim/test_scan.py
index 7229456..2dae6a9 100644
--- a/tests/hwsim/test_scan.py
+++ b/tests/hwsim/test_scan.py
@@ -169,7 +169,11 @@ def test_scan_bss_expiration_age(dev, apdev):
raise Exception("BSS_EXPIRE_AGE failed")
hapd = hostapd.add_ap(apdev[0]['ifname'], { "ssid": "test-scan" })
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"):
raise Exception("BSS not found in initial scan")
hapd.request("DISABLE")
@@ -633,13 +637,21 @@ def test_scan_setband(dev, apdev):
if "OK" not in dev[2].request("SET setband 2G"):
raise Exception("Failed to set setband")
- for i in range(3):
- dev[i].request("SCAN only_new=1")
-
- for i in range(3):
- ev = dev[i].wait_event(["CTRL-EVENT-SCAN-RESULTS"], 15)
- if ev is None:
- raise Exception("Scan timed out")
+ # Allow a retry to avoid reporting errors during heavy load
+ for j in range(5):
+ for i in range(3):
+ dev[i].request("SCAN only_new=1")
+
+ for i in range(3):
+ ev = dev[i].wait_event(["CTRL-EVENT-SCAN-RESULTS"], 15)
+ if ev is None:
+ 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")
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)
if bss is not None and bss['ssid'] == 'test-hidden':
raise Exception("BSS entry for hidden AP present unexpectedly")
- check_scan(dev[0], "freq=2412 ssid 414243 ssid 746573742d68696464656e ssid 616263313233 use_id=1")
- bss = dev[0].get_bss(bssid)
+ # Allow couple more retries to avoid reporting errors during heavy load
+ 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:
raise Exception("BSS entry for hidden AP not found")
if 'test-hidden' not in dev[0].request("SCAN_RESULTS"):