From 9773ea38cfaee64ddadad990970702144fba5890 Mon Sep 17 00:00:00 2001 From: Andrei Otcheretianski Date: Thu, 24 Sep 2015 20:37:53 +0300 Subject: [PATCH] tests: Put seeker into extended listen when deferred PD is expected Not doing so may result in a deferred PD flow failure (currently the hwsim tests succeeded because seeker never stopped find, spending enough time listening, so the follow-on PD would succeed). Fix this by calling p2p_ext_listen when the seeker receives a deferred PD failure event. Cancel extended listening when PD is done and also stop find when seek is done. Signed-off-by: Andrei Otcheretianski --- tests/hwsim/test_p2ps.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/hwsim/test_p2ps.py b/tests/hwsim/test_p2ps.py index 5f0b13b76..564b245a5 100644 --- a/tests/hwsim/test_p2ps.py +++ b/tests/hwsim/test_p2ps.py @@ -92,6 +92,7 @@ def p2ps_exact_seek(i_dev, r_dev, svc_name, srv_info=None, if rcvd_svc_name != svc_name: raise Exception("service name not matching") + i_dev.p2p_stop_find() return [adv_id, rcvd_svc_name] def p2ps_nonexact_seek(i_dev, r_dev, svc_name, srv_info=None, adv_num=None): @@ -123,6 +124,8 @@ def p2ps_nonexact_seek(i_dev, r_dev, svc_name, srv_info=None, adv_num=None): adv_id = ev1.split(" ")[3] rcvd_svc_name = ev1.split(" ")[6] ev_list.append(''.join([adv_id, ' ', rcvd_svc_name])) + + i_dev.p2p_stop_find() return ev_list def p2ps_parse_event(ev, *args): @@ -153,6 +156,10 @@ def p2ps_provision(seeker, advertiser, adv_id, auto_accept=True, method="1000", if ev is None: raise Exception("P2P-PROV-DISC-FAILURE timeout on seeker side") + # Put seeker into a listen state, since we expect the deferred flow to + # continue. + seeker.p2p_ext_listen(500, 500) + if method == "100": ev = advertiser.wait_global_event(["P2P-PROV-DISC-ENTER-PIN"], timeout=10) @@ -197,6 +204,7 @@ def p2ps_provision(seeker, advertiser, adv_id, auto_accept=True, method="1000", if addr1 not in ev: raise Exception("Unknown peer " + addr1) + seeker.p2p_cancel_ext_listen() if pin is not None: return ev1, ev2, pin return ev1, ev2