]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: External radio work and DISCONNECT clearing connection attempt
authorJouni Malinen <jouni@codeaurora.org>
Fri, 15 Mar 2019 11:03:10 +0000 (13:03 +0200)
committerJouni Malinen <j@w1.fi>
Fri, 15 Mar 2019 11:03:31 +0000 (13:03 +0200)
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
tests/hwsim/test_radio_work.py

index 1369cf27d71fd84f9711fde90835f2ad352d74d2..70fbc2dab36c6cb62b5b516b21b68f3b94d90a1c 100644 (file)
@@ -101,3 +101,33 @@ def test_radio_work_cancel(dev, apdev):
     wpas.interface_remove("wlan5")
     # add to allow log file renaming
     wpas.interface_add("wlan5")
+
+def test_ext_radio_work_disconnect_connect(dev, apdev):
+    """External radio work and DISCONNECT clearing connection attempt"""
+    hapd = hostapd.add_ap(apdev[0], { "ssid": "open" })
+    dev[0].scan_for_bss(hapd.own_addr(), freq=2412)
+
+    # Start a radio work to block connection attempt
+    id1 = dev[0].request("RADIO_WORK add test-work-a")
+    if "FAIL" in id1:
+        raise Exception("Failed to add radio work")
+    ev = dev[0].wait_event(["EXT-RADIO-WORK-START"])
+    if ev is None:
+        raise Exception("Timeout while waiting radio work to start")
+
+    dev[0].connect("open", key_mgmt="NONE", scan_freq="2412",
+                   wait_connect=False)
+    items = dev[0].request("RADIO_WORK show")
+    if "connect" not in items:
+        raise Exception("Connection radio work not scheduled")
+    dev[0].request("DISCONNECT")
+    items = dev[0].request("RADIO_WORK show")
+    if "connect" in items:
+        raise Exception("Connection radio work not removed on DISCONNECT")
+
+    # Clear radio work to allow any pending work to be started
+    dev[0].request("RADIO_WORK done " + id1)
+
+    ev = dev[0].wait_event(["CTRL-EVENT-CONNECTED"], timeout=0.5)
+    if ev is not None:
+        raise Exception("Unexpected connection seen")