All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 09/13] auto-t: use wait_for_event in testPSK-roam
@ 2022-03-28 17:28 James Prestwood
  0 siblings, 0 replies; only message in thread
From: James Prestwood @ 2022-03-28 17:28 UTC (permalink / raw)
  To: iwd

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

Depending on timing hostapd may not show a station with list_sta()
Instead use wait_for_event
---
 autotests/testPSK-roam/connection_test.py | 29 ++++-------------------
 1 file changed, 4 insertions(+), 25 deletions(-)

diff --git a/autotests/testPSK-roam/connection_test.py b/autotests/testPSK-roam/connection_test.py
index 92fdeb04..f1b43130 100644
--- a/autotests/testPSK-roam/connection_test.py
+++ b/autotests/testPSK-roam/connection_test.py
@@ -16,20 +16,7 @@ class Test(unittest.TestCase):
     def validate_connection(self, wd, over_ds=False):
         device = wd.list_devices(1)[0]
 
-        condition = 'not obj.scanning'
-        wd.wait_for_object_condition(device, condition)
-
-        # Scanning is unavoidable in this case since several hostapd
-        # configurations are tested and changed mid-test
-        device.scan()
-
-        condition = 'obj.scanning'
-        wd.wait_for_object_condition(device, condition)
-
-        condition = 'not obj.scanning'
-        wd.wait_for_object_condition(device, condition)
-
-        ordered_network = device.get_ordered_network('TestFT')
+        ordered_network = device.get_ordered_network('TestFT', full_scan=True)
 
         self.assertEqual(ordered_network.type, NetworkType.psk)
 
@@ -44,15 +31,7 @@ class Test(unittest.TestCase):
         condition = 'obj.state == DeviceState.connected'
         wd.wait_for_object_condition(device, condition)
 
-        self.assertTrue(self.bss_hostapd[0].list_sta())
-
-        # list_sta actually reports any authenticated stations. Due to the
-        # nature of FT-over-DS IWD should authenticate to all stations with
-        # the same mobility domain. This means both APs should show our station.
-        if over_ds:
-            self.assertTrue(self.bss_hostapd[1].list_sta())
-        else:
-            self.assertFalse(self.bss_hostapd[1].list_sta())
+        self.bss_hostapd[0].wait_for_event('AP-STA-CONNECTED %s' % device.address)
 
         testutil.test_iface_operstate(device.name)
         testutil.test_ifaces_connected(self.bss_hostapd[0].ifname, device.name)
@@ -73,7 +52,7 @@ class Test(unittest.TestCase):
         to_condition = 'obj.state == DeviceState.connected'
         wd.wait_for_object_change(device, from_condition, to_condition)
 
-        self.assertTrue(self.bss_hostapd[1].list_sta())
+        self.bss_hostapd[1].wait_for_event('AP-STA-CONNECTED %s' % device.address)
 
         testutil.test_iface_operstate(device.name)
         testutil.test_ifaces_connected(self.bss_hostapd[1].ifname, device.name)
@@ -93,7 +72,7 @@ class Test(unittest.TestCase):
         to_condition = 'obj.state == DeviceState.connected'
         wd.wait_for_object_change(device, from_condition, to_condition)
 
-        self.assertTrue(self.bss_hostapd[0].list_sta())
+        self.bss_hostapd[0].wait_for_event('AP-STA-CONNECTED %s' % device.address)
 
         testutil.test_iface_operstate(device.name)
         testutil.test_ifaces_connected(self.bss_hostapd[0].ifname, device.name)
-- 
2.34.1

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-03-28 17:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-28 17:28 [PATCH v4 09/13] auto-t: use wait_for_event in testPSK-roam James Prestwood

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.