From d43a640d7186468ec7804aac82a5320592e65f33 Mon Sep 17 00:00:00 2001 From: James Prestwood Date: Thu, 10 Sep 2020 16:12:47 -0700 Subject: [PATCH] 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. --- autotests/testFT-PSK-roam/connection_test.py | 39 ++++++-------------- autotests/testFT-PSK-roam/hw.conf | 1 + 2 files changed, 13 insertions(+), 27 deletions(-) diff --git a/autotests/testFT-PSK-roam/connection_test.py b/autotests/testFT-PSK-roam/connection_test.py index 37dd80d0..ccbaccb8 100644 --- a/autotests/testFT-PSK-roam/connection_test.py +++ b/autotests/testFT-PSK-roam/connection_test.py @@ -24,7 +24,11 @@ class Test(unittest.TestCase): rule1.source = self.bss_radio[1].addresses[0] 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") wd.register_psk_agent(psk_agent) @@ -33,10 +37,6 @@ class Test(unittest.TestCase): # prevent autoconnect device.disconnect() - # Check that iwd selects BSS 0 first - rule0.signal = -2000 - rule1.signal = -2500 - condition = 'not obj.scanning' wd.wait_for_object_condition(device, condition) @@ -61,8 +61,8 @@ class Test(unittest.TestCase): ordered_network.network_object.connect() - condition = 'obj.connected' - wd.wait_for_object_condition(ordered_network.network_object, condition) + condition = 'obj.state == DeviceState.connected' + wd.wait_for_object_condition(device, condition) self.assertTrue(self.bss_hostapd[0].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.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") wd.register_psk_agent(psk_agent) @@ -118,10 +122,6 @@ class Test(unittest.TestCase): # prevent autoconnect device.disconnect() - # Check that iwd selects BSS 0 first - rule0.signal = -2000 - rule1.signal = -2500 - condition = 'not obj.scanning' 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) self.assertRaises(Exception, testutil.test_ifaces_connected, (self.bss_hostapd[0].ifname, device.name)) - def setUp(self): - self.wd = IWD() def tearDown(self): 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[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 def setUpClass(cls): hwsim = Hwsim() diff --git a/autotests/testFT-PSK-roam/hw.conf b/autotests/testFT-PSK-roam/hw.conf index d2d50863..d08534c4 100644 --- a/autotests/testFT-PSK-roam/hw.conf +++ b/autotests/testFT-PSK-roam/hw.conf @@ -3,6 +3,7 @@ num_radios=3 max_test_exec_interval_sec=45 tmpfs_extra_stuff=main.conf needs_hwsim=1 +start_iwd=0 [HOSTAPD] rad0=ft-psk-ccmp-1.conf