All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] auto-t: return None with get_ordered_network(s)
@ 2019-10-28 19:51 James Prestwood
  2019-10-28 19:52 ` [PATCH 2/3] auto-t: fix random failures in testEAP-MSCHAPV2 James Prestwood
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: James Prestwood @ 2019-10-28 19:51 UTC (permalink / raw)
  To: iwd

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

If no networks are found, return None rather than an empty
array. This is easier to check by the caller (and was assumed
in some cases). Also add an exception to get_ordered_network
if no network is found.
---
 autotests/util/iwd.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/autotests/util/iwd.py b/autotests/util/iwd.py
index 3ba5112c..35e5a693 100755
--- a/autotests/util/iwd.py
+++ b/autotests/util/iwd.py
@@ -376,6 +376,10 @@ class Device(IWDDBusAbstract):
         for bus_obj in self._station.GetOrderedNetworks():
             ordered_network = OrderedNetwork(bus_obj)
             ordered_networks.append(ordered_network)
+
+        if len(ordered_networks) == 0:
+            return None
+
         return ordered_networks
 
     def get_ordered_network(self, network):
@@ -385,6 +389,9 @@ class Device(IWDDBusAbstract):
         '''
         ordered_networks = self.get_ordered_networks()
 
+        if not ordered_networks:
+            raise Exception('Network %s not found' % network)
+
         for n in ordered_networks:
             if n.name == network:
                 return n
-- 
2.17.1

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

* [PATCH 2/3] auto-t: fix random failures in testEAP-MSCHAPV2
  2019-10-28 19:51 [PATCH 1/3] auto-t: return None with get_ordered_network(s) James Prestwood
@ 2019-10-28 19:52 ` James Prestwood
  2019-10-28 19:52 ` [PATCH 3/3] auto-t: update testEAP-TLS to use HostapdCLI James Prestwood
  2019-10-28 20:01 ` [PATCH 1/3] auto-t: return None with get_ordered_network(s) Denis Kenzior
  2 siblings, 0 replies; 4+ messages in thread
From: James Prestwood @ 2019-10-28 19:52 UTC (permalink / raw)
  To: iwd

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

Its difficult to know 100%, but this random test failures appeared
to be caused by two issues. One was that get_ordered_network is being
checked for None, when it was returning a zero length array. Because
of this the scanning block was never executed in any cases. This was
fixed in the previous commit. The other issue was the disconnect at
the start of the tests. The disconnect will cause all pending scans
to cancel, which appeared to cause the scanning block below to be
skipped over quickly if the timing was right. Then, afterwards,
getting a single network failed because scanning was not complete.
---
 autotests/testEAP-MSCHAPV2/connection_test.py | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/autotests/testEAP-MSCHAPV2/connection_test.py b/autotests/testEAP-MSCHAPV2/connection_test.py
index d38f4b09..35926375 100644
--- a/autotests/testEAP-MSCHAPV2/connection_test.py
+++ b/autotests/testEAP-MSCHAPV2/connection_test.py
@@ -19,11 +19,6 @@ class Test(unittest.TestCase):
         devices = wd.list_devices(1)
         device = devices[0]
 
-        try:
-            device.disconnect()
-        except:
-            pass
-
         condition = 'not obj.scanning'
         wd.wait_for_object_condition(device, condition)
 
-- 
2.17.1

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

