aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Prestwood <prestwoj@gmail.com>2024-01-03 10:46:37 -0800
committerDenis Kenzior <denkenz@gmail.com>2024-01-04 11:59:37 -0600
commitb0ad6158e18889fb95ce2f8911f6a01fd267d768 (patch)
treed6350b7f81b02377d8f51e712ea0cb77bd4fc979
parent0a3797a4d4b0ec98120015819b4c7f44a5830a1d (diff)
auto-t: improve failure handling in testPSK-roam
This really needs to be done to many more autotests but since this one seems to have random failures ensure that all the tests still run if one fails. In addition add better cleanup for hwsim rules.
-rw-r--r--autotests/testPSK-roam/connection_test.py25
-rw-r--r--autotests/testPSK-roam/failed_roam_test.py3
-rw-r--r--autotests/testPSK-roam/roam_ap_disconnect_test.py11
3 files changed, 22 insertions, 17 deletions
diff --git a/autotests/testPSK-roam/connection_test.py b/autotests/testPSK-roam/connection_test.py
index 8db4e4cbe..2dbf1473c 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 ccdec2c6f..12e439f67 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 b5775990b..76c62ea0e 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()