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: clean up dbus path file properly

Dbus should be started as a multi-test process from the
TestContext, which leaves the dbus address file around for
the full test run. For Namespaces dbus-daemon should be
closed when the Namespace closes.
This commit is contained in:
James Prestwood 2021-02-08 09:53:59 -08:00 committed by Denis Kenzior
parent fb217479d2
commit af8438878f

View File

@ -474,6 +474,7 @@ class Namespace:
dbus_address = None dbus_address = None
processes = [] processes = []
radios = [] radios = []
dbus_pid = None
def __init__(self, args, name, radios): def __init__(self, args, name, radios):
self.name = name self.name = name
@ -484,7 +485,7 @@ class Namespace:
for r in radios: for r in radios:
Process(['iw', 'phy', r.name, 'set', 'netns', 'name', name], wait=True) Process(['iw', 'phy', r.name, 'set', 'netns', 'name', name], wait=True)
self.start_dbus(multi_test=False) self.dbus_pid = self.start_dbus(multi_test=False)
def reset(self): def reset(self):
self.radios = [] self.radios = []
@ -497,7 +498,8 @@ class Namespace:
print("Killing process %s" % p.name) print("Killing process %s" % p.name)
self.stop_process(p) self.stop_process(p)
os.remove(self.dbus_address.split('=')[1]) if self.dbus_pid and not self.dbus_pid.multi_test:
os.remove(self.dbus_address.split('=')[1])
def __del__(self): def __del__(self):
print("Removing namespace %s" % self.name) print("Removing namespace %s" % self.name)
@ -1119,7 +1121,7 @@ def print_results(results):
def run_auto_tests(ctx, args): def run_auto_tests(ctx, args):
tests = build_test_list(args) tests = build_test_list(args)
ctx.start_dbus() ctx.start_dbus(multi_test=True)
ctx.start_haveged() ctx.start_haveged()
# Copy autotests/misc/{certs,secrets,phonesim} so any test can refer to them # Copy autotests/misc/{certs,secrets,phonesim} so any test can refer to them