From 0bde923c403f80e218886b09aea9d82bc83bf7b0 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sat, 26 Apr 2014 17:25:26 +0300 Subject: [PATCH] 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 --- tests/hwsim/test_ap_wps.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/hwsim/test_ap_wps.py b/tests/hwsim/test_ap_wps.py index 2da499139..d549949cd 100644 --- a/tests/hwsim/test_ap_wps.py +++ b/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"""