All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] auto-t: scan as many times as needed to find networks
@ 2021-08-18 17:46 James Prestwood
  2021-08-18 21:56 ` Denis Kenzior
  0 siblings, 1 reply; 2+ messages in thread
From: James Prestwood @ 2021-08-18 17:46 UTC (permalink / raw
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 1853 bytes --]

Certain autotests coupled with slower test machines can result in lost
beacons and "Network not found" errors. In attempt to help with this
the test can just rescan (30 seconds max) until the network is found.
---
 autotests/util/iwd.py | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/autotests/util/iwd.py b/autotests/util/iwd.py
index 54157b00..730659ac 100755
--- a/autotests/util/iwd.py
+++ b/autotests/util/iwd.py
@@ -489,16 +489,24 @@ class Device(IWDDBusAbstract):
            network wasn't found. If the network is not found an exception is
            raised, this removes the need to extra asserts in autotests.
         '''
-        ordered_networks = self.get_ordered_networks(scan_if_needed)
+        def wait_for_network(self, network, scan_if_needed):
+            networks = self.get_ordered_networks(scan_if_needed)
 
-        if not ordered_networks:
-            raise Exception('Network %s not found' % network)
+            if not networks:
+                # No point in continuing if we aren't going to re-scan
+                if not scan_if_needed:
+                    raise Exception("Network %s not found" % network)
 
-        for n in ordered_networks:
-            if n.name == network:
-                return n
+                return False
 
-        raise Exception('Network %s not found' % network)
+            for n in networks:
+                if n.name == network:
+                    return n
+
+            return False
+
+        return ctx.non_block_wait(wait_for_network, 30, self, network, scan_if_needed,
+                                    exception=Exception("Network %s not found" % network))
 
     def wps_push_button(self):
         self._wps_manager.PushButton(dbus_interface=IWD_WSC_INTERFACE,
-- 
2.31.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] auto-t: scan as many times as needed to find networks
  2021-08-18 17:46 [PATCH] auto-t: scan as many times as needed to find networks James Prestwood
@ 2021-08-18 21:56 ` Denis Kenzior
  0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2021-08-18 21:56 UTC (permalink / raw
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 437 bytes --]

Hi James,

On 8/18/21 12:46 PM, James Prestwood wrote:
> Certain autotests coupled with slower test machines can result in lost
> beacons and "Network not found" errors. In attempt to help with this
> the test can just rescan (30 seconds max) until the network is found.
> ---
>   autotests/util/iwd.py | 22 +++++++++++++++-------
>   1 file changed, 15 insertions(+), 7 deletions(-)
> 

Applied, thanks.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-18 21:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-18 17:46 [PATCH] auto-t: scan as many times as needed to find networks James Prestwood
2021-08-18 21:56 ` Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.