From 8aacbc1fb7368724bba7d7d4e675c08220723fbf Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Mon, 13 Mar 2017 17:08:22 +0200 Subject: [PATCH] tests: P2P device discovery and p2p_find restart Signed-off-by: Jouni Malinen --- tests/hwsim/test_p2p_discovery.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/hwsim/test_p2p_discovery.py b/tests/hwsim/test_p2p_discovery.py index a510a4ab7..b94dc69a8 100644 --- a/tests/hwsim/test_p2p_discovery.py +++ b/tests/hwsim/test_p2p_discovery.py @@ -17,6 +17,7 @@ from hwsim import HWSimRadio from tshark import run_tshark from test_gas import start_ap from test_cfg80211 import nl80211_remain_on_channel +from test_p2p_channel import set_country @remote_compatible def test_discovery(dev): @@ -445,6 +446,35 @@ def test_discovery_stop(dev): if ev is not None: raise Exception("Peer found unexpectedly: " + ev) +def test_discovery_restart(dev): + """P2P device discovery and p2p_find restart""" + autogo(dev[1], freq=2457) + dev[0].p2p_find(social=True) + dev[0].p2p_stop_find() + dev[0].p2p_find(social=False) + ev = dev[0].wait_global_event(["P2P-DEVICE-FOUND"], timeout=7) + if ev is None: + dev[0].p2p_find(social=False) + ev = dev[0].wait_global_event(["P2P-DEVICE-FOUND"], timeout=7) + if ev is None: + raise Exception("Peer not found") + +def test_discovery_restart_progressive(dev): + """P2P device discovery and p2p_find type=progressive restart""" + try: + set_country("US", dev[1]) + autogo(dev[1], freq=5805) + dev[0].p2p_find(social=True) + dev[0].p2p_stop_find() + dev[0].p2p_find(progressive=True) + ev = dev[0].wait_global_event(["P2P-DEVICE-FOUND"], timeout=20) + dev[1].remove_group() + if ev is None: + raise Exception("Peer not found") + finally: + set_country("00") + dev[1].flush_scan_cache() + def test_p2p_peer_command(dev): """P2P_PEER command""" addr0 = dev[0].p2p_dev_addr()