From 10e09d83167d292f620c4ce8a870868f8864722d Mon Sep 17 00:00:00 2001 From: Jonathan Afek Date: Thu, 23 Jun 2016 20:16:29 +0300 Subject: [PATCH] tests: Use cmd_execute() for ip link set up/down commands The hwsim tests used to execute shell commands in the tests using the subprocess python module. Use the cmd_execute() general function for executing "ip link set up/down" commands so that this would also work on remote setups. Signed-off-by: Jonathan Afek --- tests/hwsim/test_ap_open.py | 4 ++-- tests/hwsim/test_ap_psk.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/hwsim/test_ap_open.py b/tests/hwsim/test_ap_open.py index c9cb265fb..fe52956bb 100644 --- a/tests/hwsim/test_ap_open.py +++ b/tests/hwsim/test_ap_open.py @@ -345,7 +345,7 @@ def test_ap_open_ifdown(dev, apdev): dev[0].connect("open", key_mgmt="NONE", scan_freq="2412") dev[1].connect("open", key_mgmt="NONE", scan_freq="2412") - subprocess.call(['ip', 'link', 'set', 'dev', apdev[0]['ifname'], 'down']) + hapd.cmd_execute(['ip', 'link', 'set', 'dev', apdev[0]['ifname'], 'down']) ev = hapd.wait_event(["AP-STA-DISCONNECTED"], timeout=10) if ev is None: raise Exception("Timeout on AP-STA-DISCONNECTED (1)") @@ -358,7 +358,7 @@ def test_ap_open_ifdown(dev, apdev): # The following wait tests beacon loss detection in mac80211 on dev0. # dev1 is used to test stopping of AP side functionality on client polling. dev[1].request("REMOVE_NETWORK all") - subprocess.call(['ip', 'link', 'set', 'dev', apdev[0]['ifname'], 'up']) + hapd.cmd_execute(['ip', 'link', 'set', 'dev', apdev[0]['ifname'], 'up']) dev[0].wait_disconnected() dev[1].wait_disconnected() ev = hapd.wait_event(["INTERFACE-ENABLED"], timeout=10) diff --git a/tests/hwsim/test_ap_psk.py b/tests/hwsim/test_ap_psk.py index 55f3eda2a..9cf0c00f5 100644 --- a/tests/hwsim/test_ap_psk.py +++ b/tests/hwsim/test_ap_psk.py @@ -1888,13 +1888,13 @@ def test_ap_wpa2_psk_ifdown(dev, apdev): bssid = apdev[0]['bssid'] dev[0].connect(ssid, psk=passphrase, scan_freq="2412") - subprocess.call(['ip', 'link', 'set', 'dev', apdev[0]['ifname'], 'down']) + hapd.cmd_execute(['ip', 'link', 'set', 'dev', apdev[0]['ifname'], 'down']) ev = hapd.wait_event(["INTERFACE-DISABLED"], timeout=10) if ev is None: raise Exception("No INTERFACE-DISABLED event") # this wait tests beacon loss detection in mac80211 dev[0].wait_disconnected() - subprocess.call(['ip', 'link', 'set', 'dev', apdev[0]['ifname'], 'up']) + hapd.cmd_execute(['ip', 'link', 'set', 'dev', apdev[0]['ifname'], 'up']) ev = hapd.wait_event(["INTERFACE-ENABLED"], timeout=10) if ev is None: raise Exception("No INTERFACE-ENABLED event")