mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2025-01-03 10:32:33 +01:00
auto-t: fix up a few issues in testNetconfig
- Setting the IP address was resulting in an error: Error: any valid prefix is expected rather than "wln58". This is fixed by reordering the arguments with the IP address first - Remove the sleep, and use non_block_wait to wait for the IPv6 address to be set.
This commit is contained in:
parent
b1bc8fb7fb
commit
416ad05ce7
@ -17,6 +17,15 @@ import subprocess
|
|||||||
class Test(unittest.TestCase):
|
class Test(unittest.TestCase):
|
||||||
|
|
||||||
def test_connection_success(self):
|
def test_connection_success(self):
|
||||||
|
def check_addr(device):
|
||||||
|
try:
|
||||||
|
subprocess.check_output('ip addr show ' + device.name + \
|
||||||
|
' | grep \'inet6 3ffe:501:ffff:100::\'', shell=True)
|
||||||
|
except:
|
||||||
|
return False
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
wd = IWD(True)
|
wd = IWD(True)
|
||||||
|
|
||||||
psk_agent = PSKAgent("secret123")
|
psk_agent = PSKAgent("secret123")
|
||||||
@ -40,9 +49,8 @@ class Test(unittest.TestCase):
|
|||||||
testutil.test_iface_operstate()
|
testutil.test_iface_operstate()
|
||||||
testutil.test_ifaces_connected()
|
testutil.test_ifaces_connected()
|
||||||
|
|
||||||
time.sleep(2)
|
ctx.non_block_wait(check_addr, 10, device,
|
||||||
subprocess.check_output('ip addr show ' + device.name + \
|
exception=Exception("IPv6 address was not set"))
|
||||||
' | grep \'inet6 3ffe:501:ffff:100::\'', shell=True)
|
|
||||||
|
|
||||||
device.disconnect()
|
device.disconnect()
|
||||||
|
|
||||||
@ -70,15 +78,15 @@ class Test(unittest.TestCase):
|
|||||||
# TODO: This could be moved into test-runner itself if other tests ever
|
# TODO: This could be moved into test-runner itself if other tests ever
|
||||||
# require this functionality (p2p, FILS, etc.). Since its simple
|
# require this functionality (p2p, FILS, etc.). Since its simple
|
||||||
# enough it can stay here for now.
|
# enough it can stay here for now.
|
||||||
ctx.start_process(['ip', 'addr','add','dev', hapd.ifname,
|
ctx.start_process(['ip', 'addr','add', '192.168.1.1/255.255.255.0',
|
||||||
'192.168.1.1/255.255.255.0']).wait()
|
'dev', hapd.ifname,]).wait()
|
||||||
ctx.start_process(['touch', '/tmp/dhcpd.leases']).wait()
|
ctx.start_process(['touch', '/tmp/dhcpd.leases']).wait()
|
||||||
cls.dhcpd_pid = ctx.start_process(['dhcpd', '-f', '-cf', '/tmp/dhcpd.conf',
|
cls.dhcpd_pid = ctx.start_process(['dhcpd', '-f', '-cf', '/tmp/dhcpd.conf',
|
||||||
'-lf', '/tmp/dhcpd.leases',
|
'-lf', '/tmp/dhcpd.leases',
|
||||||
hapd.ifname], cleanup=remove_lease4)
|
hapd.ifname], cleanup=remove_lease4)
|
||||||
|
|
||||||
ctx.start_process(['ip', 'addr', 'add', 'dev', hapd.ifname,
|
ctx.start_process(['ip', 'addr', 'add', '3ffe:501:ffff:100::1/64',
|
||||||
'3ffe:501:ffff:100::1/64']).wait()
|
'dev', hapd.ifname]).wait()
|
||||||
ctx.start_process(['touch', '/tmp/dhcpd6.leases']).wait()
|
ctx.start_process(['touch', '/tmp/dhcpd6.leases']).wait()
|
||||||
cls.dhcpd6_pid = ctx.start_process(['dhcpd', '-6', '-f', '-cf', '/tmp/dhcpd-v6.conf',
|
cls.dhcpd6_pid = ctx.start_process(['dhcpd', '-6', '-f', '-cf', '/tmp/dhcpd-v6.conf',
|
||||||
'-lf', '/tmp/dhcpd6.leases',
|
'-lf', '/tmp/dhcpd6.leases',
|
||||||
|
@ -81,7 +81,8 @@ class Test(unittest.TestCase):
|
|||||||
# TODO: This could be moved into test-runner itself if other tests ever
|
# TODO: This could be moved into test-runner itself if other tests ever
|
||||||
# require this functionality (p2p, FILS, etc.). Since its simple
|
# require this functionality (p2p, FILS, etc.). Since its simple
|
||||||
# enough it can stay here for now.
|
# enough it can stay here for now.
|
||||||
ctx.start_process(['ip', 'addr','add', hapd.ifname, '192.168.1.1/255.255.255.0']).wait()
|
ctx.start_process(['ip', 'addr','add', '192.168.1.1/255.255.255.0',
|
||||||
|
'dev', hapd.ifname]).wait()
|
||||||
ctx.start_process(['touch', '/tmp/dhcpd.leases']).wait()
|
ctx.start_process(['touch', '/tmp/dhcpd.leases']).wait()
|
||||||
cls.dhcpd_pid = ctx.start_process(['dhcpd', '-f', '-cf', '/tmp/dhcpd.conf',
|
cls.dhcpd_pid = ctx.start_process(['dhcpd', '-f', '-cf', '/tmp/dhcpd.conf',
|
||||||
'-lf', '/tmp/dhcpd.leases',
|
'-lf', '/tmp/dhcpd.leases',
|
||||||
|
Loading…
Reference in New Issue
Block a user