3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-10-01 17:16:41 +02:00

auto-t: testutil: wait for operstate

Depending on timing the operstate may not be set even when IWD shows
as connected. Instead wait for the operstate to become set.
This commit is contained in:
James Prestwood 2022-03-30 13:23:12 -07:00 committed by Denis Kenzior
parent a773aa6a07
commit 1fca13f07a

View File

@ -134,10 +134,7 @@ SIOCGIFADDR = 0x8915
IFF_UP = 1 << 0
IFF_RUNNING = 1 << 6
def test_iface_operstate(intf=None):
if not intf:
intf = iwd.IWD.get_instance().list_devices()[0].name
def _test_operstate(intf):
sock = socket.socket(socket.PF_PACKET, socket.SOCK_RAW)
try:
@ -146,10 +143,19 @@ def test_iface_operstate(intf=None):
# IFF_LOWER_UP and IFF_DORMANT not returned by SIOCGIFFLAGS
if flags & (IFF_UP | IFF_RUNNING) != IFF_UP | IFF_RUNNING:
raise Exception(intf + ' operstate wrong')
return False
return True
finally:
sock.close()
def test_iface_operstate(intf=None):
if not intf:
intf = iwd.IWD.get_instance().list_devices()[0].name
ctx.non_block_wait(_test_operstate, 10, intf,
exception=Exception(intf + ' operstate wrong'))
def test_ip_address_match(intf, ip):
try:
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)