From 70892f697f182e9eac2eda2bc6fbb7f223f4ff9b Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Thu, 30 Oct 2014 20:01:21 +0200 Subject: [PATCH] tests: P2P_STOP_FIND/P2P_FLUSH to ignore new results Signed-off-by: Jouni Malinen --- tests/hwsim/test_p2p_discovery.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/tests/hwsim/test_p2p_discovery.py b/tests/hwsim/test_p2p_discovery.py index ad0d0bff9..2071e2427 100644 --- a/tests/hwsim/test_p2p_discovery.py +++ b/tests/hwsim/test_p2p_discovery.py @@ -327,3 +327,34 @@ def test_discovery_auto(dev): raise Exception("Dev1 not in provision discovery event") if "peer_go=1" not in ev0: raise Exception("peer_go incorrect in PD response from GO") + +def test_discovery_stop(dev): + """P2P device discovery and p2p_stop_find""" + addr0 = dev[0].p2p_dev_addr() + addr1 = dev[1].p2p_dev_addr() + dev[1].p2p_listen() + dev[2].p2p_listen() + + dev[0].p2p_find(social=False) + ev = dev[0].wait_event(["CTRL-EVENT-SCAN-STARTED"], timeout=0.5) + if ev is None: + logger.info("No CTRL-EVENT-SCAN-STARTED event") + dev[0].p2p_stop_find() + ev = dev[0].wait_global_event(["P2P-FIND-STOPPED"], timeout=1) + if ev is None: + raise Exception("P2P_STOP not reported") + ev = dev[0].wait_global_event(["P2P-DEVICE-FOUND"], timeout=5) + if ev is not None: + raise Exception("Peer found unexpectedly: " + ev) + + dev[0].p2p_find(social=False) + ev = dev[0].wait_event(["CTRL-EVENT-SCAN-STARTED"], timeout=0.5) + if ev is None: + logger.info("No CTRL-EVENT-SCAN-STARTED event") + dev[0].request("P2P_FLUSH") + ev = dev[0].wait_global_event(["P2P-FIND-STOPPED"], timeout=1) + if ev is None: + raise Exception("P2P_STOP not reported") + ev = dev[0].wait_global_event(["P2P-DEVICE-FOUND"], timeout=5) + if ev is not None: + raise Exception("Peer found unexpectedly: " + ev)