All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 1/3] auto-t: Use proper connection status indicator
@ 2020-04-14  1:16 Tim Kourt
  2020-04-14  1:16 ` [PATCH v3 2/3] auto-t: Remove unused imports Tim Kourt
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Tim Kourt @ 2020-04-14  1:16 UTC (permalink / raw)
  To: iwd

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

'Connected' property of the network object is set before the connection
attempt is made and does not indicate a connection success. Therefore,
use device status property to identify the connection status of the device.
---
 autotests/testHotspot/autoconnect_test.py | 30 +++++++++++++-----------------
 1 file changed, 13 insertions(+), 17 deletions(-)

diff --git a/autotests/testHotspot/autoconnect_test.py b/autotests/testHotspot/autoconnect_test.py
index 36ba92bf..936373f1 100644
--- a/autotests/testHotspot/autoconnect_test.py
+++ b/autotests/testHotspot/autoconnect_test.py
@@ -40,10 +40,8 @@ class Test(unittest.TestCase):
         # while there are hotspot networks in range. This should result in
         # autoconnect *after* ANQP is performed
         #
-        condition = 'obj.connected'
-        wd.wait_for_object_condition(wpa_network.network_object, condition)
-
-        sleep(2)
+        condition = 'obj.state == DeviceState.connected'
+        wd.wait_for_object_condition(device, condition)
 
         testutil.test_iface_operstate()
         testutil.test_ifaces_connected(device.name, hapd_wpa.ifname)
@@ -53,10 +51,10 @@ class Test(unittest.TestCase):
         #
         os.remove("/var/lib/iwd/ssidWPA2-1.psk")
 
-        self.assertEqual(len(wd.list_known_networks()), 1)
+        condition = 'obj.state == DeviceState.disconnected'
+        wd.wait_for_object_condition(device, condition)
 
-        condition = 'not obj.connected'
-        wd.wait_for_object_condition(wpa_network.network_object, condition)
+        self.assertEqual(len(wd.list_known_networks()), 1)
 
         condition = 'obj.scanning'
         wd.wait_for_object_condition(device, condition)
@@ -71,10 +69,8 @@ class Test(unittest.TestCase):
         # Since there are no other provisioned networks, we should do ANQP and
         # autoconnect to the hotspot network.
         #
-        condition = 'obj.connected'
-        wd.wait_for_object_condition(hotspot_network.network_object, condition)
-
-        sleep(2)
+        condition = 'obj.state == DeviceState.connected'
+        wd.wait_for_object_condition(device, condition)
 
         testutil.test_iface_operstate()
         testutil.test_ifaces_connected(device.name, hapd_hotspot.ifname)
@@ -87,8 +83,8 @@ class Test(unittest.TestCase):
         #
         # make sure removal of hotspot conf file resulted in disconnect
         #
-        condition = 'not obj.connected'
-        wd.wait_for_object_condition(wpa_network.network_object, condition)
+        condition = 'obj.state == DeviceState.disconnected'
+        wd.wait_for_object_condition(device, condition)
 
         condition = 'obj.scanning'
         wd.wait_for_object_condition(device, condition)
@@ -99,14 +95,14 @@ class Test(unittest.TestCase):
         hotspot_network = device.get_ordered_network("ssidWPA2-1")
         self.assertEqual(hotspot_network.type, NetworkType.psk)
 
-        condition = 'obj.connected'
-        wd.wait_for_object_condition(hotspot_network.network_object, condition)
-
-        sleep(2)
+        condition = 'obj.state == DeviceState.connected'
+        wd.wait_for_object_condition(device, condition)
 
         testutil.test_iface_operstate()
         testutil.test_ifaces_connected(device.name, hapd_wpa.ifname)
 
+        device.disconnect()
+
     @classmethod
     def setUpClass(cls):
         IWD.copy_to_hotspot('autoconnect.conf')
-- 
2.13.6

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

* [PATCH v3 2/3] auto-t: Remove unused imports
  2020-04-14  1:16 [PATCH v3 1/3] auto-t: Use proper connection status indicator Tim Kourt
@ 2020-04-14  1:16 ` Tim Kourt
  2020-04-14  1:16 ` [PATCH v3 3/3] auto-t: Fix event order Tim Kourt
  2020-04-14 16:21 ` [PATCH v3 1/3] auto-t: Use proper connection status indicator Denis Kenzior
  2 siblings, 0 replies; 4+ messages in thread
From: Tim Kourt @ 2020-04-14  1:16 UTC (permalink / raw)
  To: iwd

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

---
 autotests/testAdHoc/adhoc_test.py         | 1 -
 autotests/testFILS/fils_256_test.py       | 2 --
 autotests/testFILS/fils_384_test.py       | 2 --
 autotests/testHotspot/autoconnect_test.py | 2 --
 4 files changed, 7 deletions(-)

diff --git a/autotests/testAdHoc/adhoc_test.py b/autotests/testAdHoc/adhoc_test.py
index 83c99fe5..119c6c7e 100644
--- a/autotests/testAdHoc/adhoc_test.py
+++ b/autotests/testAdHoc/adhoc_test.py
@@ -3,7 +3,6 @@
 import unittest
 import sys
 import time
-from time import sleep
 
 sys.path.append('../util')
 import iwd
