mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-25 17:59:25 +01:00
auto-t: remove busy wait for eapol reauth
Many tests force a reauth after the initial connection. When the tests were written there was no way of ensuring the reauth completed except waiting (IWD.wait()). Now we can wait for hostapd events in the tests, which is faster and more reliable than busy waiting.
This commit is contained in:
parent
38c8fe06a4
commit
0fdc3b3ed6
@ -15,13 +15,7 @@ from hostapd import hostapd_map
|
||||
class Test(unittest.TestCase):
|
||||
|
||||
def test_connection_success(self):
|
||||
hostapd = None
|
||||
|
||||
for hostapd_if in list(hostapd_map.values()):
|
||||
hpd = HostapdCLI(hostapd_if)
|
||||
if hpd.get_config_value('ssid') == 'ssidEAP-AKA':
|
||||
hostapd = hpd
|
||||
break
|
||||
hostapd = HostapdCLI(config='ssidEAP-AKA.conf')
|
||||
|
||||
self.assertIsNotNone(hostapd)
|
||||
|
||||
@ -58,7 +52,8 @@ class Test(unittest.TestCase):
|
||||
|
||||
hostapd.eapol_reauth(device.address)
|
||||
|
||||
wd.wait(10)
|
||||
hostapd.wait_for_event('CTRL-EVENT-EAP-STARTED')
|
||||
hostapd.wait_for_event('CTRL-EVENT-EAP-SUCCESS')
|
||||
|
||||
condition = 'obj.connected'
|
||||
wd.wait_for_object_condition(ordered_network.network_object, condition)
|
||||
|
@ -16,13 +16,7 @@ from hostapd import hostapd_map
|
||||
class Test(unittest.TestCase):
|
||||
|
||||
def validate_connection(self, wd):
|
||||
hostapd = None
|
||||
|
||||
for hostapd_if in list(hostapd_map.values()):
|
||||
hpd = HostapdCLI(hostapd_if)
|
||||
if hpd.get_config_value('ssid') == 'ssidEAP-PEAPv0-NoISK':
|
||||
hostapd = hpd
|
||||
break
|
||||
hostapd = HostapdCLI(config='ssidEAP-PEAPv0-NoISK.conf')
|
||||
|
||||
self.assertIsNotNone(hostapd)
|
||||
|
||||
@ -52,7 +46,8 @@ class Test(unittest.TestCase):
|
||||
|
||||
hostapd.eapol_reauth(device.address)
|
||||
|
||||
wd.wait(10)
|
||||
hostapd.wait_for_event('CTRL-EVENT-EAP-STARTED')
|
||||
hostapd.wait_for_event('CTRL-EVENT-EAP-SUCCESS')
|
||||
|
||||
condition = 'obj.connected'
|
||||
wd.wait_for_object_condition(ordered_network.network_object, condition)
|
||||
|
@ -15,14 +15,7 @@ from hostapd import hostapd_map
|
||||
class Test(unittest.TestCase):
|
||||
|
||||
def validate_connection(self, wd):
|
||||
|
||||
hostapd = None
|
||||
|
||||
for hostapd_if in list(hostapd_map.values()):
|
||||
hpd = HostapdCLI(hostapd_if)
|
||||
if hpd.get_config_value('ssid') == 'ssidEAP-PWD':
|
||||
hostapd = hpd
|
||||
break
|
||||
hostapd = HostapdCLI(config='ssidEAP-PWD.conf')
|
||||
|
||||
self.assertIsNotNone(hostapd)
|
||||
|
||||
@ -56,7 +49,8 @@ class Test(unittest.TestCase):
|
||||
|
||||
hostapd.eapol_reauth(device.address)
|
||||
|
||||
wd.wait(10)
|
||||
hostapd.wait_for_event('CTRL-EVENT-EAP-STARTED')
|
||||
hostapd.wait_for_event('CTRL-EVENT-EAP-SUCCESS')
|
||||
|
||||
condition = 'obj.connected'
|
||||
wd.wait_for_object_condition(ordered_network.network_object, condition)
|
||||
|
@ -15,13 +15,7 @@ from hostapd import hostapd_map
|
||||
class Test(unittest.TestCase):
|
||||
|
||||
def test_connection_success(self):
|
||||
hostapd = None
|
||||
|
||||
for hostapd_if in list(hostapd_map.values()):
|
||||
hpd = HostapdCLI(hostapd_if)
|
||||
if hpd.get_config_value('ssid') == 'ssidEAP-SIM':
|
||||
hostapd = hpd
|
||||
break
|
||||
hostapd = HostapdCLI(config='ssidEAP-SIM.conf')
|
||||
|
||||
auth = AuthCenter('/tmp/hlrauc.sock', '/tmp/sim.db')
|
||||
|
||||
@ -56,7 +50,8 @@ class Test(unittest.TestCase):
|
||||
|
||||
hostapd.eapol_reauth(device.address)
|
||||
|
||||
wd.wait(10)
|
||||
hostapd.wait_for_event('CTRL-EVENT-EAP-STARTED')
|
||||
hostapd.wait_for_event('CTRL-EVENT-EAP-SUCCESS')
|
||||
|
||||
condition = 'obj.connected'
|
||||
wd.wait_for_object_condition(ordered_network.network_object, condition)
|
||||
|
@ -16,13 +16,7 @@ from hostapd import hostapd_map
|
||||
class Test(unittest.TestCase):
|
||||
|
||||
def test_connection_success(self):
|
||||
hostapd = None
|
||||
|
||||
for hostapd_if in list(hostapd_map.values()):
|
||||
hpd = HostapdCLI(hostapd_if)
|
||||
if hpd.get_config_value('ssid') == 'ssidEAP-TTLS-CHAP':
|
||||
hostapd = hpd
|
||||
break
|
||||
hostapd = HostapdCLI(config='ssidEAP-TTLS-CHAP.conf')
|
||||
|
||||
self.assertIsNotNone(hostapd)
|
||||
|
||||
@ -55,7 +49,8 @@ class Test(unittest.TestCase):
|
||||
|
||||
hostapd.eapol_reauth(device.address)
|
||||
|
||||
wd.wait(10)
|
||||
hostapd.wait_for_event('CTRL-EVENT-EAP-STARTED')
|
||||
hostapd.wait_for_event('CTRL-EVENT-EAP-SUCCESS')
|
||||
|
||||
condition = 'obj.connected'
|
||||
wd.wait_for_object_condition(ordered_network.network_object, condition)
|
||||
|
@ -16,13 +16,7 @@ from hostapd import hostapd_map
|
||||
class Test(unittest.TestCase):
|
||||
|
||||
def test_connection_success(self):
|
||||
hostapd = None
|
||||
|
||||
for hostapd_if in hostapd_map.values():
|
||||
hpd = HostapdCLI(hostapd_if)
|
||||
if hpd.get_config_value('ssid') == 'ssidEAP-TTLS-MSCHAP':
|
||||
hostapd = hpd
|
||||
break
|
||||
hostapd = HostapdCLI(config='ssidEAP-TTLS-MSCHAP.conf')
|
||||
|
||||
self.assertIsNotNone(hostapd)
|
||||
|
||||
@ -55,7 +49,8 @@ class Test(unittest.TestCase):
|
||||
|
||||
hostapd.eapol_reauth(device.address)
|
||||
|
||||
wd.wait(10)
|
||||
hostapd.wait_for_event('CTRL-EVENT-EAP-STARTED')
|
||||
hostapd.wait_for_event('CTRL-EVENT-EAP-SUCCESS')
|
||||
|
||||
condition = 'obj.connected'
|
||||
wd.wait_for_object_condition(ordered_network.network_object, condition)
|
||||
|
@ -48,7 +48,8 @@ class Test(unittest.TestCase):
|
||||
|
||||
hostapd.eapol_reauth(device.address)
|
||||
|
||||
wd.wait(10)
|
||||
hostapd.wait_for_event('CTRL-EVENT-EAP-STARTED')
|
||||
hostapd.wait_for_event('CTRL-EVENT-EAP-SUCCESS')
|
||||
|
||||
condition = 'obj.connected'
|
||||
wd.wait_for_object_condition(ordered_network.network_object, condition)
|
||||
|
@ -16,13 +16,7 @@ from hostapd import hostapd_map
|
||||
class Test(unittest.TestCase):
|
||||
|
||||
def test_connection_success(self):
|
||||
hostapd = None
|
||||
|
||||
for hostapd_if in list(hostapd_map.values()):
|
||||
hpd = HostapdCLI(hostapd_if)
|
||||
if hpd.get_config_value('ssid') == 'ssidEAP-TTLS-PAP':
|
||||
hostapd = hpd
|
||||
break
|
||||
hostapd = HostapdCLI(config='ssidEAP-TTLS-PAP.conf')
|
||||
|
||||
self.assertIsNotNone(hostapd)
|
||||
|
||||
@ -55,7 +49,8 @@ class Test(unittest.TestCase):
|
||||
|
||||
hostapd.eapol_reauth(device.address)
|
||||
|
||||
wd.wait(10)
|
||||
hostapd.wait_for_event('CTRL-EVENT-EAP-STARTED')
|
||||
hostapd.wait_for_event('CTRL-EVENT-EAP-SUCCESS')
|
||||
|
||||
condition = 'obj.connected'
|
||||
wd.wait_for_object_condition(ordered_network.network_object, condition)
|
||||
|
Loading…
Reference in New Issue
Block a user