From 83e80d32f1013fef159a4fbc5b8bc8cebb7a0558 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Fri, 12 Dec 2014 12:07:09 +0200 Subject: [PATCH] tests: SCAN requests while in non-scan radio work Signed-off-by: Jouni Malinen --- tests/hwsim/test_scan.py | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/tests/hwsim/test_scan.py b/tests/hwsim/test_scan.py index 7bf9560bf..0e5a9e52e 100644 --- a/tests/hwsim/test_scan.py +++ b/tests/hwsim/test_scan.py @@ -453,3 +453,41 @@ def test_scan_and_bss_entry_removed(dev, apdev): ev = wpas.wait_event(["CTRL-EVENT-CONNECTED"], timeout=15) if ev is None: raise Exception("No connection (connect)") + +def test_scan_reqs_with_non_scan_radio_work(dev, apdev): + """SCAN commands while non-scan radio_work is in progress""" + id = dev[0].request("RADIO_WORK add test-work-a") + ev = dev[0].wait_event(["EXT-RADIO-WORK-START"]) + if ev is None: + raise Exception("Timeout while waiting radio work to start") + + if "OK" not in dev[0].request("SCAN"): + raise Exception("SCAN failed") + if "FAIL-BUSY" not in dev[0].request("SCAN"): + raise Exception("SCAN accepted while one is already pending") + if "FAIL-BUSY" not in dev[0].request("SCAN"): + raise Exception("SCAN accepted while one is already pending") + + res = dev[0].request("RADIO_WORK show").splitlines() + count = 0 + for l in res: + if "scan" in l: + count += 1 + if count != 1: + logger.info(res) + raise Exception("Unexpected number of scan radio work items") + + dev[0].dump_monitor() + dev[0].request("RADIO_WORK done " + id) + ev = dev[0].wait_event(["CTRL-EVENT-SCAN-STARTED"], timeout=5) + if ev is None: + raise Exception("Scan did not start") + if "FAIL-BUSY" not in dev[0].request("SCAN"): + raise Exception("SCAN accepted while one is already in progress") + + ev = dev[0].wait_event(["CTRL-EVENT-SCAN-RESULTS"], timeout=10) + if ev is None: + print "Scan did not complete" + ev = dev[0].wait_event(["CTRL-EVENT-SCAN-STARTED"], timeout=0.2) + if ev is not None: + raise Exception("Unexpected scan started")