mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-22 13:02:44 +01:00
auto-t: testutil.py: add expect_fail flag
Several tests tests for connectivity with the expectation that it will fail. This ends up taking 30+ seconds because testutil retries 3 times, each with a 10 second timeout. By passing expect_fail=True this lowers the timeout to zero, and skips any retries.
This commit is contained in:
parent
30158fe89c
commit
518808c709
@ -51,7 +51,12 @@ def tx(fromsock, tosock, src, dst):
|
|||||||
|
|
||||||
return (frame, fromsock, tosock, src, dst)
|
return (frame, fromsock, tosock, src, dst)
|
||||||
|
|
||||||
def test_connected(if0=None, if1=None, group=True):
|
def test_connected(if0=None, if1=None, group=True, expect_fail=False):
|
||||||
|
if expect_fail:
|
||||||
|
timeout = 0
|
||||||
|
else:
|
||||||
|
timeout = 10
|
||||||
|
|
||||||
if if0 is None or if1 is None:
|
if if0 is None or if1 is None:
|
||||||
iwd_list = [dev.name for dev in iwd.IWD.get_instance().list_devices()]
|
iwd_list = [dev.name for dev in iwd.IWD.get_instance().list_devices()]
|
||||||
|
|
||||||
@ -82,7 +87,7 @@ def test_connected(if0=None, if1=None, group=True):
|
|||||||
rec.append(False)
|
rec.append(False)
|
||||||
|
|
||||||
while not all(rec):
|
while not all(rec):
|
||||||
r, w, x = select.select([sock0, sock1], [], [], 10)
|
r, w, x = select.select([sock0, sock1], [], [], timeout)
|
||||||
if not r:
|
if not r:
|
||||||
raise Exception('timeout waiting for packets: ' + repr(rec))
|
raise Exception('timeout waiting for packets: ' + repr(rec))
|
||||||
|
|
||||||
@ -110,15 +115,15 @@ def test_connected(if0=None, if1=None, group=True):
|
|||||||
sock0.close()
|
sock0.close()
|
||||||
sock1.close()
|
sock1.close()
|
||||||
|
|
||||||
def test_ifaces_connected(if0=None, if1=None, group=True):
|
def test_ifaces_connected(if0=None, if1=None, group=True, expect_fail=False):
|
||||||
retry = 0
|
retry = 0
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
test_connected(if0, if1, group)
|
test_connected(if0, if1, group, expect_fail)
|
||||||
break
|
break
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if retry < 3:
|
if retry < 3 and not expect_fail:
|
||||||
print('retrying connection test: %i' % retry)
|
print('retrying connection test: %i' % retry)
|
||||||
retry += 1
|
retry += 1
|
||||||
continue
|
continue
|
||||||
|
Loading…
Reference in New Issue
Block a user