[PATCH 1/2] tests: ibss kill subprocess usage

Janusz Dziedzic janusz.dziedzic at tieto.com
Fri Apr 1 23:24:21 PDT 2016


In case of remote hosts, we can't just use
subprocesss() while we have to run command
on remote host.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic at tieto.com>
---
 tests/hwsim/test_ibss.py | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/tests/hwsim/test_ibss.py b/tests/hwsim/test_ibss.py
index cc6bfc1..f5e060f 100644
--- a/tests/hwsim/test_ibss.py
+++ b/tests/hwsim/test_ibss.py
@@ -8,7 +8,6 @@ import logging
 logger = logging.getLogger()
 import time
 import re
-import subprocess
 
 import hwsim_utils
 from utils import alloc_fail
@@ -299,10 +298,8 @@ def test_ibss_open_fixed_bssid(dev):
 
 def test_ibss_open_retry(dev):
     """IBSS open (no security) with cfg80211 retry workaround"""
-    subprocess.check_call(['iw', 'dev', dev[0].ifname, 'set', 'type', 'adhoc'])
-    subprocess.check_call(['iw', 'dev', dev[0].ifname, 'ibss', 'join',
-                           'ibss-test', '2412', 'HT20', 'fixed-freq',
-                           '02:22:33:44:55:66'])
+    dev[0].host.execute("iw dev " + dev[0].ifname + " set type adhoc")
+    dev[0].host.execute("iw dev " + dev[0].ifname + " ibss join ibss-test 2412 HT20 fixed-freq 02:22:33:44:55:66")
     ssid="ibss"
     try:
         dev[0].request("AP_SCAN 2")
@@ -312,7 +309,7 @@ def test_ibss_open_retry(dev):
         dev[0].request("REASSOCIATE")
         bssid0 = wait_ibss_connection(dev[0])
 
-        subprocess.check_call(['iw', 'dev', dev[0].ifname, 'ibss', 'leave'])
+        dev[0].host.execute("iw dev" + dev[0].ifname + " ibss leave")
         time.sleep(1)
         dev[0].request("DISCONNECT")
     finally:
@@ -358,13 +355,14 @@ def test_ibss_5ghz(dev):
     try:
         _test_ibss_5ghz(dev)
     finally:
-        subprocess.call(['iw', 'reg', 'set', '00'])
+        dev[0].host.execute("iw reg set 00")
+        dev[1].host.execute("iw reg set 00")
         dev[0].flush_scan_cache()
         dev[1].flush_scan_cache()
 
 def _test_ibss_5ghz(dev):
-    subprocess.call(['iw', 'reg', 'set', 'US'])
     for i in range(2):
+        dev[i].host.execute("iw reg set US")
         for j in range(5):
             ev = dev[i].wait_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=5)
             if ev is None:
@@ -395,15 +393,16 @@ def test_ibss_vht_80p80(dev):
     try:
         _test_ibss_vht_80p80(dev)
     finally:
-        subprocess.call(['iw', 'reg', 'set', '00'])
+        dev[0].host.execute("iw reg set 00")
+        dev[1].host.execute("iw reg set 00")
         dev[0].flush_scan_cache()
         dev[1].flush_scan_cache()
 
 def _test_ibss_vht_80p80(dev):
-    subprocess.call(['iw', 'reg', 'set', 'US'])
     for i in range(2):
+        dev[i].host.execute("iw reg set US")
         for j in range(5):
-            ev = dev[i].wait_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=5)
+            ev = dev[i].wait_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=10)
             if ev is None:
                 raise Exception("No regdom change event")
             if "alpha2=US" in ev:
-- 
1.9.1




More information about the Hostap mailing list