From bbcbbd37016382b8fd615d3a9a11e05cdda3149a Mon Sep 17 00:00:00 2001 From: David Spinadel Date: Thu, 5 Feb 2015 20:31:00 -0500 Subject: [PATCH] tests: Modify autogo_bridge test to use group interface 1. Add get_group_ifname() to wpasupplicant.py 2. Use the function to get the interface name for the bridge. Signed-off-by: David Spinadel --- tests/hwsim/test_p2p_autogo.py | 9 +++++---- tests/hwsim/wpasupplicant.py | 3 +++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/hwsim/test_p2p_autogo.py b/tests/hwsim/test_p2p_autogo.py index a3daa7851..b35974143 100644 --- a/tests/hwsim/test_p2p_autogo.py +++ b/tests/hwsim/test_p2p_autogo.py @@ -438,12 +438,13 @@ def test_autogo_bridge(dev): if "OK" not in dev[0].request("AUTOSCAN periodic:1"): raise Exception("Failed to set autoscan") autogo(dev[0]) + ifname = dev[0].get_group_ifname() subprocess.call(['brctl', 'addbr', 'p2p-br0']) subprocess.call(['brctl', 'setfd', 'p2p-br0', '0']) - subprocess.call(['brctl', 'addif', 'p2p-br0', dev[0].ifname]) + subprocess.call(['brctl', 'addif', 'p2p-br0', ifname]) subprocess.call(['ip', 'link', 'set', 'dev', 'p2p-br0', 'up']) time.sleep(0.1) - subprocess.call(['brctl', 'delif', 'p2p-br0', dev[0].ifname]) + subprocess.call(['brctl', 'delif', 'p2p-br0', ifname]) time.sleep(0.1) subprocess.call(['ip', 'link', 'set', 'dev', 'p2p-br0', 'down']) time.sleep(0.1) @@ -451,12 +452,12 @@ def test_autogo_bridge(dev): ev = dev[0].wait_global_event(["P2P-GROUP-REMOVED"], timeout=1) if ev is not None: raise Exception("P2P group removed unexpectedly") - if dev[0].get_status_field('wpa_state') != "COMPLETED": + if dev[0].get_group_status_field('wpa_state') != "COMPLETED": raise Exception("Unexpected wpa_state") dev[0].remove_group() finally: dev[0].request("AUTOSCAN ") - subprocess.Popen(['brctl', 'delif', 'p2p-br0', dev[0].ifname], + subprocess.Popen(['brctl', 'delif', 'p2p-br0', ifname], stderr=open('/dev/null', 'w')) subprocess.Popen(['ip', 'link', 'set', 'dev', 'p2p-br0', 'down'], stderr=open('/dev/null', 'w')) diff --git a/tests/hwsim/wpasupplicant.py b/tests/hwsim/wpasupplicant.py index a7b115c63..cbba8c645 100644 --- a/tests/hwsim/wpasupplicant.py +++ b/tests/hwsim/wpasupplicant.py @@ -1041,3 +1041,6 @@ class WpaSupplicant: if ev is None: raise Exception(error) return ev + + def get_group_ifname(self): + return self.group_ifname if self.group_ifname else self.ifname