From d6c129a30bff0ac7597bef112a8c566a34ced50a Mon Sep 17 00:00:00 2001 From: James Prestwood Date: Thu, 30 Jun 2022 11:03:28 -0700 Subject: [PATCH] auto-t: add client test to testAdHoc Tests iwctl functionality with ad-hoc commands --- autotests/testAdHoc/adhoc_test.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/autotests/testAdHoc/adhoc_test.py b/autotests/testAdHoc/adhoc_test.py index 13c0c016..4c5d5023 100644 --- a/autotests/testAdHoc/adhoc_test.py +++ b/autotests/testAdHoc/adhoc_test.py @@ -2,16 +2,16 @@ import unittest import sys -import time sys.path.append('../util') -import iwd from iwd import IWD +from iwd import AdHocDevice +from config import ctx import testutil class Test(unittest.TestCase): - def validate_connection(self, wd): + def validate_connection(self, wd, client=False): dev1, dev2 = wd.list_devices(2) self.assertIsNotNone(dev1) @@ -22,7 +22,14 @@ class Test(unittest.TestCase): condition = 'obj.started == True' 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' wd.wait_for_object_condition(adhoc1, condition) @@ -42,6 +49,10 @@ class Test(unittest.TestCase): self.validate_connection(wd) + def test_client_adhoc(self): + wd = IWD(True) + self.validate_connection(wd, client=True) + @classmethod def setUpClass(cls): pass