From cfa0fcf811d548f8c22a0aa423010f530adaa441 Mon Sep 17 00:00:00 2001 From: Jake Ororke Date: Tue, 27 Aug 2024 10:03:39 -0700 Subject: [PATCH 1/9] [Fix] Replaced automatable PICS in SEAR tests: - Replaced automatable PICS in SEAR 1.3, 1.5, and 1.6 test modules. --- src/python_testing/TC_SEAR_1_3.py | 7 ++++--- src/python_testing/TC_SEAR_1_5.py | 12 +++++++----- src/python_testing/TC_SEAR_1_6.py | 18 +++++++++++++++++- 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/src/python_testing/TC_SEAR_1_3.py b/src/python_testing/TC_SEAR_1_3.py index 867cdcbe234353..2d7010e9fb1f44 100644 --- a/src/python_testing/TC_SEAR_1_3.py +++ b/src/python_testing/TC_SEAR_1_3.py @@ -96,6 +96,8 @@ async def test_TC_SEAR_1_3(self): asserts.fail("The --app-pid flag must be set when PICS_SDK_CI_ONLY is set") self.app_pipe = self.app_pipe + str(app_pid) + features = await self.read_sear_attribute_expect_success(endpoint=self.endpoint, attribute=Clusters.ServiceArea.Attributes.FeatureMap) + self.print_step(1, "Commissioning, already done") # Ensure that the device is in the correct state @@ -156,11 +158,10 @@ async def test_TC_SEAR_1_3(self): else: self.wait_for_user_input(prompt_msg=f"{test_step}, and press Enter when done.\n") - if self.check_pics("SEAR.S.F00"): - await self.send_cmd_select_areas_expect_response(step=15, new_areas=[valid_area_id], expected_response=Clusters.ServiceArea.Enums.SelectAreasStatus.kSuccess) + if bool(features & Clusters.ServiceArea.Bitmaps.Feature.kSelectWhileRunning): + await self.send_cmd_select_areas_expect_response(step=14, new_areas=[valid_area_id], expected_response=Clusters.ServiceArea.Enums.SelectAreasStatus.kSuccess) else: await self.send_cmd_select_areas_expect_response(step=15, new_areas=[valid_area_id], expected_response=Clusters.ServiceArea.Enums.SelectAreasStatus.kInvalidInMode) - if __name__ == "__main__": default_matter_test_main() diff --git a/src/python_testing/TC_SEAR_1_5.py b/src/python_testing/TC_SEAR_1_5.py index a90c1feaf9c329..b6b2e882aa38c7 100644 --- a/src/python_testing/TC_SEAR_1_5.py +++ b/src/python_testing/TC_SEAR_1_5.py @@ -112,6 +112,8 @@ async def test_TC_SEAR_1_5(self): asserts.fail("The --app-pid flag must be set when PICS_SDK_CI_ONLY is set") self.app_pipe = self.app_pipe + str(app_pid) + attribute_list = await self.read_sear_attribute_expect_success( + endpoint=self.endpoint, attribute=Clusters.ServiceArea.Attributes.AttributeList) self.print_step(1, "Commissioning, already done") # Ensure that the device is in the correct state @@ -163,8 +165,8 @@ async def test_TC_SEAR_1_5(self): if not self.check_pics("SEAR.S.M.VALID_STATE_FOR_SKIP"): return - - if self.check_pics("SEAR.S.A0005"): + + if Clusters.ServiceArea.Attributes.Progress.attribute_id in attribute_list: old_progress_list = await self.read_progress(step=9) asserts.assert_true(len(old_progress_list) > 0, f"len of Progress({len(old_progress_list)}) should not be zero)") @@ -172,7 +174,7 @@ async def test_TC_SEAR_1_5(self): asserts.assert_true(len(selected_areas) > 0, "SelectedAreas is empty") old_current_area = NullValue - if self.check_pics("SEAR.S.A0003"): + if Clusters.ServiceArea.Attributes.CurrentArea.attribute_id in attribute_list: old_current_area = await self.read_current_area(step=11) self.print_step("12", "") @@ -186,7 +188,7 @@ async def test_TC_SEAR_1_5(self): if not self.is_ci: self.wait_for_user_input(prompt_msg=f"{test_step}, and press Enter when done.\n") - if self.check_pics("SEAR.S.A0005"): + if Clusters.ServiceArea.Attributes.Progress.attribute_id in attribute_list: new_progress_list = await self.read_progress(step=15) asserts.assert_true(len(new_progress_list) > 0, f"len of Progress({len(new_progress_list)}) should not be zero)") @@ -227,7 +229,7 @@ async def test_TC_SEAR_1_5(self): self.print_step("17", "") return - if not self.check_pics("SEAR.S.A0005"): + if Clusters.ServiceArea.Attributes.Progress.attribute_id not in attribute_list: return if self.check_pics("SEAR.S.M.HAS_MANUAL_SKIP_STATE_CONTROL"): diff --git a/src/python_testing/TC_SEAR_1_6.py b/src/python_testing/TC_SEAR_1_6.py index aaa6ac788dd427..dd13322ff64e03 100644 --- a/src/python_testing/TC_SEAR_1_6.py +++ b/src/python_testing/TC_SEAR_1_6.py @@ -81,7 +81,7 @@ def write_to_app_pipe(self, command): sleep(0.001) def TC_SEAR_1_6(self) -> list[str]: - return ["SEAR.S", "SEAR.S.A0005", "SEAR.S.A0000", "SEAR.S.A0002", "SEAR.S.M.HAS_MANUAL_OPERATING_STATE_CONTROL"] + return ["SEAR.S", "SEAR.S.M.HAS_MANUAL_OPERATING_STATE_CONTROL"] @async_test_body async def test_TC_SEAR_1_6(self): @@ -94,6 +94,22 @@ async def test_TC_SEAR_1_6(self): asserts.fail("The --app-pid flag must be set when PICS_SDK_CI_ONLY is set") self.app_pipe = self.app_pipe + str(app_pid) + attributes = Clusters.ServiceArea.Attributes + attribute_list = await self.read_sear_attribute_expect_success( + endpoint=self.endpoint, attribute=Clusters.ServiceArea.Attributes.AttributeList) + SupportedAreas = attributes.SupportedAreas.attribute_id + SelectedAreas = attributes.SelectedAreas.attribute_id + Progress = attributes.Progress.attribute_id + + if SupportedAreas not in attribute_list: + asserts.fail("Supported areas attribute required in attribute list to run test") + + if SelectedAreas not in attribute_list: + asserts.fail("Selected areas attribute required in attribute list to run test") + + if SelectedAreas not in attribute_list: + asserts.fail("Progress attribute required in attribute list to run test") + self.print_step(1, "Commissioning, already done") # Ensure that the device is in the correct state From 5ad2b475809bae105f5b4478fbbbb1ef1d36b25c Mon Sep 17 00:00:00 2001 From: Jake Ororke Date: Tue, 27 Aug 2024 11:19:13 -0700 Subject: [PATCH 2/9] Updated TC_SEAR_1_6 test module: - resolved linting issue --- src/python_testing/TC_SEAR_1_6.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/python_testing/TC_SEAR_1_6.py b/src/python_testing/TC_SEAR_1_6.py index dd13322ff64e03..2fcb998efa7414 100644 --- a/src/python_testing/TC_SEAR_1_6.py +++ b/src/python_testing/TC_SEAR_1_6.py @@ -107,7 +107,7 @@ async def test_TC_SEAR_1_6(self): if SelectedAreas not in attribute_list: asserts.fail("Selected areas attribute required in attribute list to run test") - if SelectedAreas not in attribute_list: + if Progress not in attribute_list: asserts.fail("Progress attribute required in attribute list to run test") self.print_step(1, "Commissioning, already done") From 32cd0adc1dad86d5696ae03e333690ed51592a86 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Tue, 27 Aug 2024 18:20:36 +0000 Subject: [PATCH 3/9] Restyled by autopep8 --- src/python_testing/TC_SEAR_1_3.py | 1 + src/python_testing/TC_SEAR_1_5.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/python_testing/TC_SEAR_1_3.py b/src/python_testing/TC_SEAR_1_3.py index 2d7010e9fb1f44..0d082a85f0233d 100644 --- a/src/python_testing/TC_SEAR_1_3.py +++ b/src/python_testing/TC_SEAR_1_3.py @@ -163,5 +163,6 @@ async def test_TC_SEAR_1_3(self): else: await self.send_cmd_select_areas_expect_response(step=15, new_areas=[valid_area_id], expected_response=Clusters.ServiceArea.Enums.SelectAreasStatus.kInvalidInMode) + if __name__ == "__main__": default_matter_test_main() diff --git a/src/python_testing/TC_SEAR_1_5.py b/src/python_testing/TC_SEAR_1_5.py index b6b2e882aa38c7..364ff7e7fad666 100644 --- a/src/python_testing/TC_SEAR_1_5.py +++ b/src/python_testing/TC_SEAR_1_5.py @@ -165,7 +165,7 @@ async def test_TC_SEAR_1_5(self): if not self.check_pics("SEAR.S.M.VALID_STATE_FOR_SKIP"): return - + if Clusters.ServiceArea.Attributes.Progress.attribute_id in attribute_list: old_progress_list = await self.read_progress(step=9) asserts.assert_true(len(old_progress_list) > 0, f"len of Progress({len(old_progress_list)}) should not be zero)") From c2829afc50590b1fe1dff8977cd8b91e241dfa6b Mon Sep 17 00:00:00 2001 From: Jake Ororke Date: Thu, 29 Aug 2024 16:03:36 -0700 Subject: [PATCH 4/9] Updated TC_SEAR_1_5 test module: - Replaced C02.Rsp with SkipArea command id check against accepted commands list for SearchArea cluster --- src/python_testing/TC_SEAR_1_5.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/python_testing/TC_SEAR_1_5.py b/src/python_testing/TC_SEAR_1_5.py index 364ff7e7fad666..848f4c26eedc40 100644 --- a/src/python_testing/TC_SEAR_1_5.py +++ b/src/python_testing/TC_SEAR_1_5.py @@ -99,7 +99,7 @@ def write_to_app_pipe(self, command): sleep(0.001) def TC_SEAR_1_5(self) -> list[str]: - return ["SEAR.S", "SEAR.S.C02.Rsp"] + return ["SEAR.S"] @async_test_body async def test_TC_SEAR_1_5(self): @@ -114,6 +114,12 @@ async def test_TC_SEAR_1_5(self): attribute_list = await self.read_sear_attribute_expect_success( endpoint=self.endpoint, attribute=Clusters.ServiceArea.Attributes.AttributeList) + accepted_cmd_list = await self.read_sear_attribute_expect_success( + endpoint=self.endpoint, attribute=Clusters.ServiceArea.Attributes.AcceptedCommandList) + + if Clusters.ServiceArea.Commands.SkipArea.command_id not in accepted_cmd_list: + asserts.fail("Skip Area Response command needs to be supported to run this test") + self.print_step(1, "Commissioning, already done") # Ensure that the device is in the correct state From 5b83c7a649254418efaf04a74cbbc39752f492db Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Thu, 29 Aug 2024 23:06:14 +0000 Subject: [PATCH 5/9] Restyled by autopep8 --- src/python_testing/TC_SEAR_1_5.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/python_testing/TC_SEAR_1_5.py b/src/python_testing/TC_SEAR_1_5.py index 848f4c26eedc40..46c90222161ce5 100644 --- a/src/python_testing/TC_SEAR_1_5.py +++ b/src/python_testing/TC_SEAR_1_5.py @@ -116,7 +116,7 @@ async def test_TC_SEAR_1_5(self): endpoint=self.endpoint, attribute=Clusters.ServiceArea.Attributes.AttributeList) accepted_cmd_list = await self.read_sear_attribute_expect_success( endpoint=self.endpoint, attribute=Clusters.ServiceArea.Attributes.AcceptedCommandList) - + if Clusters.ServiceArea.Commands.SkipArea.command_id not in accepted_cmd_list: asserts.fail("Skip Area Response command needs to be supported to run this test") From c17f287f4d83104d7c3c5814ca3475fc2040675e Mon Sep 17 00:00:00 2001 From: Jake Ororke Date: Mon, 2 Dec 2024 10:27:16 -0800 Subject: [PATCH 6/9] Update TC_SEAR_1_5.py Updating to leave top level PIC's unchanged --- src/python_testing/TC_SEAR_1_5.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/python_testing/TC_SEAR_1_5.py b/src/python_testing/TC_SEAR_1_5.py index d3b7d3e4b30cde..9d726cf277d7fe 100644 --- a/src/python_testing/TC_SEAR_1_5.py +++ b/src/python_testing/TC_SEAR_1_5.py @@ -89,8 +89,8 @@ async def send_cmd_skip_area_expect_response(self, step, skipped_area, expected_ f"Command response ({ret.status}) doesn't match the expected one") def TC_SEAR_1_5(self) -> list[str]: - return ["SEAR.S"] - + return ["SEAR.S", "SEAR.S.C02.Rsp"] + @async_test_body async def test_TC_SEAR_1_5(self): self.endpoint = self.matter_test_config.endpoint From ea856f9df8f7ececa780886a1d27a247c7e26b17 Mon Sep 17 00:00:00 2001 From: Jake Ororke Date: Mon, 2 Dec 2024 10:28:24 -0800 Subject: [PATCH 7/9] Update TC_SEAR_1_6.py Updating to leave top level PICS alone --- src/python_testing/TC_SEAR_1_6.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/python_testing/TC_SEAR_1_6.py b/src/python_testing/TC_SEAR_1_6.py index dca5331aaba57b..6e27f601581a22 100644 --- a/src/python_testing/TC_SEAR_1_6.py +++ b/src/python_testing/TC_SEAR_1_6.py @@ -72,8 +72,8 @@ async def read_progress(self, step): return progress def TC_SEAR_1_6(self) -> list[str]: - return ["SEAR.S", "SEAR.S.M.HAS_MANUAL_OPERATING_STATE_CONTROL"] - + return ["SEAR.S", "SEAR.S.A0005", "SEAR.S.A0000", "SEAR.S.A0002", "SEAR.S.M.HAS_MANUAL_OPERATING_STATE_CONTROL"] + @async_test_body async def test_TC_SEAR_1_6(self): self.endpoint = self.matter_test_config.endpoint From c74e2daaeb3d906cb2c9373fff754e56f723ae4d Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Mon, 2 Dec 2024 18:48:40 +0000 Subject: [PATCH 8/9] Restyled by autopep8 --- src/python_testing/TC_SEAR_1_5.py | 2 +- src/python_testing/TC_SEAR_1_6.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/python_testing/TC_SEAR_1_5.py b/src/python_testing/TC_SEAR_1_5.py index a4d9761dc30a66..beac29e68dd1d7 100644 --- a/src/python_testing/TC_SEAR_1_5.py +++ b/src/python_testing/TC_SEAR_1_5.py @@ -99,7 +99,7 @@ async def send_cmd_skip_area_expect_response(self, step, skipped_area, expected_ def TC_SEAR_1_5(self) -> list[str]: return ["SEAR.S", "SEAR.S.C02.Rsp"] - + @async_test_body async def test_TC_SEAR_1_5(self): self.endpoint = self.get_endpoint() diff --git a/src/python_testing/TC_SEAR_1_6.py b/src/python_testing/TC_SEAR_1_6.py index 1998fa6a6bf95d..a5a2ac73ce07b5 100644 --- a/src/python_testing/TC_SEAR_1_6.py +++ b/src/python_testing/TC_SEAR_1_6.py @@ -82,7 +82,7 @@ async def read_progress(self, step): def TC_SEAR_1_6(self) -> list[str]: return ["SEAR.S", "SEAR.S.A0005", "SEAR.S.A0000", "SEAR.S.A0002", "SEAR.S.M.HAS_MANUAL_OPERATING_STATE_CONTROL"] - + @async_test_body async def test_TC_SEAR_1_6(self): self.endpoint = self.get_endpoint() From 283dbb733de66f06d92361c2e028ed432d32bbba Mon Sep 17 00:00:00 2001 From: Jake Ororke Date: Wed, 18 Dec 2024 19:54:56 -0800 Subject: [PATCH 9/9] Updating TC_SEAR_1_3, TC_SEAR_1_5, and TC_SEAR_1_6 test modules: - Updating to using attribute_guard, command_guard, and feature_guard functions where applicable. --- src/python_testing/TC_SEAR_1_3.py | 4 +--- src/python_testing/TC_SEAR_1_5.py | 15 +++++---------- src/python_testing/TC_SEAR_1_6.py | 11 +++-------- 3 files changed, 9 insertions(+), 21 deletions(-) diff --git a/src/python_testing/TC_SEAR_1_3.py b/src/python_testing/TC_SEAR_1_3.py index bfb9003e463a7c..5e66e54c0c12f6 100644 --- a/src/python_testing/TC_SEAR_1_3.py +++ b/src/python_testing/TC_SEAR_1_3.py @@ -97,8 +97,6 @@ async def test_TC_SEAR_1_3(self): asserts.fail("The --app-pid flag must be set when PICS_SDK_CI_ONLY is set") self.app_pipe = self.app_pipe + str(app_pid) - features = await self.read_sear_attribute_expect_success(endpoint=self.endpoint, attribute=Clusters.ServiceArea.Attributes.FeatureMap) - self.print_step(1, "Commissioning, already done") # Ensure that the device is in the correct state @@ -165,7 +163,7 @@ async def test_TC_SEAR_1_3(self): else: self.wait_for_user_input(prompt_msg=f"{test_step}, and press Enter when done.\n") - if bool(features & Clusters.ServiceArea.Bitmaps.Feature.kSelectWhileRunning): + if await self.feature_guard(endpoint=self.endpoint, cluster=Clusters.ServiceArea, feature_int=Clusters.ServiceArea.Bitmaps.Feature.kSelectWhileRunning): await self.send_cmd_select_areas_expect_response(step=15, new_areas=valid_areas, expected_response=Clusters.ServiceArea.Enums.SelectAreasStatus.kSuccess) else: await self.send_cmd_select_areas_expect_response(step=15, new_areas=valid_areas, expected_response=Clusters.ServiceArea.Enums.SelectAreasStatus.kInvalidInMode) diff --git a/src/python_testing/TC_SEAR_1_5.py b/src/python_testing/TC_SEAR_1_5.py index beac29e68dd1d7..53db09ebe67c05 100644 --- a/src/python_testing/TC_SEAR_1_5.py +++ b/src/python_testing/TC_SEAR_1_5.py @@ -111,12 +111,7 @@ async def test_TC_SEAR_1_5(self): asserts.fail("The --app-pid flag must be set when PICS_SDK_CI_ONLY is set") self.app_pipe = self.app_pipe + str(app_pid) - attribute_list = await self.read_sear_attribute_expect_success( - endpoint=self.endpoint, attribute=Clusters.ServiceArea.Attributes.AttributeList) - accepted_cmd_list = await self.read_sear_attribute_expect_success( - endpoint=self.endpoint, attribute=Clusters.ServiceArea.Attributes.AcceptedCommandList) - - if Clusters.ServiceArea.Commands.SkipArea.command_id not in accepted_cmd_list: + if not await self.command_guard(endpoint=self.endpoint, command=Clusters.ServiceArea.Commands.SkipArea): asserts.fail("Skip Area Response command needs to be supported to run this test") self.print_step(1, "Commissioning, already done") @@ -175,7 +170,7 @@ async def test_TC_SEAR_1_5(self): if not self.check_pics("SEAR.S.M.VALID_STATE_FOR_SKIP"): return - if Clusters.ServiceArea.Attributes.Progress.attribute_id in attribute_list: + if await self.attribute_guard(endpoint=self.endpoint, attribute=Clusters.ServiceArea.Attributes.Progress): old_progress_list = await self.read_progress(step=9) asserts.assert_true(len(old_progress_list) > 0, f"len of Progress({len(old_progress_list)}) should not be zero)") @@ -183,7 +178,7 @@ async def test_TC_SEAR_1_5(self): asserts.assert_true(len(selected_areas) > 0, "SelectedAreas is empty") old_current_area = NullValue - if Clusters.ServiceArea.Attributes.CurrentArea.attribute_id in attribute_list: + if await self.attribute_guard(endpoint=self.endpoint, attribute=Clusters.ServiceArea.Attributes.CurrentArea): old_current_area = await self.read_current_area(step=11) self.print_step("12", "") @@ -197,7 +192,7 @@ async def test_TC_SEAR_1_5(self): if not self.is_ci: self.wait_for_user_input(prompt_msg=f"{test_step}, and press Enter when done.\n") - if Clusters.ServiceArea.Attributes.Progress.attribute_id in attribute_list: + if await self.attribute_guard(endpoint=self.endpoint, attribute=Clusters.ServiceArea.Attributes.Progress): new_progress_list = await self.read_progress(step=15) asserts.assert_true(len(new_progress_list) > 0, f"len of Progress({len(new_progress_list)}) should not be zero)") @@ -238,7 +233,7 @@ async def test_TC_SEAR_1_5(self): self.print_step("17", "") return - if Clusters.ServiceArea.Attributes.Progress.attribute_id not in attribute_list: + if not await self.attribute_guard(endpoint=self.endpoint, attribute=Clusters.ServiceArea.Attributes.Progress): return if self.check_pics("SEAR.S.M.HAS_MANUAL_SKIP_STATE_CONTROL"): diff --git a/src/python_testing/TC_SEAR_1_6.py b/src/python_testing/TC_SEAR_1_6.py index a5a2ac73ce07b5..592461d214ed54 100644 --- a/src/python_testing/TC_SEAR_1_6.py +++ b/src/python_testing/TC_SEAR_1_6.py @@ -95,19 +95,14 @@ async def test_TC_SEAR_1_6(self): self.app_pipe = self.app_pipe + str(app_pid) attributes = Clusters.ServiceArea.Attributes - attribute_list = await self.read_sear_attribute_expect_success( - endpoint=self.endpoint, attribute=Clusters.ServiceArea.Attributes.AttributeList) - SupportedAreas = attributes.SupportedAreas.attribute_id - SelectedAreas = attributes.SelectedAreas.attribute_id - Progress = attributes.Progress.attribute_id - if SupportedAreas not in attribute_list: + if not await self.attribute_guard(endpoint=self.endpoint, attribute=attributes.SupportedAreas): asserts.fail("Supported areas attribute required in attribute list to run test") - if SelectedAreas not in attribute_list: + if not await self.attribute_guard(endpoint=self.endpoint, attribute=attributes.SelectedAreas): asserts.fail("Selected areas attribute required in attribute list to run test") - if Progress not in attribute_list: + if not await self.attribute_guard(endpoint=self.endpoint, attribute=attributes.Progress): asserts.fail("Progress attribute required in attribute list to run test") self.print_step(1, "Commissioning, already done")