]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: SCAN requests while in non-scan radio work
authorJouni Malinen <jouni@qca.qualcomm.com>
Fri, 12 Dec 2014 10:07:09 +0000 (12:07 +0200)
committerJouni Malinen <j@w1.fi>
Fri, 19 Dec 2014 13:23:07 +0000 (15:23 +0200)
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
tests/hwsim/test_scan.py

index 7bf9560bfd99bf75fad71007027ec57b2695b1b1..0e5a9e52ee0909f966b6f224d02e51aa4cf6c982 100644 (file)
@@ -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")