[PATCH 10/11] tests: Add a couple of P2P2 pairing tests with P2P device

Andrei Otcheretianski andrei.otcheretianski at intel.com
Tue Nov 26 01:10:19 PST 2024


Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski at intel.com>
---
 tests/hwsim/test_p2p2.py | 28 +++++++++++++++++++++++++---
 1 file changed, 25 insertions(+), 3 deletions(-)

diff --git a/tests/hwsim/test_p2p2.py b/tests/hwsim/test_p2p2.py
index aac6202261..2a73f9cff7 100644
--- a/tests/hwsim/test_p2p2.py
+++ b/tests/hwsim/test_p2p2.py
@@ -6,6 +6,9 @@
 # See README for more details.
 
 import logging
+
+from hwsim import HWSimRadio
+
 logger = logging.getLogger()
 import os
 import hwsim_utils
@@ -127,7 +130,7 @@ def test_p2p_usd_match(dev, apdev):
     dev[0].global_request("NAN_CANCEL_SUBSCRIBE subscribe_id=" + id0)
     dev[1].global_request("NAN_CANCEL_PUBLISH publish_id=" + id1)
 
-def test_p2p_pairing_password(dev, apdev):
+def run_p2p_pairing_password(dev):
     """P2P Pairing with Password"""
     check_p2p2_capab(dev[0])
     check_p2p2_capab(dev[1])
@@ -180,18 +183,37 @@ def test_p2p_pairing_password(dev, apdev):
     ev = dev[0].wait_global_event(["P2P-GROUP-STARTED"], timeout=10)
     if ev is None:
         raise Exception("Group formation timed out")
-    #dev[0].group_form_result(ev)
+    dev[0].group_form_result(ev, no_pwd=True)
     dev[0].dump_monitor()
 
     ev = dev[1].wait_global_event(["P2P-GROUP-STARTED"], timeout=10)
     if ev is None:
         raise Exception("Group formation timed out(2)")
-    #dev[1].group_form_result(ev)
+    dev[1].group_form_result(ev)
 
     dev[1].remove_group()
     dev[0].wait_go_ending_session()
     dev[0].dump_monitor()
 
+def test_p2p_pairing_password(dev, apdev):
+    """P2P Pairing with Password"""
+    run_p2p_pairing_password(dev)
+
+def test_p2p_pairing_password_dev(dev, apdev):
+    """P2P Pairing with Password with dedicated P2P device"""
+    with HWSimRadio(use_p2p_device=True) as (radio, iface):
+        wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
+        wpas.interface_add(iface)
+        run_p2p_pairing_password([dev[0], wpas])
+
+def test_p2p_pairing_password_dev2(dev, apdev):
+    """P2P Pairing with Password with dedicated P2P device (reversed) and no group interface"""
+    with HWSimRadio(use_p2p_device=True) as (radio, iface):
+        wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
+        wpas.interface_add(iface)
+        wpas.global_request("SET p2p_no_group_iface 1")
+        run_p2p_pairing_password([wpas, dev[0]])
+
 def test_p2p_pairing_opportunistic(dev, apdev):
     """P2P Pairing with Opportunistic"""
     check_p2p2_capab(dev[0])
-- 
2.43.0




More information about the Hostap mailing list