[PATCH] hwsim tests: convert radio work test to new notation

Johannes Berg johannes
Thu Jan 23 12:25:24 PST 2014


From: Johannes Berg <johannes.berg at intel.com>

Convert the radio work test to the new notation that
the previous "python magic" patch made possible.

This is mostly intended as an example. We can convert
more if you want, but there's a tradeoff between the
'nice' python syntax and the 'raw' control interface
strings. It was just an idea I had.

Signed-hostap: Johannes Berg <johannes.berg at intel.com>
---
 tests/hwsim/test_radio_work.py | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/tests/hwsim/test_radio_work.py b/tests/hwsim/test_radio_work.py
index 7f4f5c7..9baccee 100644
--- a/tests/hwsim/test_radio_work.py
+++ b/tests/hwsim/test_radio_work.py
@@ -15,13 +15,13 @@ import hostapd
 
 def test_ext_radio_work(dev, apdev):
     """External radio work item"""
-    id = dev[0].request("RADIO_WORK add test-work-a")
+    id = dev[0].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")
+    id2 = dev[0].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")
+    id3 = dev[0].radio_work.add("test-work-c")
     if "FAIL" in id3:
         raise Exception("Failed to add radio work")
 
@@ -31,7 +31,7 @@ def test_ext_radio_work(dev, apdev):
     if "EXT-RADIO-WORK-START " + id not in ev:
         raise Exception("Unexpected radio work start id")
 
-    items = dev[0].request("RADIO_WORK show")
+    items = dev[0].radio_work.show()
     if "ext:test-work-a at wlan0:0:1:" not in items:
         logger.info("Pending radio work items:\n" + items)
         raise Exception("Radio work item(a) missing from the list")
@@ -42,16 +42,16 @@ def test_ext_radio_work(dev, apdev):
         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)
+    dev[0].radio_work.done(id2)
+    dev[0].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")
+    dev[0].radio_work.done(id3)
+    items = dev[0].radio_work.show()
     if "ext:" in items:
         logger.info("Pending radio work items:\n" + items)
         raise Exception("Unexpected remaining radio work item")
-- 
1.8.5.2




More information about the Hostap mailing list