From 11f0abebe678a5be59192ce1a034619ac59ff7e1 Mon Sep 17 00:00:00 2001 From: James Prestwood Date: Thu, 25 Feb 2021 14:00:59 -0800 Subject: [PATCH] test-runner: add better Hostapd cleanup There were a few issues with the cleanup of Hostapd. First the process was only being killed, which did not actually remove the process from the list. In addition, with EAP-SIM/AKA tests, hostapd created sim_db unix socket files which it does not clean up. --- tools/test-runner | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tools/test-runner b/tools/test-runner index 62c4bd75..f6d7784d 100755 --- a/tools/test-runner +++ b/tools/test-runner @@ -449,6 +449,8 @@ class Hostapd: process since hostapd can be started with multiple config files. ''' def __init__(self, ctx, radios, configs, radius): + self.ctx = ctx + if len(configs) != len(radios): raise Exception("Config (%d) and radio (%d) list length not equal" % \ (len(configs), len(radios))) @@ -531,7 +533,17 @@ class Hostapd: dbg("Failed to remove %s" % self.global_ctrl_iface) self.instances = None - self.process.kill() + + # Hostapd may have already been stopped + if self.process: + self.ctx.stop_process(self.process) + + self.ctx = None + + # Hostapd creates simdb sockets for EAP-SIM/AKA tests but does not + # clean them up. + for f in glob("/tmp/eap_sim_db*"): + os.remove(f) dbus_count = 0