3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-26 10:39:23 +01:00

auto-t: Ad-Hoc - remove iwd instance on failure

This commit is contained in:
Tim Kourt 2019-03-15 14:48:56 -07:00 committed by Denis Kenzior
parent 2b544541bc
commit b4485f3e1b
3 changed files with 25 additions and 13 deletions

View File

@ -12,16 +12,13 @@ import testutil
class Test(unittest.TestCase): class Test(unittest.TestCase):
def test_connection_success(self): def validate_connection(self, wd):
wd = IWD(True)
dev1, dev2 = wd.list_devices(2) dev1, dev2 = wd.list_devices(2)
self.assertIsNotNone(dev1) self.assertIsNotNone(dev1)
self.assertIsNotNone(dev2) self.assertIsNotNone(dev2)
dev1.start_adhoc("AdHocNetwork", "secret123") dev1.start_adhoc("AdHocNetwork", "secret123")
sleep(1)
dev2.start_adhoc("AdHocNetwork", "secret123") dev2.start_adhoc("AdHocNetwork", "secret123")
dev1.adhoc_wait_for_connected(dev2.address) dev1.adhoc_wait_for_connected(dev2.address)
@ -31,6 +28,12 @@ class Test(unittest.TestCase):
testutil.test_iface_operstate(dev2.name) testutil.test_iface_operstate(dev2.name)
testutil.test_ifaces_connected(dev1.name, dev2.name) testutil.test_ifaces_connected(dev1.name, dev2.name)
def test_connection_success(self):
wd = IWD(True)
try:
self.validate_connection(wd)
finally:
del wd del wd
@classmethod @classmethod

View File

@ -12,9 +12,7 @@ import testutil
class Test(unittest.TestCase): class Test(unittest.TestCase):
def test_connection_success(self): def validate_connection(self, wd):
wd = IWD(True)
dev1, dev2 = wd.list_devices(2) dev1, dev2 = wd.list_devices(2)
self.assertIsNotNone(dev1) self.assertIsNotNone(dev1)
@ -23,6 +21,7 @@ class Test(unittest.TestCase):
dev1.start_adhoc("AdHocNetwork", "secret123") dev1.start_adhoc("AdHocNetwork", "secret123")
sleep(1) sleep(1)
dev2.start_adhoc("AdHocNetwork", "InvalidPassword") dev2.start_adhoc("AdHocNetwork", "InvalidPassword")
#TODO: This test is unfinished.
# dev1.adhoc_wait_for_connected(dev2.address) # dev1.adhoc_wait_for_connected(dev2.address)
# dev2.adhoc_wait_for_connected(dev1.address) # dev2.adhoc_wait_for_connected(dev1.address)
@ -31,6 +30,12 @@ class Test(unittest.TestCase):
# testutil.test_iface_operstate(dev2.name) # testutil.test_iface_operstate(dev2.name)
# testutil.test_ifaces_connected(dev1.name, dev2.name) # testutil.test_ifaces_connected(dev1.name, dev2.name)
def test_connection_failure(self):
wd = IWD(True)
try:
self.validate_connection(wd)
finally:
del wd del wd
@classmethod @classmethod

View File

@ -12,9 +12,7 @@ import testutil
class Test(unittest.TestCase): class Test(unittest.TestCase):
def test_connection_success(self): def validate_connection(self, wd):
wd = IWD(True)
dev1, dev2 = wd.list_devices(2) dev1, dev2 = wd.list_devices(2)
self.assertIsNotNone(dev1) self.assertIsNotNone(dev1)
@ -31,6 +29,12 @@ class Test(unittest.TestCase):
#testutil.test_iface_operstate(dev2.name) #testutil.test_iface_operstate(dev2.name)
#testutil.test_ifaces_connected(dev1.name, dev2.name) #testutil.test_ifaces_connected(dev1.name, dev2.name)
def test_connection_success(self):
wd = IWD(True)
try:
self.validate_connection(wd)
finally:
del wd del wd
@classmethod @classmethod