3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-26 02:19:26 +01:00

autotests: Add IWD.wait utility for sleeping inside tests

This commit is contained in:
Andrew Zaborowski 2017-05-14 04:10:06 +02:00 committed by Denis Kenzior
parent b1d0dbc3e4
commit 920e79b32c

View File

@ -589,6 +589,17 @@ class IWD(AsyncOpAbstract):
+ str(max_wait) + ' sec') + str(max_wait) + ' sec')
GLib.source_remove(timeout) GLib.source_remove(timeout)
def wait(self, time):
self._wait_timed_out = False
def wait_timeout_cb():
self._wait_timed_out = True
return False
GLib.timeout_add(int(time * 1000), wait_timeout_cb)
context = mainloop.get_context()
while not self._wait_timed_out:
context.iteration(may_block=True)
@staticmethod @staticmethod
def clear_storage(): def clear_storage():
os.system('rm -rf ' + IWD_STORAGE_DIR + '/*') os.system('rm -rf ' + IWD_STORAGE_DIR + '/*')