mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-22 06:29:23 +01:00
auto-t: add client test to testAdHoc
Tests iwctl functionality with ad-hoc commands
This commit is contained in:
parent
ac2aee288f
commit
d6c129a30b
@ -2,16 +2,16 @@
|
|||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
import sys
|
import sys
|
||||||
import time
|
|
||||||
|
|
||||||
sys.path.append('../util')
|
sys.path.append('../util')
|
||||||
import iwd
|
|
||||||
from iwd import IWD
|
from iwd import IWD
|
||||||
|
from iwd import AdHocDevice
|
||||||
|
from config import ctx
|
||||||
import testutil
|
import testutil
|
||||||
|
|
||||||
class Test(unittest.TestCase):
|
class Test(unittest.TestCase):
|
||||||
|
|
||||||
def validate_connection(self, wd):
|
def validate_connection(self, wd, client=False):
|
||||||
dev1, dev2 = wd.list_devices(2)
|
dev1, dev2 = wd.list_devices(2)
|
||||||
|
|
||||||
self.assertIsNotNone(dev1)
|
self.assertIsNotNone(dev1)
|
||||||
@ -22,7 +22,14 @@ class Test(unittest.TestCase):
|
|||||||
condition = 'obj.started == True'
|
condition = 'obj.started == True'
|
||||||
wd.wait_for_object_condition(adhoc1, condition)
|
wd.wait_for_object_condition(adhoc1, condition)
|
||||||
|
|
||||||
adhoc2 = dev2.start_adhoc("AdHocNetwork", "secret123")
|
if not client:
|
||||||
|
adhoc2 = dev2.start_adhoc("AdHocNetwork", "secret123")
|
||||||
|
else:
|
||||||
|
ctx.start_process(['iwctl', 'device', dev2.name, 'set-property',
|
||||||
|
'Mode', 'ad-hoc'], check=True)
|
||||||
|
ctx.start_process(['iwctl', 'ad-hoc', dev2.name, 'start',
|
||||||
|
'AdHocNetwork', 'secret123'], check=True)
|
||||||
|
adhoc2 = AdHocDevice(dev2.device_path)
|
||||||
|
|
||||||
condition = 'obj.started == True'
|
condition = 'obj.started == True'
|
||||||
wd.wait_for_object_condition(adhoc1, condition)
|
wd.wait_for_object_condition(adhoc1, condition)
|
||||||
@ -42,6 +49,10 @@ class Test(unittest.TestCase):
|
|||||||
|
|
||||||
self.validate_connection(wd)
|
self.validate_connection(wd)
|
||||||
|
|
||||||
|
def test_client_adhoc(self):
|
||||||
|
wd = IWD(True)
|
||||||
|
self.validate_connection(wd, client=True)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
pass
|
pass
|
||||||
|
Loading…
Reference in New Issue
Block a user