3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-25 17:59:25 +01:00

testutil: retry up to 3 times for connectivity

This commit is contained in:
James Prestwood 2019-03-18 10:41:16 -07:00 committed by Denis Kenzior
parent 55b3a974c6
commit 06ee531749

View File

@ -50,7 +50,7 @@ def tx(fromsock, tosock, src, dst):
return (frame, fromsock, tosock, src, dst)
def test_ifaces_connected(if0=None, if1=None):
def test_connected(if0=None, if1=None):
for wname in wiphy.wiphy_map:
for intf in wiphy.wiphy_map[wname]:
if if0 is None:
@ -101,6 +101,20 @@ def test_ifaces_connected(if0=None, if1=None):
sock0.close()
sock1.close()
def test_ifaces_connected(if0=None, if1=None):
retry = 0
while True:
try:
test_connected(if0, if1)
break
except Exception as e:
if retry < 3:
print('retrying connection test: %i' % retry)
retry += 1
continue
raise e
SIOCGIFFLAGS = 0x8913
IFF_UP = 1 << 0
IFF_RUNNING = 1 << 6