mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-22 14:49:24 +01:00
auto-t: update roaming tests with wait_for_object_change
Every single roaming test had one of two problems with watching the state change between roaming --> connected. Either the test used wait_for_object_condition to wait for 'connected' which could allow other states in between. Or it simply used an assert. The assert wouldn't allow other state changes, but at the cost of potentially failing due to IWD not having made it to the 'connected' state yet. Now we have wait_for_object_change which takes two conditions: initial (from_str) and expected (to_str). This API will not allow any other conditions except these, and will wait for the expected condition before continuing. This allows roaming test to reliably wait for the roaming --> connected state change.
This commit is contained in:
parent
c5538f6450
commit
1dc4d6e9ba
@ -79,11 +79,9 @@ class Test(unittest.TestCase):
|
||||
|
||||
# Check that iwd is on BSS 1 once out of roaming state and doesn't
|
||||
# go through 'disconnected', 'autoconnect', 'connecting' in between
|
||||
condition = 'obj.state != DeviceState.roaming'
|
||||
wd.wait_for_object_condition(device, condition)
|
||||
|
||||
condition = 'obj.state == DeviceState.connected'
|
||||
wd.wait_for_object_condition(device, condition)
|
||||
from_condition = 'obj.state == DeviceState.roaming'
|
||||
to_condition = 'obj.state == DeviceState.connected'
|
||||
wd.wait_for_object_change(device, from_condition, to_condition)
|
||||
|
||||
self.assertTrue(self.bss_hostapd[1].list_sta())
|
||||
|
||||
|
@ -109,11 +109,9 @@ class Test(unittest.TestCase):
|
||||
|
||||
# Check that iwd is on BSS 1 once out of roaming state and doesn't
|
||||
# go through 'disconnected', 'autoconnect', 'connecting' in between
|
||||
condition = 'obj.state != DeviceState.roaming'
|
||||
wd.wait_for_object_condition(device, condition)
|
||||
|
||||
condition = 'obj.state == DeviceState.connected'
|
||||
wd.wait_for_object_condition(device, condition)
|
||||
from_condition = 'obj.state == DeviceState.roaming'
|
||||
to_condition = 'obj.state == DeviceState.connected'
|
||||
wd.wait_for_object_change(device, from_condition, to_condition)
|
||||
|
||||
self.assertTrue(self.bss_hostapd[1].list_sta())
|
||||
|
||||
|
@ -109,10 +109,10 @@ class Test(unittest.TestCase):
|
||||
|
||||
# Check that iwd is on BSS 1 once out of roaming state and doesn't
|
||||
# go through 'disconnected', 'autoconnect', 'connecting' in between
|
||||
condition = 'obj.state != DeviceState.roaming'
|
||||
wd.wait_for_object_condition(device, condition)
|
||||
from_condition = 'obj.state == DeviceState.roaming'
|
||||
to_condition = 'obj.state == DeviceState.connected'
|
||||
wd.wait_for_object_change(device, from_condition, to_condition)
|
||||
|
||||
self.assertEqual(device.state, iwd.DeviceState.connected)
|
||||
self.assertTrue(self.bss_hostapd[1].list_sta())
|
||||
|
||||
testutil.test_iface_operstate(device.name)
|
||||
|
@ -85,11 +85,9 @@ class Test(unittest.TestCase):
|
||||
|
||||
# Check that iwd is on BSS 1 once out of roaming state and doesn't
|
||||
# go through 'disconnected', 'autoconnect', 'connecting' in between
|
||||
condition = 'obj.state != DeviceState.roaming'
|
||||
wd.wait_for_object_condition(device, condition)
|
||||
|
||||
condition = 'obj.state == DeviceState.connected'
|
||||
wd.wait_for_object_condition(device, condition)
|
||||
from_condition = 'obj.state == DeviceState.roaming'
|
||||
to_condition = 'obj.state == DeviceState.connected'
|
||||
wd.wait_for_object_change(device, from_condition, to_condition)
|
||||
|
||||
self.assertTrue(self.bss_hostapd[1].list_sta())
|
||||
|
||||
|
@ -87,11 +87,10 @@ class Test(unittest.TestCase):
|
||||
|
||||
# Check that iwd is on BSS 1 once out of roaming state and doesn't
|
||||
# go through 'disconnected', 'autoconnect', 'connecting' in between
|
||||
condition = 'obj.state != DeviceState.roaming'
|
||||
wd.wait_for_object_condition(device, condition)
|
||||
from_condition = 'obj.state == DeviceState.roaming'
|
||||
to_condition = 'obj.state == DeviceState.connected'
|
||||
wd.wait_for_object_change(device, from_condition, to_condition)
|
||||
|
||||
condition = 'obj.state == DeviceState.connected'
|
||||
wd.wait_for_object_condition(device, condition)
|
||||
self.assertTrue(self.bss_hostapd[1].list_sta())
|
||||
|
||||
testutil.test_iface_operstate(device.name)
|
||||
|
@ -91,15 +91,15 @@ class Test(unittest.TestCase):
|
||||
|
||||
# Check that iwd is on BSS 1 once out of roaming state and doesn't
|
||||
# go through 'disconnected', 'autoconnect', 'connecting' in between
|
||||
condition = 'obj.state != DeviceState.roaming'
|
||||
wd.wait_for_object_condition(device, condition)
|
||||
from_condition = 'obj.state == DeviceState.roaming'
|
||||
to_condition = 'obj.state == DeviceState.connected'
|
||||
wd.wait_for_object_change(device, from_condition, to_condition)
|
||||
|
||||
rule1.signal = -2000
|
||||
|
||||
# wait for IWD's signal levels to recover
|
||||
wd.wait(5)
|
||||
|
||||
self.assertEqual(device.state, iwd.DeviceState.connected)
|
||||
self.assertTrue(self.bss_hostapd[1].list_sta())
|
||||
|
||||
testutil.test_iface_operstate(device.name)
|
||||
|
@ -97,10 +97,10 @@ class Test(unittest.TestCase):
|
||||
|
||||
# Check that iwd is on BSS 1 once out of roaming state and doesn't
|
||||
# go through 'disconnected', 'autoconnect', 'connecting' in between
|
||||
condition = 'obj.state != DeviceState.roaming'
|
||||
wd.wait_for_object_condition(device, condition)
|
||||
from_condition = 'obj.state == DeviceState.roaming'
|
||||
to_condition = 'obj.state == DeviceState.connected'
|
||||
wd.wait_for_object_change(device, from_condition, to_condition)
|
||||
|
||||
self.assertEqual(device.state, iwd.DeviceState.connected)
|
||||
self.assertTrue(bss_hostapd[1].list_sta())
|
||||
|
||||
testutil.test_iface_operstate(device.name)
|
||||
|
@ -117,10 +117,10 @@ class Test(unittest.TestCase):
|
||||
|
||||
# Check that iwd is on BSS 1 once out of roaming state and doesn't
|
||||
# go through 'disconnected', 'autoconnect', 'connecting' in between
|
||||
condition = 'obj.state != DeviceState.roaming'
|
||||
wd.wait_for_object_condition(device, condition, max_wait=5)
|
||||
from_condition = 'obj.state == DeviceState.roaming'
|
||||
to_condition = 'obj.state == DeviceState.connected'
|
||||
wd.wait_for_object_change(device, from_condition, to_condition)
|
||||
|
||||
self.assertEqual(device.state, iwd.DeviceState.connected)
|
||||
self.assertTrue(bss_hostapd[1].list_sta())
|
||||
|
||||
device.disconnect()
|
||||
|
@ -92,10 +92,10 @@ class Test(unittest.TestCase):
|
||||
|
||||
# Check that iwd is on BSS 1 once out of roaming state and doesn't
|
||||
# go through 'disconnected', 'autoconnect', 'connecting' in between
|
||||
condition = 'obj.state != DeviceState.roaming'
|
||||
wd.wait_for_object_condition(device, condition)
|
||||
from_condition = 'obj.state == DeviceState.roaming'
|
||||
to_condition = 'obj.state == DeviceState.connected'
|
||||
wd.wait_for_object_change(device, from_condition, to_condition)
|
||||
|
||||
self.assertEqual(device.state, iwd.DeviceState.connected)
|
||||
self.assertTrue(bss_hostapd[1].list_sta())
|
||||
|
||||
# Now make sure that we don't roam anymore. In order to catch this via
|
||||
|
Loading…
Reference in New Issue
Block a user