3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-22 13:02:44 +01:00

auto-t: fix blacklist test timing issues

This test fails randomly, and it appears to be due to excessive
scanning. Historically most autotests start a dbus scan right
away. The problem is that most likely a periodic scan is already
ongoing, meaning the dbus scan gets queued. If a Connect() call
comes in (which it always does), the dbus scan gets delayed and will
trigger once connected, at a time the test is not expecting. This
can cause problems with any assumed timing as well as offchannel
frames.

This patch removes the explicit DBus scanning and instead uses
scan_if_needed with get_ordered_networks. The 'all_blacklisted_test'
was also modified to wait for scanning to complete after failing
to connect to all BSS's. This lets all the networks fully come
up (after being blocked by hwsim) and appear in scan results.
This commit is contained in:
James Prestwood 2021-02-11 15:16:14 -08:00 committed by Denis Kenzior
parent 963bd1344f
commit 3a9c401f63
4 changed files with 9 additions and 36 deletions

View File

@ -47,15 +47,7 @@ class Test(unittest.TestCase):
devices = wd.list_devices(1)
device = devices[0]
condition = 'not obj.scanning'
wd.wait_for_object_condition(device, condition)
device.scan()
condition = 'not obj.scanning'
wd.wait_for_object_condition(device, condition)
ordered_network = device.get_ordered_network("TestBlacklist")
ordered_network = device.get_ordered_network("TestBlacklist", scan_if_needed=True)
self.assertEqual(ordered_network.type, NetworkType.psk)
@ -74,6 +66,11 @@ class Test(unittest.TestCase):
rule1.drop = False
rule2.drop = False
# Wait for scanning (likely a quick-scan) to finish, otherwise we will
# may not have all BSS's in the list.
condition = 'not obj.scanning'
wd.wait_for_object_condition(device, condition)
# This connect should work
ordered_network.network_object.connect()

View File

@ -47,15 +47,7 @@ class Test(unittest.TestCase):
devices = wd.list_devices(1)
device = devices[0]
condition = 'not obj.scanning'
wd.wait_for_object_condition(device, condition)
device.scan()
condition = 'not obj.scanning'
wd.wait_for_object_condition(device, condition)
ordered_network = device.get_ordered_network("TestBlacklist")
ordered_network = device.get_ordered_network("TestBlacklist", scan_if_needed=True)
self.assertEqual(ordered_network.type, NetworkType.psk)

View File

@ -51,15 +51,7 @@ class Test(unittest.TestCase):
devices[1].disconnect()
condition = 'not obj.scanning'
wd.wait_for_object_condition(device, condition)
device.scan()
condition = 'not obj.scanning'
wd.wait_for_object_condition(device, condition)
ordered_network = device.get_ordered_network("TestBlacklist")
ordered_network = device.get_ordered_network("TestBlacklist", scan_if_needed=True)
self.assertEqual(ordered_network.type, NetworkType.psk)

View File

@ -46,15 +46,7 @@ class Test(unittest.TestCase):
dev1, dev2 = wd.list_devices(2)
condition = 'not obj.scanning'
wd.wait_for_object_condition(dev1, condition)
dev1.scan()
condition = 'not obj.scanning'
wd.wait_for_object_condition(dev1, condition)
ordered_network = dev1.get_ordered_network("TestBlacklist")
ordered_network = dev1.get_ordered_network("TestBlacklist", scan_if_needed=True)
self.assertEqual(ordered_network.type, NetworkType.psk)