]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: wpa_supplicant country code SET/GET
authorJouni Malinen <j@w1.fi>
Sun, 13 Apr 2014 13:33:18 +0000 (16:33 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 13 Apr 2014 13:33:18 +0000 (16:33 +0300)
Signed-off-by: Jouni Malinen <j@w1.fi>
tests/hwsim/test_wpas_ctrl.py

index ebd37025430661a24d081b53840675b5a810393d..c024e6862ecf02d48f7b924fecbb3347da44e452 100644 (file)
@@ -4,6 +4,7 @@
 # This software may be distributed under the terms of the BSD license.
 # See README for more details.
 
+import subprocess
 import time
 
 import hostapd
@@ -737,3 +738,26 @@ def test_wpas_ctrl_enable_disable_network(dev, apdev):
     ev = dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=10)
     if ev is None:
         raise Exception("Disconnection with the AP timed out")
+
+def test_wpas_ctrl_country(dev, apdev):
+    """wpa_supplicant SET/GET country code"""
+    try:
+        if "OK" not in dev[0].request("SET country FI"):
+            raise Exception("Failed to set country code")
+        if dev[0].request("GET country") != "FI":
+            raise Exception("Country code set failed")
+        ev = dev[0].wait_event(["CTRL-EVENT-REGDOM-CHANGE"])
+        if ev is None:
+            raise Exception("regdom change event not seen")
+        if "init=USER type=COUNTRY alpha2=FI" not in ev:
+            raise Exception("Unexpected event contents: " + ev)
+        dev[0].request("SET country 00")
+        if dev[0].request("GET country") != "00":
+            raise Exception("Country code set failed")
+        ev = dev[0].wait_event(["CTRL-EVENT-REGDOM-CHANGE"])
+        if ev is None:
+            raise Exception("regdom change event not seen")
+        if "init=DRIVER type=WORLD" not in ev:
+            raise Exception("Unexpected event contents: " + ev)
+    finally:
+        subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])