diff --git a/autotests/testFILS/fils_256_test.py b/autotests/testFILS/fils_256_test.py
index 1894c074..aa9e441d 100644
--- a/autotests/testFILS/fils_256_test.py
+++ b/autotests/testFILS/fils_256_test.py
@@ -4,8 +4,6 @@ import unittest
 import sys
 import os
 
-from time import sleep
-
 sys.path.append('../util')
 import iwd
 from iwd import IWD
diff --git a/autotests/testFILS/fils_384_test.py b/autotests/testFILS/fils_384_test.py
index 09ff0b21..ed5cc3b0 100644
--- a/autotests/testFILS/fils_384_test.py
+++ b/autotests/testFILS/fils_384_test.py
@@ -4,8 +4,6 @@ import unittest
 import sys
 import os
 
-from time import sleep
-
 sys.path.append('../util')
 import iwd
 from iwd import IWD
diff --git a/autotests/testHotspot/autoconnect_test.py b/autotests/testHotspot/autoconnect_test.py
index 936373f1..edefb296 100644
--- a/autotests/testHotspot/autoconnect_test.py
+++ b/autotests/testHotspot/autoconnect_test.py
@@ -4,8 +4,6 @@ import unittest
 import sys
 import os
 
-from time import sleep
-
 sys.path.append('../util')
 import iwd
 from iwd import IWD
-- 
2.13.6

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

* [PATCH v3 3/3] auto-t: Fix event order
  2020-04-14  1:16 [PATCH v3 1/3] auto-t: Use proper connection status indicator Tim Kourt
  2020-04-14  1:16 ` [PATCH v3 2/3] auto-t: Remove unused imports Tim Kourt
@ 2020-04-14  1:16 ` Tim Kourt
  2020-04-14 16:21 ` [PATCH v3 1/3] auto-t: Use proper connection status indicator Denis Kenzior
  2 siblings, 0 replies; 4+ messages in thread
From: Tim Kourt @ 2020-04-14  1:16 UTC (permalink / raw)
  To: iwd

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

In addition, use the conditional wait for the expected number
of known networks
---
 autotests/testHotspot/autoconnect_test.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/autotests/testHotspot/autoconnect_test.py b/autotests/testHotspot/autoconnect_test.py
index edefb296..252a4b92 100644
--- a/autotests/testHotspot/autoconnect_test.py
+++ b/autotests/testHotspot/autoconnect_test.py
@@ -52,7 +52,8 @@ class Test(unittest.TestCase):
         condition = 'obj.state == DeviceState.disconnected'
         wd.wait_for_object_condition(device, condition)
 
-        self.assertEqual(len(wd.list_known_networks()), 1)
+        condition = 'len(obj.list_known_networks()) == 1'
+        wd.wait_for_object_condition(wd, condition)
 
         condition = 'obj.scanning'
         wd.wait_for_object_condition(device, condition)
@@ -74,9 +75,6 @@ class Test(unittest.TestCase):
         testutil.test_ifaces_connected(device.name, hapd_hotspot.ifname)
 
         os.remove('/var/lib/iwd/hotspot/autoconnect.conf')
-        IWD.copy_to_storage('ssidWPA2-1.psk')
-
-        self.assertEqual(len(wd.list_known_networks()), 1)
 
         #
         # make sure removal of hotspot conf file resulted in disconnect
@@ -84,6 +82,11 @@ class Test(unittest.TestCase):
         condition = 'obj.state == DeviceState.disconnected'
         wd.wait_for_object_condition(device, condition)
 
+        IWD.copy_to_storage('ssidWPA2-1.psk')
+
+        condition = 'len(obj.list_known_networks()) == 1'
+        wd.wait_for_object_condition(wd, condition)
+
         condition = 'obj.scanning'
         wd.wait_for_object_condition(device, condition)
 
-- 
2.13.6

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

* Re: [PATCH v3 1/3] auto-t: Use proper connection status indicator
  2020-04-14  1:16 [PATCH v3 1/3] auto-t: Use proper connection status indicator Tim Kourt
  2020-04-14  1:16 ` [PATCH v3 2/3] auto-t: Remove unused imports Tim Kourt
  2020-04-14  1:16 ` [PATCH v3 3/3] auto-t: Fix event order Tim Kourt
@ 2020-04-14 16:21 ` Denis Kenzior
  2 siblings, 0 replies; 4+ messages in thread
From: Denis Kenzior @ 2020-04-14 16:21 UTC (permalink / raw)
  To: iwd

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

Hi Tim,

On 4/13/20 8:16 PM, Tim Kourt wrote:
> 'Connected' property of the network object is set before the connection
> attempt is made and does not indicate a connection success. Therefore,
> use device status property to identify the connection status of the device.
> ---
>   autotests/testHotspot/autoconnect_test.py | 30 +++++++++++++-----------------
>   1 file changed, 13 insertions(+), 17 deletions(-)

All applied, thanks.

Regards,
-Denis

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

end of thread, other threads:[~2020-04-14 16:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-14  1:16 [PATCH v3 1/3] auto-t: Use proper connection status indicator Tim Kourt
2020-04-14  1:16 ` [PATCH v3 2/3] auto-t: Remove unused imports Tim Kourt
2020-04-14  1:16 ` [PATCH v3 3/3] auto-t: Fix event order Tim Kourt
2020-04-14 16:21 ` [PATCH v3 1/3] auto-t: Use proper connection status indicator 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.