tests: Use cmd_execute() in set_powersave()

hwsim_utils.set_powersace() used to do file operations locally in
python. Start using the cmd_execute() general function for file
operations so that this would also work on remote setups.

Signed-off-by: Jonathan Afek <jonathanx.afek@intel.com>
This commit is contained in:
Jonathan Afek 2016-06-23 20:16:30 +03:00 committed by Jouni Malinen
parent f9442f2967
commit f11005812a

View file

@ -174,6 +174,8 @@ def test_connectivity_sta(dev1, dev2, dscp=None, tos=None):
def set_powersave(dev, val):
phy = dev.get_driver_status_field("phyname")
psf = open('/sys/kernel/debug/ieee80211/%s/hwsim/ps' % phy, 'w')
psf.write('%d\n' % val)
psf.close()
fname = '/sys/kernel/debug/ieee80211/%s/hwsim/ps' % phy
data = '%d' % val
(res, data) = dev.cmd_execute(["echo", data, ">", fname], shell=True)
if res != 0:
raise Exception("Failed to set power save for device")