Skip to contentSkip to conversation

auto-t: wait for mode change to finish on stop_ap

PATCH Applied James Prestwood 2 participants 4 messages Oct 23, 2020 – Oct 26, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 auto-t: wait for mode change to finish on stop_ap

---
 autotests/util/iwd.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
autotests/util/iwd.py +4 -1
index 9bfc8c1a..c65dd4a2 100755
@@ -481,7 +481,10 @@ class Device(IWDDBusAbstract):
         self._wait_for_async_op()
 
     def stop_ap(self):
-        self._prop_proxy.Set(IWD_DEVICE_INTERFACE, 'Mode', 'station')
+        self._prop_proxy.Set(IWD_DEVICE_INTERFACE, 'Mode', 'station',
+                                reply_handler=self._success,
+                                error_handler=self._failure)
+        self._wait_for_async_op()
 
     def connect_hidden_network(self, name):
         '''Connect to a hidden network
Signature · 1 line
2.26.2
#1 lore raw

PATCH 2/2 auto-t: only return expected number from list_devices

If the caller specifies the number of devices only return that many. Some sub-tests may only need a subset of the total number of devices for the test. If the number of devices expected is less than the total being returned, python would throw an exception.

---
 autotests/util/iwd.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
autotests/util/iwd.py +1 -1
index c65dd4a2..b557c17f 100755
@@ -1085,7 +1085,7 @@ class IWD(AsyncOpAbstract):
             if not self._wait_timed_out:
                 GLib.source_remove(timeout)
 
-        return list(self._devices.values() if not p2p else self._devices.p2p_dict.values())
+        return list(self._devices.values() if not p2p else self._devices.p2p_dict.values())[:wait_to_appear]
 
     def list_p2p_devices(self, *args, **kwargs):
         return self.list_devices(*args, **kwargs, p2p=True)
Signature · 1 line
2.26.2
#2 lore raw

Re: [PATCH 2/2] auto-t: only return expected number from list_devices

Hi James,

Quoted 8 lines · James Prestwood

If the caller specifies the number of devices only return that many. Some sub-tests may only need a subset of the total number of devices for the test. If the number of devices expected is less than the total being returned, python would throw an exception.

---
  autotests/util/iwd.py | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks.

Regards,
-Denis

#3 lore raw
In reply to James Prestwood

You can leave this patch out actually. Andrew pointed out that any DBus method call is synchronous if the reply handlers are left out. But patch 2/2 is still needed.

Quoted 22 lines · James Prestwood
---
 autotests/util/iwd.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
autotests/util/iwd.py +4 -1
index 9bfc8c1a..c65dd4a2 100755
@@ -481,7 +481,10 @@ class Device(IWDDBusAbstract):
         self._wait_for_async_op()
 
     def stop_ap(self):
-        self._prop_proxy.Set(IWD_DEVICE_INTERFACE, 'Mode',
 'station')
+        self._prop_proxy.Set(IWD_DEVICE_INTERFACE, 'Mode',
 'station',
+                                reply_handler=self._success,
+                                error_handler=self._failure)
+        self._wait_for_async_op()
 

def connect_hidden_network(self, name):
'''Connect to a hidden network