tests: Force diff chan in p2ps_channel_active_go_and_station_different_mcc

This test case was failing pretty frequently due to an issue in being
able to send out the Provision Discovery Response frame on the operating
channel. Now that wpa_supplicant has a fix for that issue, modify this
test case to hit this error condition every time. In addition, make sure
the possible exception from p2ps_exact_seek() does not get hidden with a
failing remove_group() call in the finally section.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2019-02-17 16:55:50 +02:00
parent 947b5a1532
commit cf4643aa7d
2 changed files with 11 additions and 3 deletions

View file

@ -367,8 +367,12 @@ def go_neg_pbc_authorized(i_dev, r_dev, i_intent=None, r_intent=None,
logger.info("Group formed") logger.info("Group formed")
return [i_res, r_res] return [i_res, r_res]
def remove_group(dev1, dev2): def remove_group(dev1, dev2, allow_failure=False):
dev1.remove_group() try:
dev1.remove_group()
except:
if not allow_failure:
raise
try: try:
dev2.remove_group() dev2.remove_group()
except: except:

View file

@ -1587,9 +1587,11 @@ def test_p2ps_channel_active_go_and_station_different_mcc(dev, apdev):
hapd = hostapd.add_ap(apdev[0], hapd = hostapd.add_ap(apdev[0],
{ "ssid": 'bss-channel-6', "channel": '6' }) { "ssid": 'bss-channel-6', "channel": '6' })
wpas.global_request("P2P_SET listen_channel 1")
wpas.connect("bss-channel-6", key_mgmt="NONE", scan_freq="2437") wpas.connect("bss-channel-6", key_mgmt="NONE", scan_freq="2437")
# Add a P2P GO on the seeker # Add a P2P GO on the seeker
dev[1].global_request("P2P_SET listen_channel 1")
dev[1].global_request("P2P_GROUP_ADD freq=2462 persistent") dev[1].global_request("P2P_GROUP_ADD freq=2462 persistent")
ev = dev[1].wait_global_event(["P2P-GROUP-STARTED"], timeout=10) ev = dev[1].wait_global_event(["P2P-GROUP-STARTED"], timeout=10)
if ev is None: if ev is None:
@ -1607,10 +1609,12 @@ def test_p2ps_channel_active_go_and_station_different_mcc(dev, apdev):
ev1, ev0 = p2ps_provision(dev[1], wpas, adv_id) ev1, ev0 = p2ps_provision(dev[1], wpas, adv_id)
p2ps_connect_pd(wpas, dev[1], ev0, ev1) p2ps_connect_pd(wpas, dev[1], ev0, ev1)
finally: finally:
set_random_listen_chan(dev[1])
set_random_listen_chan(wpas)
wpas.request("DISCONNECT") wpas.request("DISCONNECT")
hapd.disable() hapd.disable()
wpas.global_request("P2P_SERVICE_DEL asp all") wpas.global_request("P2P_SERVICE_DEL asp all")
remove_group(wpas, dev[1]) remove_group(wpas, dev[1], allow_failure=True)
def test_p2ps_connect_p2p_device(dev): def test_p2ps_connect_p2p_device(dev):
"""P2PS connection using cfg80211 P2P Device""" """P2PS connection using cfg80211 P2P Device"""