From f98b0e58061b7d8c84b8a31d0672b45025ffa63a Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Fri, 4 Dec 2015 21:03:43 +0200 Subject: [PATCH] tests: Make tests using multi_check() more robust It was possible for a cached scan entry in cfg80211 from an earlier test case to show up while verifying that the disabled AP does not show up in scan results. This could result in invalid test failures, e.g., when running test cases "ap_require_ht ap_multi_bss_config" multiple times (depends a bit on timing). Make this less likely to occur by explicitly clearing the scan cache and by stopping wlan1 from trying to associate before stopping ap_required_ht* test cases. Signed-off-by: Jouni Malinen --- tests/hwsim/test_ap_dynamic.py | 5 +++++ tests/hwsim/test_ap_ht.py | 2 ++ 2 files changed, 7 insertions(+) diff --git a/tests/hwsim/test_ap_dynamic.py b/tests/hwsim/test_ap_dynamic.py index 19eb9c43d..ca418dc05 100644 --- a/tests/hwsim/test_ap_dynamic.py +++ b/tests/hwsim/test_ap_dynamic.py @@ -90,6 +90,7 @@ def test_ap_bss_add_remove(dev, apdev): def _test_ap_bss_add_remove(dev, apdev): for i in range(3): + dev[i].flush_scan_cache() dev[i].request("SCAN_INTERVAL 1") ifname1 = apdev[0]['ifname'] ifname2 = apdev[0]['ifname'] + '-2' @@ -152,6 +153,8 @@ def _test_ap_bss_add_remove(dev, apdev): def test_ap_bss_add_remove_during_ht_scan(dev, apdev): """Dynamic BSS add during HT40 co-ex scan""" + for i in range(3): + dev[i].flush_scan_cache() ifname1 = apdev[0]['ifname'] ifname2 = apdev[0]['ifname'] + '-2' hostapd.add_bss('phy3', ifname1, 'bss-ht40-1.conf') @@ -173,6 +176,8 @@ def test_ap_bss_add_remove_during_ht_scan(dev, apdev): def test_ap_multi_bss_config(dev, apdev): """hostapd start with a multi-BSS configuration file""" + for i in range(3): + dev[i].flush_scan_cache() ifname1 = apdev[0]['ifname'] ifname2 = apdev[0]['ifname'] + '-2' ifname3 = apdev[0]['ifname'] + '-3' diff --git a/tests/hwsim/test_ap_ht.py b/tests/hwsim/test_ap_ht.py index 8a8aa9f98..001e7224a 100644 --- a/tests/hwsim/test_ap_ht.py +++ b/tests/hwsim/test_ap_ht.py @@ -768,6 +768,7 @@ def test_ap_require_ht(dev, apdev): disable_ht="1", wait_connect=False) dev[0].connect("require-ht", key_mgmt="NONE", scan_freq="2412") ev = dev[1].wait_event(["CTRL-EVENT-ASSOC-REJECT"]) + dev[1].request("DISCONNECT") if ev is None: raise Exception("Association rejection timed out") if "status_code=27" not in ev: @@ -789,6 +790,7 @@ def test_ap_require_ht_limited_rates(dev, apdev): disable_ht="1", wait_connect=False) dev[0].connect("require-ht", key_mgmt="NONE", scan_freq="2412") ev = dev[1].wait_event(["CTRL-EVENT-ASSOC-REJECT"]) + dev[1].request("DISCONNECT") if ev is None: raise Exception("Association rejection timed out") if "status_code=27" not in ev: