3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-25 09:39:25 +01:00

test-runner: fix start_dbus and clean up config

start_dbus was not returning the Process class which was
expected by the caller. This resulted in the config not
being cleaned up.
This commit is contained in:
James Prestwood 2021-02-18 12:19:33 -08:00 committed by Denis Kenzior
parent 4682c22ece
commit 90b695cfdf

View File

@ -553,7 +553,7 @@ class Namespace:
self.stop_process(p) self.stop_process(p)
if self.dbus_pid and not self.dbus_pid.multi_test: if self.dbus_pid and not self.dbus_pid.multi_test:
os.remove(self.dbus_address.split('=')[1]) os.remove(self.dbus_cfg)
def __del__(self): def __del__(self):
print("Removing namespace %s" % self.name) print("Removing namespace %s" % self.name)
@ -598,21 +598,23 @@ class Namespace:
global dbus_count global dbus_count
self.dbus_address = 'unix:path=/tmp/dbus%d' % dbus_count self.dbus_address = 'unix:path=/tmp/dbus%d' % dbus_count
dbus_cfg = '/tmp/dbus%d.conf' % dbus_count self.dbus_cfg = '/tmp/dbus%d.conf' % dbus_count
dbus_count += 1 dbus_count += 1
with open(dbus_cfg, 'w+') as f: with open(self.dbus_cfg, 'w+') as f:
f.write(dbus_config) f.write(dbus_config)
f.write('<listen>%s</listen>\n' % self.dbus_address) f.write('<listen>%s</listen>\n' % self.dbus_address)
f.write('</busconfig>\n') f.write('</busconfig>\n')
p = self.start_process(['dbus-daemon', '--config-file=%s' % dbus_cfg], p = self.start_process(['dbus-daemon', '--config-file=%s' % self.dbus_cfg],
wait=False, multi_test=multi_test) wait=False, multi_test=multi_test)
p.wait_for_socket(self.dbus_address.split('=')[1], wait=5) p.wait_for_socket(self.dbus_address.split('=')[1], wait=5)
self._bus = dbus.bus.BusConnection(address_or_type=self.dbus_address) self._bus = dbus.bus.BusConnection(address_or_type=self.dbus_address)
return p
def start_iwd(self, config_dir = '/tmp', storage_dir = '/tmp/iwd'): def start_iwd(self, config_dir = '/tmp', storage_dir = '/tmp/iwd'):
args = [] args = []
iwd_radios = ','.join([r.name for r in self.radios if r.use == 'iwd']) iwd_radios = ','.join([r.name for r in self.radios if r.use == 'iwd'])