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

auto-t: add clear_events() to IWD class

The wait_for_event() function allows past events to cause this
function to return immediately. This behavior is known, and
relied on for some tests. But in some cases you want to only
handle _new_ events, so we need a way to clear out prior events.
This commit is contained in:
James Prestwood 2024-07-18 04:45:11 -07:00 committed by Denis Kenzior
parent d2cda84383
commit d27de1b111

View File

@ -299,6 +299,9 @@ class StationDebug(IWDDBusAbstract):
return False return False
def clear_events(self):
self._events = []
def wait_for_event(self, event, timeout=10): def wait_for_event(self, event, timeout=10):
return ctx.non_block_wait(self._poll_event, timeout, event, return ctx.non_block_wait(self._poll_event, timeout, event,
exception=TimeoutError("waiting for event")) exception=TimeoutError("waiting for event"))
@ -859,6 +862,9 @@ class Device(IWDDBusAbstract):
def wait_for_event(self, event, timeout=10): def wait_for_event(self, event, timeout=10):
self._station_debug.wait_for_event(event, timeout) self._station_debug.wait_for_event(event, timeout)
def clear_events(self):
self._station_debug.clear_events()
def event_ocurred(self, event): def event_ocurred(self, event):
return self._station_debug.event_ocurred(event) return self._station_debug.event_ocurred(event)