aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2015-09-05 18:58:18 (GMT)
committerJouni Malinen <j@w1.fi>2015-09-05 18:58:18 (GMT)
commit926404a6b22dcd6e49067b85589185bcb2271565 (patch)
tree1047149089afcbb85130d35f1b1bed9c1490dc8b
parent1067f495202b3c3aafc85f808de91faeb7a55478 (diff)
downloadhostap-926404a6b22dcd6e49067b85589185bcb2271565.zip
hostap-926404a6b22dcd6e49067b85589185bcb2271565.tar.gz
hostap-926404a6b22dcd6e49067b85589185bcb2271565.tar.bz2
tests: WPS config method update for WPS and P2P
Signed-off-by: Jouni Malinen <j@w1.fi>
-rw-r--r--tests/hwsim/test_ap_wps.py13
-rw-r--r--tests/hwsim/test_p2p_discovery.py31
2 files changed, 44 insertions, 0 deletions
diff --git a/tests/hwsim/test_ap_wps.py b/tests/hwsim/test_ap_wps.py
index 7dfc622..25ab2a3 100644
--- a/tests/hwsim/test_ap_wps.py
+++ b/tests/hwsim/test_ap_wps.py
@@ -5309,3 +5309,16 @@ def test_ap_wps_adv_oom(dev, apdev):
with alloc_fail(hapd, 1, "ssdp_listener_start"):
if "FAIL" not in hapd.request("ENABLE"):
raise Exception("ENABLE succeeded during OOM")
+
+def test_wps_config_methods(dev):
+ """WPS config method update"""
+ wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
+ wpas.interface_add("wlan5")
+ if "OK" not in wpas.request("SET config_methods display label"):
+ raise Exception("Failed to set config_methods")
+ if wpas.request("GET config_methods").strip() != "display label":
+ raise Exception("config_methods were not updated")
+ if "OK" not in wpas.request("SET config_methods "):
+ raise Exception("Failed to clear config_methods")
+ if wpas.request("GET config_methods").strip() != "":
+ raise Exception("config_methods were not cleared")
diff --git a/tests/hwsim/test_p2p_discovery.py b/tests/hwsim/test_p2p_discovery.py
index 55d0f4d..fbd3f83 100644
--- a/tests/hwsim/test_p2p_discovery.py
+++ b/tests/hwsim/test_p2p_discovery.py
@@ -444,3 +444,34 @@ def test_p2p_listen_and_scan(dev):
ev = dev[0].wait_event(["CTRL-EVENT-SCAN-RESULTS"], 15)
if ev is None:
raise Exception("Scan timed out")
+
+def test_p2p_config_methods(dev):
+ """P2P and WPS config method update"""
+ addr0 = dev[0].p2p_dev_addr()
+ wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
+ wpas.interface_add("wlan5")
+ addr1 = wpas.p2p_dev_addr()
+
+ if "OK" not in wpas.request("SET config_methods keypad virtual_push_button"):
+ raise Exception("Failed to set config_methods")
+
+ wpas.p2p_listen()
+ if not dev[0].discover_peer(addr1):
+ raise Exception("Device discovery timed out")
+ dev[0].p2p_stop_find()
+ peer = dev[0].get_peer(addr1)
+ if peer['config_methods'] != '0x180':
+ raise Exception("Unexpected peer config methods(1): " + peer['config_methods'])
+ dev[0].global_request("P2P_FLUSH")
+
+ if "OK" not in wpas.request("SET config_methods virtual_display"):
+ raise Exception("Failed to set config_methods")
+
+ if not dev[0].discover_peer(addr1):
+ raise Exception("Device discovery timed out")
+ dev[0].p2p_stop_find()
+ peer = dev[0].get_peer(addr1)
+ if peer['config_methods'] != '0x8':
+ raise Exception("Unexpected peer config methods(2): " + peer['config_methods'])
+
+ wpas.p2p_stop_find()