mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-22 06:29:23 +01:00
test-runner: use cleanup() for start_dbus
Use a cleanup routine to remove the dbus_address/dbus_cfg files
This commit is contained in:
parent
11f0abebe6
commit
8f33926a75
@ -615,7 +615,15 @@ class Namespace:
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def start_dbus(self, multi_test=True):
|
def _cleanup_dbus(self):
|
||||||
|
try:
|
||||||
|
os.remove(self.dbus_address.split('=')[1])
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
os.remove(self.dbus_cfg)
|
||||||
|
|
||||||
|
def start_dbus(self):
|
||||||
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
|
||||||
@ -628,7 +636,7 @@ class Namespace:
|
|||||||
f.write('</busconfig>\n')
|
f.write('</busconfig>\n')
|
||||||
|
|
||||||
p = self.start_process(['dbus-daemon', '--config-file=%s' % self.dbus_cfg],
|
p = self.start_process(['dbus-daemon', '--config-file=%s' % self.dbus_cfg],
|
||||||
wait=False)
|
wait=False, cleanup=self._cleanup_dbus)
|
||||||
|
|
||||||
p.wait_for_socket(self.dbus_address.split('=')[1], wait=5)
|
p.wait_for_socket(self.dbus_address.split('=')[1], wait=5)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user