From 8e751cfa05476bbc8da5116701ef465eae98a987 Mon Sep 17 00:00:00 2001 From: Ben Rosenfeld Date: Tue, 5 May 2015 12:36:58 +0300 Subject: [PATCH] tests: Change list_networks() to use global interface with P2P list_networks() always used the wlanX control interface to query for the current list of networks. However, when a dedicated P2P Device is used, the global control interface should be used when checking persistent group network profiles. Fix this by adding an optional parameter indicating that the P2P networks are requested, and in such a case use the global control interface. In addition update test_p2p_persistent to use the argument when needed. Signed-off-by: Ben Rosenfeld --- tests/hwsim/test_p2p_persistent.py | 10 +++++----- tests/hwsim/wpasupplicant.py | 7 +++++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/tests/hwsim/test_p2p_persistent.py b/tests/hwsim/test_p2p_persistent.py index 65bf904c0..65bbc3145 100644 --- a/tests/hwsim/test_p2p_persistent.py +++ b/tests/hwsim/test_p2p_persistent.py @@ -119,7 +119,7 @@ def test_persistent_group(dev): logger.info("Remove group on the client and try to invite from GO") id = None - for n in dev[0].list_networks(): + for n in dev[0].list_networks(p2p=True): if "[P2P-PERSISTENT]" in n['flags']: id = n['id'] break @@ -143,7 +143,7 @@ def test_persistent_group(dev): if "FAIL" not in dev[1].request("REMOVE_NETWORK 1234567"): raise Exception("REMOVE_NETWORK succeeded unexpectedly") dev[1].request("REMOVE_NETWORK all") - if len(dev[1].list_networks()) > 0: + if len(dev[1].list_networks(p2p=True)) > 0: raise Exception("Unexpected network block remaining") invite(dev[0], dev[1]) ev = dev[0].wait_global_event(["P2P-INVITATION-RESULT"], timeout=10) @@ -201,7 +201,7 @@ def test_persistent_group_per_sta_psk(dev): dev[2].dump_monitor() for i in range(0, 3): - networks = dev[i].list_networks() + networks = dev[i].list_networks(p2p=True) if len(networks) != 1: raise Exception("Unexpected number of networks") if "[P2P-PERSISTENT]" not in networks[0]['flags']: @@ -399,7 +399,7 @@ def test_persistent_go_client_list(dev): res = dev[0].p2p_start_go(persistent=True) id = None - for n in dev[0].list_networks(): + for n in dev[0].list_networks(p2p=True): if "[P2P-PERSISTENT]" in n['flags']: id = n['id'] break @@ -548,7 +548,7 @@ def test_persistent_group_already_running(dev): listen_freq = peer['listen_freq'] dev[0].dump_monitor() dev[1].dump_monitor() - networks = dev[0].list_networks() + networks = dev[0].list_networks(p2p=True) if len(networks) != 1: raise Exception("Unexpected number of networks") if "[P2P-PERSISTENT]" not in networks[0]['flags']: diff --git a/tests/hwsim/wpasupplicant.py b/tests/hwsim/wpasupplicant.py index 1cdcc0965..cbb73f26e 100644 --- a/tests/hwsim/wpasupplicant.py +++ b/tests/hwsim/wpasupplicant.py @@ -198,8 +198,11 @@ class WpaSupplicant: raise Exception("SET_NETWORK failed") return None - def list_networks(self): - res = self.request("LIST_NETWORKS") + def list_networks(self, p2p=False): + if p2p: + res = self.global_request("LIST_NETWORKS") + else: + res = self.request("LIST_NETWORKS") lines = res.splitlines() networks = [] for l in lines: