diff --git a/autotests/testPSK-roam/connection_test.py b/autotests/testPSK-roam/connection_test.py index 8db4e4cb..2dbf1473 100644 --- a/autotests/testPSK-roam/connection_test.py +++ b/autotests/testPSK-roam/connection_test.py @@ -91,13 +91,9 @@ class Test(unittest.TestCase): wd.wait_for_object_condition(device, condition) def test_ft_psk(self): - wd = IWD(True) - - self.validate_connection(wd) + self.validate_connection(self.wd) def test_ft_psk_over_ds(self): - wd = IWD(True) - self.bss_hostapd[0].set_value('ft_over_ds', '1') self.bss_hostapd[0].reload() self.bss_hostapd[0].wait_for_event("AP-ENABLED") @@ -106,11 +102,9 @@ class Test(unittest.TestCase): self.bss_hostapd[1].reload() self.bss_hostapd[1].wait_for_event("AP-ENABLED") - self.validate_connection(wd, over_ds=True) + self.validate_connection(self.wd, over_ds=True) def test_reassociate_psk(self): - wd = IWD(True) - self.bss_hostapd[0].set_value('wpa_key_mgmt', 'WPA-PSK') self.bss_hostapd[0].reload() self.bss_hostapd[0].wait_for_event("AP-ENABLED") @@ -119,12 +113,10 @@ class Test(unittest.TestCase): self.bss_hostapd[1].reload() self.bss_hostapd[1].wait_for_event("AP-ENABLED") - self.validate_connection(wd) + self.validate_connection(self.wd) def test_roam_packet_loss(self): - wd = IWD(True) - - self.validate_connection(wd, pkt_loss=True) + self.validate_connection(self.wd, pkt_loss=True) def tearDown(self): os.system('ip link set "' + self.bss_hostapd[0].ifname + '" down') @@ -139,6 +131,12 @@ class Test(unittest.TestCase): for hapd in self.bss_hostapd: hapd.default() + self.wd.stop() + self.wd = None + + def setUp(self): + self.wd = IWD(True) + @classmethod def setUpClass(cls): hwsim = Hwsim() @@ -178,8 +176,9 @@ class Test(unittest.TestCase): def tearDownClass(cls): IWD.clear_storage() cls.bss_hostapd = None - cls.rule0.enabled = False cls.rule0.remove() + cls.rule1.remove() + cls.rule2.remove() if __name__ == '__main__': unittest.main(exit=True) diff --git a/autotests/testPSK-roam/failed_roam_test.py b/autotests/testPSK-roam/failed_roam_test.py index ccdec2c6..12e439f6 100644 --- a/autotests/testPSK-roam/failed_roam_test.py +++ b/autotests/testPSK-roam/failed_roam_test.py @@ -227,6 +227,9 @@ class Test(unittest.TestCase): cls.bss_hostapd = None cls.rule0.remove() cls.rule1.remove() + cls.rule2.remove() + cls.rule3.remove() + cls.assoc_rule.remove() if __name__ == '__main__': unittest.main(exit=True) diff --git a/autotests/testPSK-roam/roam_ap_disconnect_test.py b/autotests/testPSK-roam/roam_ap_disconnect_test.py index b5775990..76c62ea0 100644 --- a/autotests/testPSK-roam/roam_ap_disconnect_test.py +++ b/autotests/testPSK-roam/roam_ap_disconnect_test.py @@ -14,8 +14,7 @@ class Test(unittest.TestCase): # Tests a crash reported where multiple roam scans combined with an AP # disconnect result in a crash getting scan results. # - def validate(self): - wd = IWD(True) + def validate(self, wd): device = wd.list_devices(1)[0] ordered_network = device.get_ordered_network('TestFT', full_scan=True) @@ -43,14 +42,15 @@ class Test(unittest.TestCase): wd.wait_for_object_condition(device, condition) def test_ap_disconnect_no_neighbors(self): - self.validate() + self.validate(self.wd) def test_ap_disconnect_neighbors(self): HostapdCLI.group_neighbors(*self.bss_hostapd) - self.validate() + self.validate(self.wd) def setUp(self): + self.wd = IWD(True) self.bss_hostapd[0].reload() self.bss_hostapd[0].wait_for_event("AP-ENABLED") @@ -63,6 +63,9 @@ class Test(unittest.TestCase): self.bss_hostapd[0].remove_neighbor(self.bss_hostapd[1].bssid) self.bss_hostapd[1].remove_neighbor(self.bss_hostapd[0].bssid) + self.wd.stop() + self.wd = None + @classmethod def setUpClass(cls): hwsim = Hwsim()