diff options
author | Johannes Berg <johannes.berg@intel.com> | 2014-10-20 10:00:06 (GMT) |
---|---|---|
committer | Jouni Malinen <j@w1.fi> | 2014-10-22 07:53:45 (GMT) |
commit | 5a8d165cd8afa8d27422a2c642caf7a7a2724643 (patch) | |
tree | 2cacbe0f8c1498567707b0ab46dc46a3e6008d4d /tests | |
parent | 9b2c227216c934e8422f28ab60309ad08e3c98b0 (diff) | |
download | hostap-5a8d165cd8afa8d27422a2c642caf7a7a2724643.zip hostap-5a8d165cd8afa8d27422a2c642caf7a7a2724643.tar.gz hostap-5a8d165cd8afa8d27422a2c642caf7a7a2724643.tar.bz2 |
tests: Use dynamic radio for P2P_DEVICE tests
Use dynamic radios for P2P_DEVICE tests to be able to test
support when the default in hwsim is to not support it.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/hwsim/test_p2p_device.py | 58 |
1 files changed, 31 insertions, 27 deletions
diff --git a/tests/hwsim/test_p2p_device.py b/tests/hwsim/test_p2p_device.py index b9b4810..a3428f2 100644 --- a/tests/hwsim/test_p2p_device.py +++ b/tests/hwsim/test_p2p_device.py @@ -12,39 +12,43 @@ from wpasupplicant import WpaSupplicant from test_p2p_grpform import go_neg_pin_authorized from test_p2p_grpform import check_grpform_results from test_p2p_grpform import remove_group +from hwsim import HWSimRadio def test_p2p_device_grpform(dev, apdev): """P2P group formation with driver using cfg80211 P2P Device""" - wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5') - wpas.interface_add("wlan5") - [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=15, - r_dev=wpas, r_intent=0) - check_grpform_results(i_res, r_res) - remove_group(dev[0], wpas) + with HWSimRadio(use_p2p_device=True) as (radio, iface): + wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5') + wpas.interface_add(iface) + [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=15, + r_dev=wpas, r_intent=0) + check_grpform_results(i_res, r_res) + remove_group(dev[0], wpas) def test_p2p_device_grpform2(dev, apdev): """P2P group formation with driver using cfg80211 P2P Device (reverse)""" - wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5') - wpas.interface_add("wlan5") - [i_res, r_res] = go_neg_pin_authorized(i_dev=wpas, i_intent=15, - r_dev=dev[0], r_intent=0) - check_grpform_results(i_res, r_res) - remove_group(wpas, dev[0]) + with HWSimRadio(use_p2p_device=True) as (radio, iface): + wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5') + wpas.interface_add(iface) + [i_res, r_res] = go_neg_pin_authorized(i_dev=wpas, i_intent=15, + r_dev=dev[0], r_intent=0) + check_grpform_results(i_res, r_res) + remove_group(wpas, dev[0]) def test_p2p_device_group_remove(dev, apdev): """P2P group removal via the P2P ctrl interface with driver using cfg80211 P2P Device""" - wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5') - wpas.interface_add("wlan5") - [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=15, - r_dev=wpas, r_intent=0) - check_grpform_results(i_res, r_res) - # Issue the remove request on the interface which will be removed - p2p_iface_wpas = WpaSupplicant(ifname=r_res['ifname']) - res = p2p_iface_wpas.request("P2P_GROUP_REMOVE *") - if "OK" not in res: - raise Exception("Failed to remove P2P group") - ev = wpas.wait_global_event(["P2P-GROUP-REMOVED"], timeout=10) - if ev is None: - raise Exception("Group removal event not received") - if not wpas.global_ping(): - raise Exception("Could not ping global ctrl_iface after group removal") + with HWSimRadio(use_p2p_device=True) as (radio, iface): + wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5') + wpas.interface_add(iface) + [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=15, + r_dev=wpas, r_intent=0) + check_grpform_results(i_res, r_res) + # Issue the remove request on the interface which will be removed + p2p_iface_wpas = WpaSupplicant(ifname=r_res['ifname']) + res = p2p_iface_wpas.request("P2P_GROUP_REMOVE *") + if "OK" not in res: + raise Exception("Failed to remove P2P group") + ev = wpas.wait_global_event(["P2P-GROUP-REMOVED"], timeout=10) + if ev is None: + raise Exception("Group removal event not received") + if not wpas.global_ping(): + raise Exception("Could not ping global ctrl_iface after group removal") |