tests: PD-before-GO-Neg workaround

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2014-03-05 00:36:37 +02:00
parent 3a94adbf42
commit 08e4bd8751
2 changed files with 18 additions and 6 deletions

View file

@ -93,24 +93,28 @@ def go_neg_pin_authorized(i_dev, r_dev, i_intent=None, r_intent=None, expect_fai
hwsim_utils.test_connectivity_p2p(r_dev, i_dev) hwsim_utils.test_connectivity_p2p(r_dev, i_dev)
return [i_res, r_res] return [i_res, r_res]
def go_neg_init_pbc(i_dev, r_dev, i_intent, res, freq): def go_neg_init_pbc(i_dev, r_dev, i_intent, res, freq, provdisc):
logger.debug("Initiate GO Negotiation from i_dev") logger.debug("Initiate GO Negotiation from i_dev")
try: try:
i_res = i_dev.p2p_go_neg_init(r_dev.p2p_dev_addr(), None, "pbc", i_res = i_dev.p2p_go_neg_init(r_dev.p2p_dev_addr(), None, "pbc",
timeout=20, go_intent=i_intent, freq=freq) timeout=20, go_intent=i_intent, freq=freq,
provdisc=provdisc)
logger.debug("i_res: " + str(i_res)) logger.debug("i_res: " + str(i_res))
except Exception, e: except Exception, e:
i_res = None i_res = None
logger.info("go_neg_init_pbc thread caught an exception from p2p_go_neg_init: " + str(e)) logger.info("go_neg_init_pbc thread caught an exception from p2p_go_neg_init: " + str(e))
res.put(i_res) res.put(i_res)
def go_neg_pbc(i_dev, r_dev, i_intent=None, r_intent=None, i_freq=None, r_freq=None): def go_neg_pbc(i_dev, r_dev, i_intent=None, r_intent=None, i_freq=None, r_freq=None, provdisc=False, r_listen=False):
if r_listen:
r_dev.p2p_listen()
else:
r_dev.p2p_find(social=True) r_dev.p2p_find(social=True)
i_dev.p2p_find(social=True) i_dev.p2p_find(social=True)
logger.info("Start GO negotiation " + i_dev.ifname + " -> " + r_dev.ifname) logger.info("Start GO negotiation " + i_dev.ifname + " -> " + r_dev.ifname)
r_dev.dump_monitor() r_dev.dump_monitor()
res = Queue.Queue() res = Queue.Queue()
t = threading.Thread(target=go_neg_init_pbc, args=(i_dev, r_dev, i_intent, res, i_freq)) t = threading.Thread(target=go_neg_init_pbc, args=(i_dev, r_dev, i_intent, res, i_freq, provdisc))
t.start() t.start()
logger.debug("Wait for GO Negotiation Request on r_dev") logger.debug("Wait for GO Negotiation Request on r_dev")
ev = r_dev.wait_global_event(["P2P-GO-NEG-REQUEST"], timeout=15) ev = r_dev.wait_global_event(["P2P-GO-NEG-REQUEST"], timeout=15)
@ -227,6 +231,12 @@ def test_grpform_pbc(dev):
raise Exception("Unexpected device roles") raise Exception("Unexpected device roles")
remove_group(dev[0], dev[1]) remove_group(dev[0], dev[1])
def test_grpform_pd(dev):
"""P2P group formation with PD-before-GO-Neg workaround"""
[i_res, r_res] = go_neg_pbc(i_dev=dev[0], provdisc=True, r_dev=dev[1], r_listen=True)
check_grpform_results(i_res, r_res)
remove_group(dev[0], dev[1])
def test_both_go_intent_15(dev): def test_both_go_intent_15(dev):
"""P2P GO Negotiation with both devices using GO intent 15""" """P2P GO Negotiation with both devices using GO intent 15"""
go_neg_pin_authorized(i_dev=dev[0], i_intent=15, r_dev=dev[1], r_intent=15, expect_failure=True, i_go_neg_status=9) go_neg_pin_authorized(i_dev=dev[0], i_intent=15, r_dev=dev[1], r_intent=15, expect_failure=True, i_go_neg_status=9)

View file

@ -440,7 +440,7 @@ class WpaSupplicant:
self.dump_monitor() self.dump_monitor()
return self.group_form_result(ev, expect_failure, go_neg_res) return self.group_form_result(ev, expect_failure, go_neg_res)
def p2p_go_neg_init(self, peer, pin, method, timeout=0, go_intent=None, expect_failure=False, persistent=False, freq=None): def p2p_go_neg_init(self, peer, pin, method, timeout=0, go_intent=None, expect_failure=False, persistent=False, freq=None, provdisc=False):
if not self.discover_peer(peer): if not self.discover_peer(peer):
raise Exception("Peer " + peer + " not found") raise Exception("Peer " + peer + " not found")
self.dump_monitor() self.dump_monitor()
@ -454,6 +454,8 @@ class WpaSupplicant:
cmd = cmd + ' freq=' + str(freq) cmd = cmd + ' freq=' + str(freq)
if persistent: if persistent:
cmd = cmd + " persistent" cmd = cmd + " persistent"
if provdisc:
cmd = cmd + " provdisc"
if "OK" in self.global_request(cmd): if "OK" in self.global_request(cmd):
if timeout == 0: if timeout == 0:
self.dump_monitor() self.dump_monitor()