mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-25 09:39:25 +01:00
auto-t: Adhoc autotests
This commit is contained in:
parent
12b3ac47fd
commit
bea6a9f522
43
autotests/testAdHoc/adhoc_test.py
Normal file
43
autotests/testAdHoc/adhoc_test.py
Normal file
@ -0,0 +1,43 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
import unittest
|
||||
import sys
|
||||
import time
|
||||
from time import sleep
|
||||
|
||||
sys.path.append('../util')
|
||||
import iwd
|
||||
from iwd import IWD
|
||||
import testutil
|
||||
|
||||
class Test(unittest.TestCase):
|
||||
|
||||
def test_connection_success(self):
|
||||
wd = IWD(True)
|
||||
|
||||
dev1, dev2 = wd.list_devices(2)
|
||||
|
||||
self.assertIsNotNone(dev1)
|
||||
self.assertIsNotNone(dev2)
|
||||
|
||||
dev1.start_adhoc("AdHocNetwork", "secret123")
|
||||
sleep(1)
|
||||
dev2.start_adhoc("AdHocNetwork", "secret123")
|
||||
|
||||
dev1.adhoc_wait_for_connected(dev2.address)
|
||||
dev2.adhoc_wait_for_connected(dev1.address)
|
||||
|
||||
testutil.test_iface_operstate(dev1.name)
|
||||
testutil.test_iface_operstate(dev2.name)
|
||||
testutil.test_ifaces_connected(dev1.name, dev2.name)
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
IWD.clear_storage()
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main(exit=True)
|
44
autotests/testAdHoc/failure_test.py
Normal file
44
autotests/testAdHoc/failure_test.py
Normal file
@ -0,0 +1,44 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
import unittest
|
||||
import sys
|
||||
import time
|
||||
from time import sleep
|
||||
|
||||
sys.path.append('../util')
|
||||
import iwd
|
||||
from iwd import IWD
|
||||
import testutil
|
||||
|
||||
class Test(unittest.TestCase):
|
||||
|
||||
def test_connection_success(self):
|
||||
wd = IWD(True)
|
||||
|
||||
dev1, dev2 = wd.list_devices(2)
|
||||
|
||||
self.assertIsNotNone(dev1)
|
||||
self.assertIsNotNone(dev2)
|
||||
|
||||
dev1.start_adhoc("AdHocNetwork", "secret123")
|
||||
sleep(1)
|
||||
dev2.start_adhoc("AdHocNetwork", "InvalidPassword")
|
||||
|
||||
wd.wait(15)
|
||||
# dev1.adhoc_wait_for_connected(dev2.address)
|
||||
# dev2.adhoc_wait_for_connected(dev1.address)
|
||||
|
||||
# testutil.test_iface_operstate(dev1.name)
|
||||
# testutil.test_iface_operstate(dev2.name)
|
||||
# testutil.test_ifaces_connected(dev1.name, dev2.name)
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
IWD.clear_storage()
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main(exit=True)
|
4
autotests/testAdHoc/hw.conf
Normal file
4
autotests/testAdHoc/hw.conf
Normal file
@ -0,0 +1,4 @@
|
||||
[SETUP]
|
||||
num_radios=2
|
||||
max_test_exec_interval_sec=35
|
||||
start_iwd=0
|
43
autotests/testAdHoc/open_test.py
Normal file
43
autotests/testAdHoc/open_test.py
Normal file
@ -0,0 +1,43 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
import unittest
|
||||
import sys
|
||||
import time
|
||||
from time import sleep
|
||||
|
||||
sys.path.append('../util')
|
||||
import iwd
|
||||
from iwd import IWD
|
||||
import testutil
|
||||
|
||||
class Test(unittest.TestCase):
|
||||
|
||||
def test_connection_success(self):
|
||||
wd = IWD(True)
|
||||
|
||||
dev1, dev2 = wd.list_devices(2)
|
||||
|
||||
self.assertIsNotNone(dev1)
|
||||
self.assertIsNotNone(dev2)
|
||||
|
||||
dev1.start_adhoc("AdHocNetwork")
|
||||
sleep(1)
|
||||
dev2.start_adhoc("AdHocNetwork")
|
||||
|
||||
dev1.adhoc_wait_for_connected(dev2.address)
|
||||
dev2.adhoc_wait_for_connected(dev1.address)
|
||||
|
||||
#testutil.test_iface_operstate(dev1.name)
|
||||
#testutil.test_iface_operstate(dev2.name)
|
||||
#testutil.test_ifaces_connected(dev1.name, dev2.name)
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
IWD.clear_storage()
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main(exit=True)
|
Loading…
Reference in New Issue
Block a user