From 5e9d05115f30537f7fbc6328f3f6d765e347140e Mon Sep 17 00:00:00 2001 From: Max Stepanov Date: Thu, 2 Jul 2015 16:21:25 +0300 Subject: [PATCH] tests: Add CPT parameter to p2ps_advertise() Add an optional parameter to p2ps_advertise() function allowing to specify CPT priority values. Signed-off-by: Max Stepanov Reviewed-by: Andrei Otcheretianski Reviewed-by: Ilan Peer --- tests/hwsim/test_p2ps.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/hwsim/test_p2ps.py b/tests/hwsim/test_p2ps.py index d789ea11d..4e77ca3f6 100644 --- a/tests/hwsim/test_p2ps.py +++ b/tests/hwsim/test_p2ps.py @@ -22,25 +22,27 @@ from utils import HwsimSkip # ev0 -> Event generated at advertiser side # ev1 -> Event generated at Seeker side -def p2ps_advertise(r_dev, r_role, svc_name, srv_info, rsp_info=None): +def p2ps_advertise(r_dev, r_role, svc_name, srv_info, rsp_info=None, cpt=None): """P2PS Advertise function""" adv_id = random.randrange(1, 0xFFFFFFFF) advid = hex(adv_id)[2:] + cpt_param = (" cpt=" + cpt) if cpt is not None else "" + if rsp_info is not None and srv_info is not None: - if "OK" not in r_dev.global_request("P2P_SERVICE_ADD asp " + str(r_role) + " " + str(advid) + " 1 1108 " + svc_name + " svc_info='" + srv_info + "'" + " rsp_info=" + rsp_info + "'"): + if "OK" not in r_dev.global_request("P2P_SERVICE_ADD asp " + str(r_role) + " " + str(advid) + " 1 1108 " + svc_name + cpt_param + " svc_info='" + srv_info + "'" + " rsp_info=" + rsp_info + "'"): raise Exception("P2P_SERVICE_ADD with response info and service info failed") if rsp_info is None and srv_info is not None: - if "OK" not in r_dev.global_request("P2P_SERVICE_ADD asp " + str(r_role) + " " + str(advid) + " 1 1108 " + svc_name + " svc_info='" + srv_info + "'"): + if "OK" not in r_dev.global_request("P2P_SERVICE_ADD asp " + str(r_role) + " " + str(advid) + " 1 1108 " + svc_name + cpt_param + " svc_info='" + srv_info + "'"): raise Exception("P2P_SERVICE_ADD with service info failed") if rsp_info is None and srv_info is None: - if "OK" not in r_dev.global_request("P2P_SERVICE_ADD asp " + str(r_role) + " " + str(advid) + " 1 1108 " + svc_name + " "): + if "OK" not in r_dev.global_request("P2P_SERVICE_ADD asp " + str(r_role) + " " + str(advid) + " 1 1108 " + svc_name + cpt_param): raise Exception("P2P_SERVICE_ADD without service info and without response info failed") if rsp_info is not None and srv_info is None: - if "OK" not in r_dev.global_request("P2P_SERVICE_ADD asp " + str(r_role) + " " + str(adv_id) + " 1 1108 " + svc_name + " svc_info='" + " rsp_info=" + rsp_info + "'"): + if "OK" not in r_dev.global_request("P2P_SERVICE_ADD asp " + str(r_role) + " " + str(adv_id) + " 1 1108 " + svc_name + cpt_param + " svc_info='" + " rsp_info=" + rsp_info + "'"): raise Exception("P2P_SERVICE_ADD with response info failed") r_dev.p2p_listen()