* [PATCH 3/3] auto-t: update testEAP-TLS to use HostapdCLI
  2019-10-28 19:51 [PATCH 1/3] auto-t: return None with get_ordered_network(s) James Prestwood
  2019-10-28 19:52 ` [PATCH 2/3] auto-t: fix random failures in testEAP-MSCHAPV2 James Prestwood
@ 2019-10-28 19:52 ` James Prestwood
  2019-10-28 20:01 ` [PATCH 1/3] auto-t: return None with get_ordered_network(s) Denis Kenzior
  2 siblings, 0 replies; 4+ messages in thread
From: James Prestwood @ 2019-10-28 19:52 UTC (permalink / raw)
  To: iwd

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

This test did not use the updated HostapdCLI where you can specify
a config file rather than iterate hostapd list.
---
 autotests/testEAP-TLS/connection_test.py | 11 +++--------
 autotests/testEAP-TLS/ssidEAP-TLS.conf   |  1 +
 autotests/testEAP-TLS/ssidEAP-TLS2.conf  |  1 +
 autotests/testEAP-TLS/ssidEAP-TLS3.conf  |  1 +
 4 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/autotests/testEAP-TLS/connection_test.py b/autotests/testEAP-TLS/connection_test.py
index 6d82dda7..9b696aa4 100644
--- a/autotests/testEAP-TLS/connection_test.py
+++ b/autotests/testEAP-TLS/connection_test.py
@@ -9,23 +9,18 @@ from iwd import IWD
 from iwd import PSKAgent
 from iwd import NetworkType
 import testutil
-import hostapd
+from hostapd import HostapdCLI
 
 class Test(unittest.TestCase):
 
     def do_test_connection_success(self, ssid, passphrase=None):
+        hapd = HostapdCLI(config=ssid + '.conf')
         wd = IWD()
 
         if passphrase:
             psk_agent = PSKAgent(passphrase)
             wd.register_psk_agent(psk_agent)
 
-        hostapd_ifname = None
-        for ifname in hostapd.hostapd_map:
-            if ssid + '.conf' in hostapd.hostapd_map[ifname].config:
-                hostapd_ifname = ifname
-                break
-
         devices = wd.list_devices(1)
         device = devices[0]
 
@@ -52,7 +47,7 @@ class Test(unittest.TestCase):
         wd.wait_for_object_condition(ordered_network.network_object, condition)
 
         testutil.test_iface_operstate()
-        testutil.test_ifaces_connected(hostapd_ifname, device.name)
+        testutil.test_ifaces_connected(hapd.ifname, device.name)
 
         device.disconnect()
 
diff --git a/autotests/testEAP-TLS/ssidEAP-TLS.conf b/autotests/testEAP-TLS/ssidEAP-TLS.conf
index e1d7c6b4..b14ea423 100644
--- a/autotests/testEAP-TLS/ssidEAP-TLS.conf
+++ b/autotests/testEAP-TLS/ssidEAP-TLS.conf
@@ -1,3 +1,4 @@
+ctrl_interface=/var/run/hostapd
 hw_mode=g
 channel=1
 ssid=ssidEAP-TLS
diff --git a/autotests/testEAP-TLS/ssidEAP-TLS2.conf b/autotests/testEAP-TLS/ssidEAP-TLS2.conf
index ebb0f36b..6a811deb 100644
--- a/autotests/testEAP-TLS/ssidEAP-TLS2.conf
+++ b/autotests/testEAP-TLS/ssidEAP-TLS2.conf
@@ -1,3 +1,4 @@
+ctrl_interface=/var/run/hostapd
 hw_mode=g
 channel=2
 ssid=ssidEAP-TLS2
diff --git a/autotests/testEAP-TLS/ssidEAP-TLS3.conf b/autotests/testEAP-TLS/ssidEAP-TLS3.conf
index ebbeab13..3a5f70bf 100644
--- a/autotests/testEAP-TLS/ssidEAP-TLS3.conf
+++ b/autotests/testEAP-TLS/ssidEAP-TLS3.conf
@@ -1,3 +1,4 @@
+ctrl_interface=/var/run/hostapd
 hw_mode=g
 channel=3
 ssid=ssidEAP-TLS3
-- 
2.17.1

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

* Re: [PATCH 1/3] auto-t: return None with get_ordered_network(s)
  2019-10-28 19:51 [PATCH 1/3] auto-t: return None with get_ordered_network(s) James Prestwood
  2019-10-28 19:52 ` [PATCH 2/3] auto-t: fix random failures in testEAP-MSCHAPV2 James Prestwood
  2019-10-28 19:52 ` [PATCH 3/3] auto-t: update testEAP-TLS to use HostapdCLI James Prestwood
@ 2019-10-28 20:01 ` Denis Kenzior
  2 siblings, 0 replies; 4+ messages in thread
From: Denis Kenzior @ 2019-10-28 20:01 UTC (permalink / raw)
  To: iwd

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

Hi James,

On 10/28/19 2:51 PM, James Prestwood wrote:
> If no networks are found, return None rather than an empty
> array. This is easier to check by the caller (and was assumed
> in some cases). Also add an exception to get_ordered_network
> if no network is found.
> ---
>   autotests/util/iwd.py | 7 +++++++
>   1 file changed, 7 insertions(+)
> 

All applied, thanks.

Regards,
-Denis

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

end of thread, other threads:[~2019-10-28 20:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-28 19:51 [PATCH 1/3] auto-t: return None with get_ordered_network(s) James Prestwood
2019-10-28 19:52 ` [PATCH 2/3] auto-t: fix random failures in testEAP-MSCHAPV2 James Prestwood
2019-10-28 19:52 ` [PATCH 3/3] auto-t: update testEAP-TLS to use HostapdCLI James Prestwood
2019-10-28 20:01 ` [PATCH 1/3] auto-t: return None with get_ordered_network(s) 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.