From 64c20a831f23ae601aecbd6cb2e3537a432699c6 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Mon, 22 Apr 2019 21:03:07 +0300 Subject: [PATCH] tests: Channel switch started/completed events Signed-off-by: Jouni Malinen --- tests/hwsim/test_ap_csa.py | 19 +++++++++++++++++++ tests/hwsim/test_ap_vht.py | 10 ++++++++++ 2 files changed, 29 insertions(+) diff --git a/tests/hwsim/test_ap_csa.py b/tests/hwsim/test_ap_csa.py index 662fc2283..688055ef8 100644 --- a/tests/hwsim/test_ap_csa.py +++ b/tests/hwsim/test_ap_csa.py @@ -23,6 +23,19 @@ def connect(dev, apdev, **kwargs): def switch_channel(ap, count, freq): ap.request("CHAN_SWITCH " + str(count) + " " + str(freq)) + + ev = ap.wait_event(["CTRL-EVENT-STARTED-CHANNEL-SWITCH"], timeout=10) + if ev is None: + raise Exception("Channel switch start event not seen") + if "freq=" + str(freq) not in ev: + raise Exception("Unexpected channel in CS started event") + + ev = ap.wait_event(["CTRL-EVENT-CHANNEL-SWITCH"], timeout=10) + if ev is None: + raise Exception("Channel switch completed event not seen") + if "freq=" + str(freq) not in ev: + raise Exception("Unexpected channel in CS completed event") + ev = ap.wait_event(["AP-CSA-FINISHED"], timeout=10) if ev is None: raise Exception("CSA finished event timed out") @@ -30,6 +43,12 @@ def switch_channel(ap, count, freq): raise Exception("Unexpected channel in CSA finished event") def wait_channel_switch(dev, freq): + ev = dev.wait_event(["CTRL-EVENT-STARTED-CHANNEL-SWITCH"], timeout=5) + if ev is None: + raise Exception("Channel switch start not reported") + if "freq=%d" % freq not in ev: + raise Exception("Unexpected frequency in channel switch started: " + ev) + ev = dev.wait_event(["CTRL-EVENT-CHANNEL-SWITCH"], timeout=5) if ev is None: raise Exception("Channel switch not reported") diff --git a/tests/hwsim/test_ap_vht.py b/tests/hwsim/test_ap_vht.py index cd98539e9..3fb7672ea 100644 --- a/tests/hwsim/test_ap_vht.py +++ b/tests/hwsim/test_ap_vht.py @@ -742,6 +742,16 @@ def test_ap_vht80_csa(dev, apdev): hwsim_utils.test_connectivity(dev[0], hapd) hapd.request("CHAN_SWITCH 5 5180 ht vht blocktx center_freq1=5210 sec_channel_offset=1 bandwidth=80") + ev = hapd.wait_event(["CTRL-EVENT-STARTED-CHANNEL-SWITCH"], timeout=10) + if ev is None: + raise Exception("Channel switch start event not seen") + if "freq=5180" not in ev: + raise Exception("Unexpected channel in CS started") + ev = hapd.wait_event(["CTRL-EVENT-CHANNEL-SWITCH"], timeout=10) + if ev is None: + raise Exception("Channel switch completion event not seen") + if "freq=5180" not in ev: + raise Exception("Unexpected channel in CS completed") ev = hapd.wait_event(["AP-CSA-FINISHED"], timeout=10) if ev is None: raise Exception("CSA finished event timed out")