From 23a6d4d8df0eda044b1487311604c2aa8a1fe1e4 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Thu, 15 May 2014 21:10:52 +0300 Subject: [PATCH] tests: Verify scan behavior when interface gets disabled Signed-off-by: Jouni Malinen --- tests/hwsim/test_scan.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/hwsim/test_scan.py b/tests/hwsim/test_scan.py index 928352c4d..9ad51599b 100644 --- a/tests/hwsim/test_scan.py +++ b/tests/hwsim/test_scan.py @@ -251,3 +251,24 @@ def test_scan_bss_operations(dev, apdev): raise Exception("Unexpected RANGE=2-10 result") if len(dev[0].request("BSS RANGE=0-" + str(int(id2) + 10) + " MASK=0x1").splitlines()) != 2: raise Exception("Unexpected RANGE=0-10 result") + +def test_scan_and_interface_disabled(dev, apdev): + """Scan operation when interface gets disabled""" + try: + dev[0].request("SCAN") + ev = dev[0].wait_event(["CTRL-EVENT-SCAN-STARTED"]) + if ev is None: + raise Exception("Scan did not start") + dev[0].request("DRIVER_EVENT INTERFACE_DISABLED") + ev = dev[0].wait_event(["CTRL-EVENT-SCAN-RESULTS"], timeout=7) + if ev is not None: + raise Exception("Scan completed unexpectedly") + + # verify that scan is rejected + if "FAIL" not in dev[0].request("SCAN"): + raise Exception("New scan request was accepted unexpectedly") + + dev[0].request("DRIVER_EVENT INTERFACE_ENABLED") + dev[0].scan(freq="2412") + finally: + dev[0].request("DRIVER_EVENT INTERFACE_ENABLED")