eiwd

no dbus iwd with iwctl functionality
git clone https://git.daat.foo/repos/eiwd.git
Log | Files | Refs | Submodules | README | LICENSE

commit 5e631b4e389e4543b72cffa4285c3f286ba9cb2f
parent 944e0b5e232c0d6aac7284c7c36dc7133e3d5fe8
Author: James Prestwood <prestwoj@gmail.com>
Date:   Mon, 25 Jan 2021 10:05:28 -0800

auto-t: fix wait_for_object_condition

After the re-write this was broken and not noticed until
recently. The issue appeared to be that the GLib timeout
callback retained no context of local variables. Previously
_wait_timed_out was set as a class variable, but this was
removed so multiple IWD instances could work. Without
_wait_timed_out being a class variable the GLib timeout
setting it had no effect on the wait loop.

To fix this we can set _wait_timed_out on the object being
passed in. This is preserved in the GLib timeout callback
and setting it gets honored in the wait loop.

Diffstat:
Mautotests/util/iwd.py | 9+++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/autotests/util/iwd.py b/autotests/util/iwd.py @@ -1009,9 +1009,10 @@ class IWD(AsyncOpAbstract): @staticmethod def _wait_for_object_condition(obj, condition_str, max_wait = 50): - _wait_timed_out = False + obj._wait_timed_out = False + def wait_timeout_cb(): - _wait_timed_out = True + obj._wait_timed_out = True return False try: @@ -1019,12 +1020,12 @@ class IWD(AsyncOpAbstract): context = ctx.mainloop.get_context() while not eval(condition_str): context.iteration(may_block=True) - if _wait_timed_out and ctx.args.gdb == None: + if obj._wait_timed_out and ctx.args.gdb == None: raise TimeoutError('[' + condition_str + ']'\ ' condition was not met in '\ + str(max_wait) + ' sec') finally: - if not _wait_timed_out: + if not obj._wait_timed_out: GLib.source_remove(timeout) def wait_for_object_condition(self, *args, **kwargs):