diff options
authorJouni Malinen <jouni@qca.qualcomm.com>2015-12-30 22:37:45 (GMT)
committerJouni Malinen <j@w1.fi>2015-12-30 22:37:45 (GMT)
commit700c5d0b1645330bfac0c27e729c2699366fa953 (patch)
parente79eb0c6602ae315b33cc7f4aa3cf7c296464a38 (diff)
tests: P2P_LISTEN immediately followed by P2P_FIND
This verifies that the previous commit works correctly by forcing a P2P_LISTEN command execution to be interupted by a P2P_FIND command timed in a manner that forces it to show up before the kernel ROC has started for the Listen. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/hwsim/test_p2p_discovery.py b/tests/hwsim/test_p2p_discovery.py
index 7d20e77..c102fcc 100644
--- a/tests/hwsim/test_p2p_discovery.py
+++ b/tests/hwsim/test_p2p_discovery.py
@@ -13,6 +13,7 @@ import hwsim_utils
from wpasupplicant import WpaSupplicant
from p2p_utils import *
from test_gas import start_ap
+from test_cfg80211 import nl80211_remain_on_channel
def test_discovery(dev):
"""P2P device discovery and provision discovery"""
@@ -541,3 +542,24 @@ def test_discovery_after_gas(dev, apdev):
logger.info("Device discovery after fragmented GAS took %f seconds" % (end - start))
if end - start > 1.3:
raise Exception("Device discovery took unexpectedly long time")
+def test_discovery_listen_find(dev):
+ """P2P_LISTEN immediately followed by P2P_FIND"""
+ # Request an external remain-on-channel operation to delay start of the ROC
+ # for the following p2p_listen() enough to get p2p_find() processed before
+ # the ROC started event shows up. This is done to test a code path where the
+ # p2p_find() needs to clear the wait for the pending listen operation
+ # (p2p->pending_listen_freq).
+ ifindex = int(dev[0].get_driver_status_field("ifindex"))
+ nl80211_remain_on_channel(dev[0], ifindex, 2417, 200)
+ addr0 = dev[0].p2p_dev_addr()
+ dev[0].p2p_listen()
+ dev[0].p2p_find(social=True)
+ time.sleep(0.4)
+ dev[1].p2p_listen()
+ ev = dev[0].wait_global_event(["P2P-DEVICE-FOUND"], timeout=1.2)
+ if not dev[1].discover_peer(addr0):
+ raise Exception("Device discovery timed out")
+ if ev is None:
+ raise Exception("Did not find peer quickly enough after stopped P2P_LISTEN")