From d25f16e4780c83d005033d5f90e6962978a5d0dc Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Sun, 3 Feb 2019 00:04:31 +0100 Subject: [PATCH] tests: Create radio for p2ps_channel_both_connected_different_mcc Instead of relying on existing configuration (which may conflict with other tests) and skipping otherwise, create a new radio with two channels in this test and use it. Signed-off-by: Johannes Berg --- tests/hwsim/test_p2ps.py | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/tests/hwsim/test_p2ps.py b/tests/hwsim/test_p2ps.py index 20a8c9cc5..874b58b63 100644 --- a/tests/hwsim/test_p2ps.py +++ b/tests/hwsim/test_p2ps.py @@ -1309,30 +1309,31 @@ def test_p2ps_channel_both_connected_different(dev, apdev): def test_p2ps_channel_both_connected_different_mcc(dev, apdev): """P2PS connection with P2PS method - stations connected on different channels with mcc""" - if dev[0].get_mcc() == 1: - raise HwsimSkip('Skip case due to MCC not enabled') + with HWSimRadio(n_channels=2) as (radio, iface): + wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5') + wpas.interface_add(iface) - set_no_group_iface(dev[0], 0) - set_no_group_iface(dev[1], 0) + set_no_group_iface(wpas, 0) + set_no_group_iface(dev[1], 0) - try: - hapd1 = hostapd.add_ap(apdev[0], - { "ssid": 'bss-channel-3', "channel": '3' }) + try: + hapd1 = hostapd.add_ap(apdev[0], + { "ssid": 'bss-channel-3', "channel": '3' }) - hapd2 = hostapd.add_ap(apdev[1], - { "ssid": 'bss-channel-10', "channel": '10' }) + hapd2 = hostapd.add_ap(apdev[1], + { "ssid": 'bss-channel-10', "channel": '10' }) - dev[0].connect("bss-channel-3", key_mgmt="NONE", scan_freq="2422") - dev[1].connect("bss-channel-10", key_mgmt="NONE", scan_freq="2457") + wpas.connect("bss-channel-3", key_mgmt="NONE", scan_freq="2422") + dev[1].connect("bss-channel-10", key_mgmt="NONE", scan_freq="2457") - (grp_ifname0, grp_ifname1, ifnames) = p2ps_connect_p2ps_method(dev, keep_group=True) - freq = dev[0].get_group_status_field('freq') + (grp_ifname0, grp_ifname1, ifnames) = p2ps_connect_p2ps_method([ wpas, dev[1] ], keep_group=True) + freq = wpas.get_group_status_field('freq') - if freq != '2422' and freq != '2457': - raise Exception('Unexpected frequency for group =' + freq) - finally: - dev[0].global_request("P2P_SERVICE_DEL asp all") - remove_group(dev[0], dev[1]) + if freq != '2422' and freq != '2457': + raise Exception('Unexpected frequency for group =' + freq) + finally: + wpas.global_request("P2P_SERVICE_DEL asp all") + remove_group(wpas, dev[1]) def clear_disallow_handler(seeker, advertiser): advertiser.global_request("P2P_SET disallow_freq ")