[PATCH 2/8] tests: hwsim_utils start using general cmd_execute() func

Jonathan Afek jonathan at wizery.com
Thu Jun 23 10:16:30 PDT 2016


The hwsim_utils 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 at intel.com>
---
 tests/hwsim/hwsim_utils.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/tests/hwsim/hwsim_utils.py b/tests/hwsim/hwsim_utils.py
index cba9271..1f4017f 100644
--- a/tests/hwsim/hwsim_utils.py
+++ b/tests/hwsim/hwsim_utils.py
@@ -173,6 +173,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])
+    if 0 != res:
+        raise Exception("failed to set power save for device")
-- 
1.9.1




More information about the Hostap mailing list