[PATCH 1/2] tests: remotehost: use correct name

Janusz Dziedzic janusz.dziedzic at gmail.com
Sat Nov 7 05:49:14 EST 2020


While we start thread use:
 - thread_run
 - therad_stop
 - thread_wait

Signed-off-by: Janusz Dziedzic <janusz.dziedzic at gmail.com>
---
 tests/hwsim/remotehost.py | 10 +++++-----
 tests/hwsim/wlantest.py   |  4 ++--
 tests/remote/monitor.py   |  4 ++--
 tests/remote/rutils.py    | 14 +++++++-------
 4 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/tests/hwsim/remotehost.py b/tests/hwsim/remotehost.py
index dec1ad5a8..b4b837187 100644
--- a/tests/hwsim/remotehost.py
+++ b/tests/hwsim/remotehost.py
@@ -99,7 +99,7 @@ class Host():
         return status, buf.decode()
 
     # async execute
-    def execute_run(self, command, res, use_reaper=True):
+    def thread_run(self, command, res, use_reaper=True):
         if use_reaper:
             filename = gen_reaper_file("reaper")
             self.send_file(filename, filename)
@@ -113,13 +113,13 @@ class Host():
             cmd = _command
         else:
             cmd = ["ssh", self.user + "@" + self.host, ' '.join(_command)]
-        _cmd = self.name + " execute_run: " + ' '.join(cmd)
+        _cmd = self.name + " thread_run: " + ' '.join(cmd)
         logger.debug(_cmd)
         t = threading.Thread(target=execute_thread, name=filename, args=(cmd, res))
         t.start()
         return t
 
-    def execute_stop(self, t):
+    def thread_stop(self, t):
         if t.name.find("reaper") == -1:
             raise Exception("use_reaper required")
 
@@ -148,13 +148,13 @@ class Host():
         self.execute(["rm", pid_file])
         self.execute(["rm", t.name])
 
-    def wait_execute_complete(self, t, wait=None):
+    def thread_wait(self, t, wait=None):
         if wait == None:
             wait_str = "infinite"
         else:
             wait_str = str(wait) + "s"
 
-        logger.debug(self.name + " wait_execute_complete(" + wait_str + "): ")
+        logger.debug(self.name + " thread_wait(" + wait_str + "): ")
         if t.isAlive():
             t.join(wait)
 
diff --git a/tests/hwsim/wlantest.py b/tests/hwsim/wlantest.py
index 6d4343b63..16765d27a 100644
--- a/tests/hwsim/wlantest.py
+++ b/tests/hwsim/wlantest.py
@@ -29,7 +29,7 @@ class Wlantest:
             return
 
         cls.remote_host.execute(["killall", "-9", "wlantest"])
-        cls.remote_host.wait_execute_complete(cls.exe_thread, 5)
+        cls.remote_host.thread_wait(cls.exe_thread, 5)
         cls.exe_thread = None
         cls.exe_res = []
 
@@ -64,7 +64,7 @@ class Wlantest:
                                                     pcap_file, log_file)
         cls.remote_host.add_log(log_file)
         cls.remote_host.add_log(pcap_file)
-        cls.exe_thread = cls.remote_host.execute_run(cmd.split(), cls.exe_res)
+        cls.exe_thread = cls.remote_host.thread_run(cmd.split(), cls.exe_res)
         # Give wlantest a chance to start working
         time.sleep(1)
 
diff --git a/tests/remote/monitor.py b/tests/remote/monitor.py
index 5bd801c61..0f77d500b 100644
--- a/tests/remote/monitor.py
+++ b/tests/remote/monitor.py
@@ -110,7 +110,7 @@ def run(host, setup_params):
 
     log = log_dir + tc_name + "_" + host.name + log_monitor + ".pcap"
     host.add_log(log)
-    thread = host.execute_run([tshark, "-w", log], monitor_res)
+    thread = host.thread_run([tshark, "-w", log], monitor_res)
     host.thread = thread
 
 
@@ -122,7 +122,7 @@ def stop(host):
     if host.thread is None:
         return
 
-    host.execute_stop(host.thread)
+    host.thread_stop(host.thread)
     host.thread = None
 
 # Add monitor to existing interface
diff --git a/tests/remote/rutils.py b/tests/remote/rutils.py
index e80901b50..0585480a2 100644
--- a/tests/remote/rutils.py
+++ b/tests/remote/rutils.py
@@ -342,11 +342,11 @@ def ping_run(host, ip, result, ifname=None, addr_type="ipv4", deadline="5", qos=
 
     flush_arp_cache(host)
 
-    thread = host.execute_run(ping, result)
+    thread = host.thread_run(ping, result)
     return thread
 
 def ping_wait(host, thread, timeout=None):
-    host.wait_execute_complete(thread, timeout)
+    host.thread_wait(thread, timeout)
     if thread.isAlive():
         raise Exception("ping thread still alive")
 
@@ -496,23 +496,23 @@ def iperf_run(server, client, server_ip, client_res, server_res,
     flush_arp_cache(server)
     flush_arp_cache(client)
 
-    server_thread = server.execute_run(iperf_server, server_res)
+    server_thread = server.thread_run(iperf_server, server_res)
     time.sleep(1)
-    client_thread = client.execute_run(iperf_client, client_res)
+    client_thread = client.thread_run(iperf_client, client_res)
 
     return server_thread, client_thread
 
 def iperf_wait(server, client, server_thread, client_thread, timeout=None, iperf="iperf"):
-    client.wait_execute_complete(client_thread, timeout)
+    client.thread_wait(client_thread, timeout)
     if client_thread.isAlive():
         raise Exception("iperf client thread still alive")
 
-    server.wait_execute_complete(server_thread, 5)
+    server.thread_wait(server_thread, 5)
     if server_thread.isAlive():
         server.execute(["killall", "-s", "INT", iperf])
         time.sleep(1)
 
-    server.wait_execute_complete(server_thread, 5)
+    server.thread_wait(server_thread, 5)
     if server_thread.isAlive():
         raise Exception("iperf server thread still alive")
 
-- 
2.25.1




More information about the Hostap mailing list