Skip to content

Commit 4e6847d

Browse files
[MCORE.FS 1.3] make "app not found" easier to debug (#35038)
* Remove unused method, make missing app error easier to find * Remove more todo for confirm we can run apps: we confirmed we can --------- Co-authored-by: Andrei Litvin <andreilitvin@google.com>
1 parent 15032f1 commit 4e6847d

File tree

3 files changed

+12
-26
lines changed

3 files changed

+12
-26
lines changed

src/python_testing/TC_CCTRL_2_2.py

-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ class TC_CCTRL_2_2(MatterBaseTest):
4444
@async_test_body
4545
async def setup_class(self):
4646
super().setup_class()
47-
# TODO: confirm whether we can open processes like this on the TH
4847
self.app_process = None
4948
app = self.user_params.get("th_server_app_path", None)
5049
if not app:

src/python_testing/TC_MCORE_FS_1_1.py

-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ class TC_MCORE_FS_1_1(MatterBaseTest):
3636
@async_test_body
3737
async def setup_class(self):
3838
super().setup_class()
39-
# TODO: confirm whether we can open processes like this on the TH
4039
self.app_process = None
4140
app = self.user_params.get("th_server_app_path", None)
4241
if not app:

src/python_testing/TC_MCORE_FS_1_3.py

+12-24
Original file line numberDiff line numberDiff line change
@@ -68,45 +68,32 @@ def teardown_class(self):
6868
super().teardown_class()
6969

7070
async def create_device_and_commission_to_th_fabric(self, kvs, port, node_id_for_th, device_info):
71-
# TODO: confirm whether we can open processes like this on the TH
7271
app = self.user_params.get("th_server_app_path", None)
7372
if not app:
7473
asserts.fail('This test requires a TH_SERVER app. Specify app path with --string-arg th_server_app_path:<path_to_app>')
7574

75+
if not os.path.exists(app):
76+
asserts.fail(f'The path {app} does not exist')
77+
7678
discriminator = random.randint(0, 4095)
7779
passcode = 20202021
78-
app_args = f'--secured-device-port {port} --discriminator {discriminator} --passcode {passcode} --KVS {kvs}'
79-
cmd = f'{app} {app_args}'
80+
81+
cmd = [app]
82+
cmd.extend(['--secured-device-port', str(port)])
83+
cmd.extend(['--discriminator', str(discriminator)])
84+
cmd.extend(['--passcode', str(passcode)])
85+
cmd.extend(['--KVS', kvs])
86+
8087
# TODO: Determine if we want these logs cooked or pushed to somewhere else
8188
logging.info(f"Starting TH device for {device_info}")
82-
self.app_process_for_dut_eco = subprocess.Popen(cmd, bufsize=0, shell=True)
89+
self.app_process_for_dut_eco = subprocess.Popen(cmd)
8390
logging.info(f"Started TH device for {device_info}")
8491
time.sleep(3)
8592

8693
logging.info("Commissioning from separate fabric")
8794
await self.TH_server_controller.CommissionOnNetwork(nodeId=node_id_for_th, setupPinCode=passcode, filterType=ChipDeviceCtrl.DiscoveryFilterType.LONG_DISCRIMINATOR, filter=discriminator)
8895
logging.info("Commissioning device for DUT ecosystem onto TH for managing")
8996

90-
async def create_and_commission_device_for_th_ecosystem(self):
91-
# TODO: confirm whether we can open processes like this on the TH
92-
app = self.user_params.get("th_server_app_path", None)
93-
94-
self.device_for_th_eco_kvs = f'kvs_{str(uuid.uuid4())}'
95-
discriminator = random.randint(0, 4095)
96-
passcode = 20202021
97-
app_args = f'--secured-device-port {self.device_for_th_eco_port} --discriminator {discriminator} --passcode {passcode} --KVS {self.device_for_th_eco_kvs}'
98-
cmd = f'{app} {app_args}'
99-
# TODO: Determine if we want these logs cooked or pushed to somewhere else
100-
logging.info("Starting TH device for TH ecosystem")
101-
self.app_process_for_th_eco = subprocess.Popen(cmd, bufsize=0, shell=True)
102-
logging.info("Started TH device for TH ecosystem")
103-
time.sleep(3)
104-
105-
logging.info("Commissioning from separate fabric")
106-
self.server_nodeid = 1112
107-
await self.TH_server_controller.CommissionOnNetwork(nodeId=self.server_nodeid, setupPinCode=passcode, filterType=ChipDeviceCtrl.DiscoveryFilterType.LONG_DISCRIMINATOR, filter=discriminator)
108-
logging.info("Commissioning TH device for TH ecosystem")
109-
11097
def steps_TC_MCORE_FS_1_3(self) -> list[TestStep]:
11198
steps = [TestStep(1, "DUT_FSA commissions TH_SED_DUT to DUT_FSAs fabric and generates a UniqueID", is_commissioning=True),
11299
TestStep(2, "TH_FSA commissions TH_SED_TH onto TH_FSAs fabric and generates a UniqueID."),
@@ -127,6 +114,7 @@ async def test_TC_MCORE_FS_1_3(self):
127114
kvs = f'kvs_{str(uuid.uuid4())}'
128115
device_info = "for DUT ecosystem"
129116
await self.create_device_and_commission_to_th_fabric(kvs, self.device_for_dut_eco_port, self.device_for_dut_eco_nodeid, device_info)
117+
130118
self.device_for_dut_eco_kvs = kvs
131119
read_result = await self.TH_server_controller.ReadAttribute(self.device_for_dut_eco_nodeid, [(root_node_endpoint, Clusters.BasicInformation.Attributes.UniqueID)])
132120
result = read_result[root_node_endpoint][Clusters.BasicInformation][Clusters.BasicInformation.Attributes.UniqueID]

0 commit comments

Comments
 (0)