3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-22 06:29:23 +01:00

auto-t: Change FT test cases to use start_iwd=0

These test cases depend on setting up the existing hostapd instance to a
set of known addresses, which might be different from what test-runner
sets.  During this time, any scans might result in the old and the new
addresses used by hostapd to be found in the scan results.

Fix that by using start_iwd=0 which tells test_runner that the test
wants to start iwd itself.  This delays starting iwd until after the
setUpClass routine has been called and hostapd configured properly.

Also use more sensible rssi values for the 'non-preferred' bss.
Otherwise, ranking BSSes by throughput can confuse the test logic
since both BSSes are ranked the same and either can be picked by
autoconnect.
This commit is contained in:
Denis Kenzior 2021-05-21 11:44:55 -05:00
parent 8e68e73c43
commit 8d8ea67da1
10 changed files with 40 additions and 77 deletions

View File

@ -23,13 +23,13 @@ class Test(unittest.TestCase):
rule1.source = self.bss_radio[1].addresses[0]
rule1.bidirectional = True
wd = IWD()
device = wd.list_devices(1)[0]
# Check that iwd selects BSS 0 first
rule0.signal = -2000
rule1.signal = -2500
rule1.signal = -6900
wd = IWD(True)
device = wd.list_devices(1)[0]
condition = 'not obj.scanning'
wd.wait_for_object_condition(device, condition)
@ -97,16 +97,6 @@ class Test(unittest.TestCase):
os.system('ifconfig "' + self.bss_hostapd[1].ifname + '" up')
hwsim = Hwsim()
wd = IWD()
device = wd.list_devices(1)[0]
try:
device.disconnect()
except:
pass
condition = 'obj.state == DeviceState.disconnected'
wd.wait_for_object_condition(device, condition)
for rule in list(hwsim.rules.keys()):
del hwsim.rules[rule]
@ -128,7 +118,9 @@ class Test(unittest.TestCase):
'" down hw ether 12:00:00:00:00:02 up')
cls.bss_hostapd[0].reload()
cls.bss_hostapd[0].wait_for_event("AP-ENABLED")
cls.bss_hostapd[1].reload()
cls.bss_hostapd[1].wait_for_event("AP-ENABLED")
# Fill in the neighbor AP tables in both BSSes. By default each
# instance knows only about current BSS, even inside one hostapd

View File

@ -1,5 +1,6 @@
[SETUP]
num_radios=3
start_iwd=0
[HOSTAPD]
rad0=ft-eap-ccmp-1.conf

View File

@ -24,7 +24,11 @@ class Test(unittest.TestCase):
rule1.source = self.bss_radio[1].addresses[0]
rule1.bidirectional = True
wd = IWD()
# Check that iwd selects BSS 0 first
rule0.signal = -2000
rule1.signal = -6900
wd = IWD(True)
psk_agent = PSKAgent('user@example.com', ('user@example.com',
'secret123'))
@ -32,10 +36,6 @@ class Test(unittest.TestCase):
device = wd.list_devices(1)[0]
# Check that iwd selects BSS 0 first
rule0.signal = -2000
rule1.signal = -2500
condition = 'not obj.scanning'
wd.wait_for_object_condition(device, condition)
@ -127,16 +127,6 @@ class Test(unittest.TestCase):
os.system('ifconfig "' + self.bss_hostapd[1].ifname + '" up')
hwsim = Hwsim()
wd = IWD()
device = wd.list_devices(1)[0]
try:
device.disconnect()
except:
pass
condition = 'obj.state == DeviceState.disconnected'
wd.wait_for_object_condition(device, condition)
for rule in list(hwsim.rules.keys()):
del hwsim.rules[rule]
@ -159,7 +149,9 @@ class Test(unittest.TestCase):
'" down hw ether 12:00:00:00:00:02 up')
cls.bss_hostapd[0].reload()
cls.bss_hostapd[0].wait_for_event("AP-ENABLED")
cls.bss_hostapd[1].reload()
cls.bss_hostapd[1].wait_for_event("AP-ENABLED")
# Fill in the neighbor AP tables in both BSSes. By default each
# instance knows only about current BSS, even inside one hostapd

View File

@ -1,5 +1,6 @@
[SETUP]
num_radios=3
start_iwd=0
[HOSTAPD]
rad0=ft-eap-ccmp-1.conf

View File

