Browse Source

tests: Make ap_wps_init_2ap_pin/pbc more robust

It is possible for the scan to miss a Probe Response frame especially
under heavy load, so try again to avoid reporting invalid failures.

Signed-off-by: Jouni Malinen <j@w1.fi>
Jouni Malinen 11 years ago
parent
commit
0bde923c40
1 changed files with 12 additions and 2 deletions
  1. 12 2
      tests/hwsim/test_ap_wps.py

+ 12 - 2
tests/hwsim/test_ap_wps.py

@@ -106,12 +106,17 @@ def test_ap_wps_init_2ap_pbc(dev, apdev):
         raise Exception("Association with the AP timed out")
 
     dev[1].scan(freq="2412")
+    for i in range(0, 10):
+        if 'flags' in dev[1].get_bss(apdev[0]['bssid']) and 'flags' in dev[1].get_bss(apdev[1]['bssid']):
+            break
+        logger.info("Scan again since scan did not include both BSSes")
+        dev[1].scan(freq="2412")
     bss = dev[1].get_bss(apdev[0]['bssid'])
     if "[WPS-PBC]" in bss['flags']:
         raise Exception("WPS-PBC flag not cleared from AP1")
     bss = dev[1].get_bss(apdev[1]['bssid'])
     if "[WPS-PBC]" in bss['flags']:
-        raise Exception("WPS-PBC flag bit ckeared from AP2")
+        raise Exception("WPS-PBC flag not cleared from AP2")
 
 def test_ap_wps_init_2ap_pin(dev, apdev):
     """Initial two-radio AP configuration with first WPS PIN Enrollee"""
@@ -137,12 +142,17 @@ def test_ap_wps_init_2ap_pin(dev, apdev):
         raise Exception("Association with the AP timed out")
 
     dev[1].scan(freq="2412")
+    for i in range(0, 10):
+        if 'flags' in dev[1].get_bss(apdev[0]['bssid']) and 'flags' in dev[1].get_bss(apdev[1]['bssid']):
+            break
+        logger.info("Scan again since scan did not include both BSSes")
+        dev[1].scan(freq="2412")
     bss = dev[1].get_bss(apdev[0]['bssid'])
     if "[WPS-AUTH]" in bss['flags']:
         raise Exception("WPS-AUTH flag not cleared from AP1")
     bss = dev[1].get_bss(apdev[1]['bssid'])
     if "[WPS-AUTH]" in bss['flags']:
-        raise Exception("WPS-AUTH flag bit ckeared from AP2")
+        raise Exception("WPS-AUTH flag not cleared from AP2")
 
 def test_ap_wps_init_through_wps_config(dev, apdev):
     """Initial AP configuration using wps_config command"""