From 6ed2498eb520b69446566bde3f7613a2209245ce Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Wed, 15 Feb 2017 16:06:41 +0200 Subject: [PATCH] tests: P2P channel selection with driver frequency preference list Signed-off-by: Jouni Malinen --- tests/hwsim/test_p2p_channel.py | 71 +++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/tests/hwsim/test_p2p_channel.py b/tests/hwsim/test_p2p_channel.py index 05dc0dc5f..b5ff9eced 100644 --- a/tests/hwsim/test_p2p_channel.py +++ b/tests/hwsim/test_p2p_channel.py @@ -1222,3 +1222,74 @@ def test_p2p_channel_vht80p80_persistent(dev): finally: set_country("00") dev[1].flush_scan_cache() + +def test_p2p_channel_drv_pref_go_neg(dev): + """P2P GO Negotiation with GO device channel preference""" + dev[0].set("get_pref_freq_list_override", "3:2417 4:2422") + [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=15, + r_dev=dev[1], r_intent=0, + test_data=False) + check_grpform_results(i_res, r_res) + freq = int(i_res['freq']) + if freq != 2417: + raise Exception("Unexpected channel selected: %d" % freq) + remove_group(dev[0], dev[1]) + +def test_p2p_channel_drv_pref_go_neg2(dev): + """P2P GO Negotiation with P2P client device channel preference""" + dev[0].set("get_pref_freq_list_override", "3:2417,2422") + dev[1].set("get_pref_freq_list_override", "4:2422") + [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=15, + r_dev=dev[1], r_intent=0, + test_data=False) + check_grpform_results(i_res, r_res) + freq = int(i_res['freq']) + if freq != 2422: + raise Exception("Unexpected channel selected: %d" % freq) + remove_group(dev[0], dev[1]) + +def test_p2p_channel_drv_pref_go_neg3(dev): + """P2P GO Negotiation with GO device channel preference""" + dev[1].set("get_pref_freq_list_override", "3:2417,2427 4:2422") + [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=0, + r_dev=dev[1], r_intent=15, + test_data=False) + check_grpform_results(i_res, r_res) + freq = int(i_res['freq']) + if freq != 2417: + raise Exception("Unexpected channel selected: %d" % freq) + remove_group(dev[0], dev[1]) + +def test_p2p_channel_drv_pref_go_neg4(dev): + """P2P GO Negotiation with P2P client device channel preference""" + dev[0].set("get_pref_freq_list_override", "3:2417,2422,5180") + dev[1].request("P2P_SET override_pref_op_chan 115:36") + [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=15, + r_dev=dev[1], r_intent=0, + test_data=False) + check_grpform_results(i_res, r_res) + freq = int(i_res['freq']) + if freq != 2417: + raise Exception("Unexpected channel selected: %d" % freq) + remove_group(dev[0], dev[1]) + +def test_p2p_channel_drv_pref_go_neg5(dev): + """P2P GO Negotiation with P2P client device channel preference""" + dev[0].set("get_pref_freq_list_override", "3:2417") + dev[1].set("get_pref_freq_list_override", "4:2422") + dev[1].request("P2P_SET override_pref_op_chan 115:36") + [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=15, + r_dev=dev[1], r_intent=0, + test_data=False) + check_grpform_results(i_res, r_res) + freq = int(i_res['freq']) + if freq != 2417: + raise Exception("Unexpected channel selected: %d" % freq) + remove_group(dev[0], dev[1]) + +def test_p2p_channel_drv_pref_autogo(dev): + """P2P autonomous GO with driver channel preference""" + dev[0].set("get_pref_freq_list_override", "3:2417,2422,5180") + res_go = autogo(dev[0]) + if res_go['freq'] != "2417": + raise Exception("Unexpected operating frequency: " + res_go['freq'])