aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2014-01-04 11:20:46 (GMT)
committerJouni Malinen <j@w1.fi>2014-01-07 08:45:10 (GMT)
commit26b846672c8add2922c8e52bd799c0ebaadc9e45 (patch)
treea9f47718c0b01f46e2e70e3b591fee09d6e5b035
parent1f965e622a5351ee50d00bbc7285ec84bb2af1c7 (diff)
downloadhostap-26b846672c8add2922c8e52bd799c0ebaadc9e45.zip
hostap-26b846672c8add2922c8e52bd799c0ebaadc9e45.tar.gz
hostap-26b846672c8add2922c8e52bd799c0ebaadc9e45.tar.bz2
tests: Radio work items
Signed-hostap: Jouni Malinen <j@w1.fi>
-rw-r--r--tests/hwsim/test_radio_work.py57
1 files changed, 57 insertions, 0 deletions
diff --git a/tests/hwsim/test_radio_work.py b/tests/hwsim/test_radio_work.py
new file mode 100644
index 0000000..7f4f5c7
--- /dev/null
+++ b/tests/hwsim/test_radio_work.py
@@ -0,0 +1,57 @@
+#!/usr/bin/python
+#
+# Radio work tests
+# Copyright (c) 2014, Jouni Malinen <j@w1.fi>
+#
+# This software may be distributed under the terms of the BSD license.
+# See README for more details.
+
+import time
+import logging
+logger = logging.getLogger()
+import subprocess
+
+import hostapd
+
+def test_ext_radio_work(dev, apdev):
+ """External radio work item"""
+ id = dev[0].request("RADIO_WORK add test-work-a")
+ if "FAIL" in id:
+ raise Exception("Failed to add radio work")
+ id2 = dev[0].request("RADIO_WORK add test-work-b freq=2417")
+ if "FAIL" in id2:
+ raise Exception("Failed to add radio work")
+ id3 = dev[0].request("RADIO_WORK add test-work-c")
+ if "FAIL" in id3:
+ 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")
+ if "EXT-RADIO-WORK-START " + id not in ev:
+ raise Exception("Unexpected radio work start id")
+
+ items = dev[0].request("RADIO_WORK show")
+ if "ext:test-work-a@wlan0:0:1:" not in items:
+ logger.info("Pending radio work items:\n" + items)
+ raise Exception("Radio work item(a) missing from the list")
+ if "ext:test-work-b@wlan0:2417:0:" not in items:
+ logger.info("Pending radio work items:\n" + items)
+ raise Exception("Radio work item(b) missing from the list")
+ if "ext:test-work-c@wlan0:0:0:" not in items:
+ logger.info("Pending radio work items:\n" + items)
+ raise Exception("Radio work item(c) missing from the list")
+
+ dev[0].request("RADIO_WORK done " + id2)
+ dev[0].request("RADIO_WORK done " + id)
+
+ ev = dev[0].wait_event(["EXT-RADIO-WORK-START"])
+ if ev is None:
+ raise Exception("Timeout while waiting radio work to start")
+ if "EXT-RADIO-WORK-START " + id3 not in ev:
+ raise Exception("Unexpected radio work start id")
+ dev[0].request("RADIO_WORK done " + id3)
+ items = dev[0].request("RADIO_WORK show")
+ if "ext:" in items:
+ logger.info("Pending radio work items:\n" + items)
+ raise Exception("Unexpected remaining radio work item")