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

test-runner: fix Namespace class ref problems

The Namespace class was never being removed when tests finished.
This is fixed by unreffing the hwsim internal _radio object which
both cleans up the radio and allows the Namespace to be removed.
This commit is contained in:
James Prestwood 2021-02-25 14:01:03 -08:00 committed by Denis Kenzior
parent d8abc88e4c
commit 73b89555fa

View File

@ -565,11 +565,9 @@ class Hostapd:
dbus_count = 0
class Namespace:
dbus_address = None
processes = []
radios = []
def __init__(self, args, name, radios):
self.dbus_address = None
self.processes = []
self.name = name
self.radios = radios
self.args = args
@ -581,9 +579,13 @@ class Namespace:
self.start_dbus()
def reset(self):
self.radios = []
self._bus = None
for r in self.radios:
r._radio = None
self.radios = []
if self.name == "root":
self._bus = dbus.bus.BusConnection(address_or_type=self.dbus_address)
@ -595,7 +597,6 @@ class Namespace:
def __del__(self):
print("Removing namespace %s" % self.name)
self.reset()
Process(['ip', 'netns', 'del', self.name], wait=True)