diff mbox series

[5/9] tests: remote: stop supp/hostapd using pidfile

Message ID 20200926112700.6055-5-janusz.dziedzic@gmail.com
State Accepted
Headers show
Series [1/9] tests: remote: sort tests correctly | expand

Commit Message

Janusz Dziedzic Sept. 26, 2020, 11:26 a.m. UTC
Instead of killall, use pidfile.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@gmail.com>
---
 tests/remote/rutils.py | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/tests/remote/rutils.py b/tests/remote/rutils.py
index 0acef42d1..e80901b50 100644
--- a/tests/remote/rutils.py
+++ b/tests/remote/rutils.py
@@ -117,7 +117,8 @@  def run_hostapd(host, setup_params):
 
     if log_file:
         host.add_log(log_file)
-    status, buf = host.execute([setup_params['hostapd'], "-B", "-ddt", "-g", "udp:" + host.port, log])
+    pidfile = setup_params['log_dir'] + "hostapd_" + host.ifname + "_" + setup_params['tc_name'] + ".pid"
+    status, buf = host.execute([setup_params['hostapd'], "-B", "-ddt", "-g", "udp:" + host.port, "-P", pidfile, log])
     if status != 0:
         raise Exception("Could not run hostapd: " + buf)
 
@@ -134,15 +135,18 @@  def run_wpasupplicant(host, setup_params):
 
     if log_file:
         host.add_log(log_file)
-    status, buf = host.execute([setup_params['wpa_supplicant'], "-B", "-ddt", "-g", "udp:" + host.port, log])
+    pidfile = setup_params['log_dir'] + "wpa_supplicant_" + host.ifname + "_" + setup_params['tc_name'] + ".pid"
+    status, buf = host.execute([setup_params['wpa_supplicant'], "-B", "-ddt", "-g", "udp:" + host.port, "-P", pidfile, log])
     if status != 0:
         raise Exception("Could not run wpa_supplicant: " + buf)
 
 def kill_wpasupplicant(host, setup_params):
-    host.execute(['killall', setup_params['wpa_supplicant']])
+    pidfile = setup_params['log_dir'] + "wpa_supplicant_" + host.ifname + "_" + setup_params['tc_name'] + ".pid"
+    host.execute(["kill `cat " + pidfile + "`"])
 
 def kill_hostapd(host, setup_params):
-    host.execute(['killall', setup_params['hostapd']])
+    pidfile = setup_params['log_dir'] + "hostapd_" + host.ifname + "_" + setup_params['tc_name'] + ".pid"
+    host.execute(["kill `cat " + pidfile + "`"])
 
 def get_ap_params(channel="1", bw="HT20", country="US", security="open", ht_capab=None, vht_capab=None):
     ssid = "test_" + channel + "_" + security + "_" + bw