From 4abaf4df8437efd115bef3028f0e2415493be639 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sun, 5 May 2019 00:40:57 +0300 Subject: [PATCH] tests: Make ap_csa_disable more robust 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 --- tests/hwsim/test_ap_csa.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/hwsim/test_ap_csa.py b/tests/hwsim/test_ap_csa.py index 688055ef8..2bf9c9a8a 100644 --- a/tests/hwsim/test_ap_csa.py +++ b/tests/hwsim/test_ap_csa.py @@ -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()