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: fix testFT-PSK-roam

Switched around hwsim rules with the IWD initializer to avoid
IWD periodically scanning before hwsim rules are in place. Removed
some unneeded code during teardown.
This commit is contained in:
James Prestwood 2020-09-10 16:12:47 -07:00 committed by Denis Kenzior
parent 20b7540201
commit d43a640d71
2 changed files with 13 additions and 27 deletions

View File

@ -24,7 +24,11 @@ class Test(unittest.TestCase):
rule1.source = self.bss_radio[1].addresses[0] rule1.source = self.bss_radio[1].addresses[0]
rule1.bidirectional = True rule1.bidirectional = True
wd = self.wd # Check that iwd selects BSS 0 first
rule0.signal = -2000
rule1.signal = -2500
wd = IWD(True)
psk_agent = PSKAgent("EasilyGuessedPassword") psk_agent = PSKAgent("EasilyGuessedPassword")
wd.register_psk_agent(psk_agent) wd.register_psk_agent(psk_agent)
@ -33,10 +37,6 @@ class Test(unittest.TestCase):
# prevent autoconnect # prevent autoconnect
device.disconnect() device.disconnect()
# Check that iwd selects BSS 0 first
rule0.signal = -2000
rule1.signal = -2500
condition = 'not obj.scanning' condition = 'not obj.scanning'
wd.wait_for_object_condition(device, condition) wd.wait_for_object_condition(device, condition)
@ -61,8 +61,8 @@ class Test(unittest.TestCase):
ordered_network.network_object.connect() ordered_network.network_object.connect()
condition = 'obj.connected' condition = 'obj.state == DeviceState.connected'
wd.wait_for_object_condition(ordered_network.network_object, condition) wd.wait_for_object_condition(device, condition)
self.assertTrue(self.bss_hostapd[0].list_sta()) self.assertTrue(self.bss_hostapd[0].list_sta())
self.assertFalse(self.bss_hostapd[1].list_sta()) self.assertFalse(self.bss_hostapd[1].list_sta())
@ -109,7 +109,11 @@ class Test(unittest.TestCase):
rule1.source = self.bss_radio[1].addresses[0] rule1.source = self.bss_radio[1].addresses[0]
rule1.bidirectional = True rule1.bidirectional = True
wd = self.wd # Check that iwd selects BSS 0 first
rule0.signal = -2000
rule1.signal = -2500
wd = IWD(True)
psk_agent = PSKAgent("EasilyGuessedPassword") psk_agent = PSKAgent("EasilyGuessedPassword")
wd.register_psk_agent(psk_agent) wd.register_psk_agent(psk_agent)
@ -118,10 +122,6 @@ class Test(unittest.TestCase):
# prevent autoconnect # prevent autoconnect
device.disconnect() device.disconnect()
# Check that iwd selects BSS 0 first
rule0.signal = -2000
rule1.signal = -2500
condition = 'not obj.scanning' condition = 'not obj.scanning'
wd.wait_for_object_condition(device, condition) wd.wait_for_object_condition(device, condition)
@ -180,8 +180,6 @@ class Test(unittest.TestCase):
testutil.test_ifaces_connected(self.bss_hostapd[1].ifname, device.name) testutil.test_ifaces_connected(self.bss_hostapd[1].ifname, device.name)
self.assertRaises(Exception, testutil.test_ifaces_connected, self.assertRaises(Exception, testutil.test_ifaces_connected,
(self.bss_hostapd[0].ifname, device.name)) (self.bss_hostapd[0].ifname, device.name))
def setUp(self):
self.wd = IWD()
def tearDown(self): def tearDown(self):
os.system('ifconfig "' + self.bss_hostapd[0].ifname + '" down') os.system('ifconfig "' + self.bss_hostapd[0].ifname + '" down')
@ -189,19 +187,6 @@ class Test(unittest.TestCase):
os.system('ifconfig "' + self.bss_hostapd[0].ifname + '" up') os.system('ifconfig "' + self.bss_hostapd[0].ifname + '" up')
os.system('ifconfig "' + self.bss_hostapd[1].ifname + '" up') os.system('ifconfig "' + self.bss_hostapd[1].ifname + '" up')
hwsim = Hwsim()
device = self.wd.list_devices(1)[0]
try:
device.disconnect()
except:
pass
condition = 'obj.state == DeviceState.disconnected'
self.wd.wait_for_object_condition(device, condition)
for rule in list(hwsim.rules.keys()):
del hwsim.rules[rule]
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
hwsim = Hwsim() hwsim = Hwsim()

View File

@ -3,6 +3,7 @@ num_radios=3
max_test_exec_interval_sec=45 max_test_exec_interval_sec=45
tmpfs_extra_stuff=main.conf tmpfs_extra_stuff=main.conf
needs_hwsim=1 needs_hwsim=1
start_iwd=0
[HOSTAPD] [HOSTAPD]
rad0=ft-psk-ccmp-1.conf rad0=ft-psk-ccmp-1.conf