mirror of
				https://git.kernel.org/pub/scm/network/wireless/iwd.git
				synced 2025-11-04 08:57:29 +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
 | 
			
		||||
    def setUpClass(cls):
 | 
			
		||||
        def remove_lease():
 | 
			
		||||
            try:
 | 
			
		||||
                os.remove('/tmp/dhcpd.leases')
 | 
			
		||||
                os.remove('/tmp/dhcpd.leases~')
 | 
			
		||||
            except:
 | 
			
		||||
                pass
 | 
			
		||||
 | 
			
		||||
        hapd = HostapdCLI()
 | 
			
		||||
        # TODO: This could be moved into test-runner itself if other tests ever
 | 
			
		||||
        #       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)
 | 
			
		||||
        cls.dhcpd_pid = ctx.start_process(['dhcpd', '-f', '-cf', '/tmp/dhcpd.conf',
 | 
			
		||||
                                            '-lf', '/tmp/dhcpd.leases',
 | 
			
		||||
                                            hapd.ifname])
 | 
			
		||||
                                            hapd.ifname], cleanup=remove_lease)
 | 
			
		||||
 | 
			
		||||
    @classmethod
 | 
			
		||||
    def tearDownClass(cls):
 | 
			
		||||
        IWD.clear_storage()
 | 
			
		||||
        ctx.stop_process(cls.dhcpd_pid)
 | 
			
		||||
        cls.dhcpd_pid = None
 | 
			
		||||
        os.remove('/tmp/dhcpd.leases')
 | 
			
		||||
 | 
			
		||||
if __name__ == '__main__':
 | 
			
		||||
    unittest.main(exit=True)
 | 
			
		||||
 | 
			
		||||
@ -75,6 +75,13 @@ class Test(unittest.TestCase):
 | 
			
		||||
 | 
			
		||||
    @classmethod
 | 
			
		||||
    def setUpClass(cls):
 | 
			
		||||
        def remove_lease():
 | 
			
		||||
            try:
 | 
			
		||||
                os.remove('/tmp/dhcpd.leases')
 | 
			
		||||
                os.remove('/tmp/dhcpd.leases~')
 | 
			
		||||
            except:
 | 
			
		||||
                pass
 | 
			
		||||
 | 
			
		||||
        hapd = HostapdCLI()
 | 
			
		||||
        # TODO: This could be moved into test-runner itself if other tests ever
 | 
			
		||||
        #       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)
 | 
			
		||||
        cls.dhcpd_pid = ctx.start_process(['dhcpd', '-f', '-cf', '/tmp/dhcpd.conf',
 | 
			
		||||
                                            '-lf', '/tmp/dhcpd.leases',
 | 
			
		||||
                                            hapd.ifname])
 | 
			
		||||
                                            hapd.ifname], cleanup=remove_lease)
 | 
			
		||||
        IWD.copy_to_storage('ssidTKIP.psk', '/tmp/storage')
 | 
			
		||||
 | 
			
		||||
    @classmethod
 | 
			
		||||
    def tearDownClass(cls):
 | 
			
		||||
        IWD.clear_storage()
 | 
			
		||||
        cls.dhcpd_pid.kill()
 | 
			
		||||
        os.system('rm -rf /tmp/dhcpd.leases')
 | 
			
		||||
 | 
			
		||||
if __name__ == '__main__':
 | 
			
		||||
    unittest.main(exit=True)
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user