[PATCH 19/19] tests: test P2PS wildcard SD probe

Ilan Peer ilan.peer
Wed Jun 10 01:43:49 PDT 2015


From: Max Stepanov <Max.Stepanov at intel.com>

Verify that advertiser returns 'org.wi-fi.wfds' wildcard in a probe
response if at least one P2PS advertisement is present.

Signed-off-by: Max Stepanov <Max.Stepanov at intel.com>
Reviewed-by: Ilan Peer <ilan.peer at intel.com>
---
 tests/hwsim/test_p2ps.py | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/tests/hwsim/test_p2ps.py b/tests/hwsim/test_p2ps.py
index 43da240..8d6c64a 100644
--- a/tests/hwsim/test_p2ps.py
+++ b/tests/hwsim/test_p2ps.py
@@ -983,3 +983,37 @@ def test_p2ps_go_probe(dev):
                                               single_peer_expected=False)
     dev[0].global_request("P2P_SERVICE_DEL asp " + str(adv_id))
     remove_group(dev[0], dev[1])
+
+def test_p2ps_wildcard_p2ps(dev):
+    """P2PS wildcard SD probe request/response"""
+    p2ps_wildcard = "org.wi-fi.wfds"
+
+    adv_id = p2ps_advertise(r_dev=dev[0], r_role='1', svc_name='org.foo.service',
+                            srv_info='I can receive files upto size 2 GB')
+
+    if "OK" not in dev[1].global_request("P2P_FIND 10 type=social seek=" + p2ps_wildcard):
+        raise Exception("Failed on P2P_FIND command")
+
+    ev1 = dev[1].wait_global_event(["P2P-DEVICE-FOUND"], timeout=10)
+
+    if ev1 is None:
+        raise Exception("P2P-DEVICE-FOUND timeout on seeker side")
+    if dev[0].p2p_dev_addr() not in ev1:
+        raise Exception("Unexpected peer")
+    if p2ps_wildcard not in ev1:
+        raise Exception("P2PS Wildcard name not found in P2P-DEVICE-FOUND event")
+
+    if "OK" not in dev[1].global_request("P2P_STOP_FIND"):
+        raise Exception("P2P_STOP_FIND Failed")
+
+    ev0 = dev[0].global_request("P2P_SERVICE_DEL asp " + str(adv_id))
+    if ev0 is None:
+        raise Exception("Unable to remove the advertisement instance")
+
+    if "OK" not in dev[1].global_request("P2P_FIND 10 type=social seek=" + p2ps_wildcard):
+        raise Exception("Failed on P2P_FIND command")
+
+    ev1 = dev[1].wait_global_event(["P2P-DEVICE-FOUND"], timeout=5)
+
+    if ev1 is not None:
+        raise Exception("Unexpected P2P-DEVICE-FOUND event on seeker side")
-- 
1.9.1




More information about the Hostap mailing list