3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-23 05:32:48 +01:00

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.
This commit is contained in:
James Prestwood 2024-01-03 10:46:37 -08:00 committed by Denis Kenzior
parent 0a3797a4d4
commit b0ad6158e1
3 changed files with 22 additions and 17 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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()