mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-22 21:22:37 +01:00
auto-t: cleanup dhcpd.leases[~] in testNetconfig
This commit is contained in:
parent
5c14742a87
commit
382b73c11a
@ -48,6 +48,13 @@ class Test(unittest.TestCase):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
|
def remove_lease():
|
||||||
|
try:
|
||||||
|
os.remove('/tmp/dhcpd.leases')
|
||||||
|
os.remove('/tmp/dhcpd.leases~')
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
hapd = HostapdCLI()
|
hapd = HostapdCLI()
|
||||||
# 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
|
||||||
@ -57,14 +64,13 @@ class Test(unittest.TestCase):
|
|||||||
ctx.start_process(['touch', '/tmp/dhcpd.leases'], wait=True)
|
ctx.start_process(['touch', '/tmp/dhcpd.leases'], wait=True)
|
||||||
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])
|
hapd.ifname], cleanup=remove_lease)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
IWD.clear_storage()
|
IWD.clear_storage()
|
||||||
ctx.stop_process(cls.dhcpd_pid)
|
ctx.stop_process(cls.dhcpd_pid)
|
||||||
cls.dhcpd_pid = None
|
cls.dhcpd_pid = None
|
||||||
os.remove('/tmp/dhcpd.leases')
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main(exit=True)
|
unittest.main(exit=True)
|
||||||
|
@ -75,6 +75,13 @@ class Test(unittest.TestCase):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
|
def remove_lease():
|
||||||
|
try:
|
||||||
|
os.remove('/tmp/dhcpd.leases')
|
||||||
|
os.remove('/tmp/dhcpd.leases~')
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
hapd = HostapdCLI()
|
hapd = HostapdCLI()
|
||||||
# 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
|
||||||
@ -84,14 +91,13 @@ class Test(unittest.TestCase):
|
|||||||
ctx.start_process(['touch', '/tmp/dhcpd.leases'], wait=True)
|
ctx.start_process(['touch', '/tmp/dhcpd.leases'], wait=True)
|
||||||
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])
|
hapd.ifname], cleanup=remove_lease)
|
||||||
IWD.copy_to_storage('ssidTKIP.psk', '/tmp/storage')
|
IWD.copy_to_storage('ssidTKIP.psk', '/tmp/storage')
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
IWD.clear_storage()
|
IWD.clear_storage()
|
||||||
cls.dhcpd_pid.kill()
|
cls.dhcpd_pid.kill()
|
||||||
os.system('rm -rf /tmp/dhcpd.leases')
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main(exit=True)
|
unittest.main(exit=True)
|
||||||
|
Loading…
Reference in New Issue
Block a user