@ -24,7 +24,11 @@ class Test(unittest.TestCase):
rule1.source = self.bss_radio[1].addresses[0]
rule1.bidirectional = True
wd = IWD()
# Check that iwd selects BSS 0 first
rule0.signal = -2000
rule1.signal = -6900
wd = IWD(True)
psk_agent = PSKAgent('user@example.com', ('user@example.com',
'secret123'))
@ -32,10 +36,6 @@ class Test(unittest.TestCase):
device = wd.list_devices(1)[0]
# Check that iwd selects BSS 0 first
rule0.signal = -2000
rule1.signal = -2500
condition = 'not obj.scanning'
wd.wait_for_object_condition(device, condition)
@ -127,16 +127,6 @@ class Test(unittest.TestCase):
os.system('ifconfig "' + self.bss_hostapd[1].ifname + '" up')
hwsim = Hwsim()
wd = IWD()
device = wd.list_devices(1)[0]
try:
device.disconnect()
except:
pass
condition = 'obj.state == DeviceState.disconnected'
wd.wait_for_object_condition(device, condition)
for rule in list(hwsim.rules.keys()):
del hwsim.rules[rule]
@ -159,7 +149,9 @@ class Test(unittest.TestCase):
'" down hw ether 12:00:00:00:00:02 up')
cls.bss_hostapd[0].reload()
cls.bss_hostapd[0].wait_for_event("AP-ENABLED")
cls.bss_hostapd[1].reload()
cls.bss_hostapd[1].wait_for_event("AP-ENABLED")
# Fill in the neighbor AP tables in both BSSes. By default each
# instance knows only about current BSS, even inside one hostapd

View File

@ -1,5 +1,6 @@
[SETUP]
num_radios=3
start_iwd=0
[HOSTAPD]
rad0=ft-eap-ccmp-1.conf

View File

@ -24,17 +24,17 @@ class Test(unittest.TestCase):
rule1.source = self.bss_radio[1].addresses[0]
rule1.bidirectional = True
wd = IWD()
# Check that iwd selects BSS 0 first
rule0.signal = -2000
rule1.signal = -6900
wd = IWD(True)
psk_agent = PSKAgent("EasilyGuessedPassword")
wd.register_psk_agent(psk_agent)
device = wd.list_devices(1)[0]
# Check that iwd selects BSS 0 first
rule0.signal = -2000
rule1.signal = -2500
condition = 'not obj.scanning'
wd.wait_for_object_condition(device, condition)
@ -108,16 +108,6 @@ class Test(unittest.TestCase):
os.system('ifconfig "' + self.bss_hostapd[1].ifname + '" up')
hwsim = Hwsim()
wd = IWD()
device = wd.list_devices(1)[0]
try:
device.disconnect()
except:
pass
condition = 'obj.state == DeviceState.disconnected'
wd.wait_for_object_condition(device, condition)
for rule in list(hwsim.rules.keys()):
del hwsim.rules[rule]
@ -137,7 +127,9 @@ class Test(unittest.TestCase):
'" down hw ether 12:00:00:00:00:02 up')
cls.bss_hostapd[0].reload()
cls.bss_hostapd[0].wait_for_event("AP-ENABLED")
cls.bss_hostapd[1].reload()
cls.bss_hostapd[1].wait_for_event("AP-ENABLED")
# Fill in the neighbor AP tables in both BSSes. By default each
# instance knows only about current BSS, even inside one hostapd

View File

@ -1,5 +1,6 @@
[SETUP]
num_radios=3
start_iwd=0
[HOSTAPD]
rad0=ft-psk-ccmp-1.conf

View File

@ -15,8 +15,6 @@ from config import ctx
class Test(unittest.TestCase):
def test_roam_success(self):
wd = IWD()
hwsim = Hwsim()
rule0 = hwsim.rules.create()
@ -31,16 +29,18 @@ class Test(unittest.TestCase):
rule2.source = self.bss_radio[2].addresses[0]
rule2.bidirectional = True
# Check that iwd selects BSS 0 first
rule0.signal = -2000
rule1.signal = -6900
rule2.signal = -7200
wd = IWD(True)
psk_agent = PSKAgent("EasilyGuessedPassword")
wd.register_psk_agent(psk_agent)
device = wd.list_devices(1)[0]
# Check that iwd selects BSS 0 first
rule0.signal = -2000
rule1.signal = -2500
rule2.signal = -3000
condition = 'not obj.scanning'
wd.wait_for_object_condition(device, condition)
@ -135,16 +135,6 @@ class Test(unittest.TestCase):
os.system('ifconfig "' + self.bss_hostapd[2].ifname + '" up')
hwsim = Hwsim()
wd = IWD()
device = wd.list_devices(1)[0]
try:
device.disconnect()
except:
pass
condition = 'obj.state == DeviceState.disconnected'
wd.wait_for_object_condition(device, condition)
for rule in list(hwsim.rules.keys()):
del hwsim.rules[rule]

View File

@ -1,5 +1,6 @@
[SETUP]
num_radios=4
start_iwd=0
[HOSTAPD]
rad0=ft-sae-1.conf