]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Make ap_csa_disable more robust
authorJouni Malinen <j@w1.fi>
Sat, 4 May 2019 21:40:57 +0000 (00:40 +0300)
committerJouni Malinen <j@w1.fi>
Sat, 4 May 2019 21:57:37 +0000 (00:57 +0300)
This test case was failing frequently due to the station not being able
to connect back to the AP if the interrupted channel switch ended up
moving the AP to the new channel anyway on restart. Scan both possible
channels to allow the AP to be found in either case.

Signed-off-by: Jouni Malinen <j@w1.fi>
tests/hwsim/test_ap_csa.py

index 688055ef8c905f809a7b300155800912515e439c..2bf9c9a8a7ccf451c5465e1ea8e3aae92b28819a 100644 (file)
@@ -13,12 +13,12 @@ import hwsim_utils
 import hostapd
 from utils import HwsimSkip
 
-def connect(dev, apdev, **kwargs):
+def connect(dev, apdev, scan_freq="2412", **kwargs):
     params = {"ssid": "ap-csa",
               "channel": "1"}
     params.update(kwargs)
     ap = hostapd.add_ap(apdev[0], params)
-    dev.connect("ap-csa", key_mgmt="NONE", scan_freq="2412")
+    dev.connect("ap-csa", key_mgmt="NONE", scan_freq=scan_freq)
     return ap
 
 def switch_channel(ap, count, freq):
@@ -187,7 +187,7 @@ def test_ap_csa_invalid(dev, apdev):
 def test_ap_csa_disable(dev, apdev):
     """AP Channel Switch and DISABLE command before completion"""
     csa_supported(dev[0])
-    ap = connect(dev[0], apdev)
+    ap = connect(dev[0], apdev, scan_freq="2412 2462")
     if "OK" not in ap.request("CHAN_SWITCH 10 2462"):
         raise Exception("CHAN_SWITCH failed")
     ap.disable()