From 6063e237cadb75cdf819e01f9080a480d4e03548 Mon Sep 17 00:00:00 2001 From: Arkadiusz Bokowy Date: Thu, 5 Dec 2024 19:01:27 +0100 Subject: [PATCH] Check fabric-sync application with ECOINFO tests on CI (#36733) * Build fabric-sync for testing * Test TC_ECOINFO test with new fabric-sync-app on CI * Restyled by isort --------- Co-authored-by: Restyled.io --- src/python_testing/TC_ECOINFO_2_1.py | 37 ++++++++++++++++++++----- src/python_testing/TC_ECOINFO_2_2.py | 40 +++++++++++++++++++++++----- 2 files changed, 63 insertions(+), 14 deletions(-) diff --git a/src/python_testing/TC_ECOINFO_2_1.py b/src/python_testing/TC_ECOINFO_2_1.py index d86200d320859e..8d96dc5b2d083e 100644 --- a/src/python_testing/TC_ECOINFO_2_1.py +++ b/src/python_testing/TC_ECOINFO_2_1.py @@ -31,7 +31,25 @@ # --commissioning-method on-network # --discriminator 1234 # --passcode 20202021 -# --string-arg th_server_app_path:${ALL_CLUSTERS_APP} dut_fsa_stdin_pipe:dut-fsa-stdin +# --string-arg th_server_app_path:${ALL_CLUSTERS_APP} +# --string-arg dut_fsa_stdin_pipe:dut-fsa-stdin +# --trace-to json:${TRACE_TEST_JSON}.json +# --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# factory-reset: true +# quiet: true +# run2: +# app: ${FABRIC_SYNC_APP} +# app-args: --discriminator=1234 +# app-stdin-pipe: dut-fsa-stdin +# script-args: > +# --PICS src/app/tests/suites/certification/ci-pics-values +# --storage-path admin_storage.json +# --commissioning-method on-network +# --discriminator 1234 +# --passcode 20202021 +# --bool-arg unified_fabric_sync_app:true +# --string-arg th_server_app_path:${ALL_CLUSTERS_APP} +# --string-arg dut_fsa_stdin_pipe:dut-fsa-stdin # --trace-to json:${TRACE_TEST_JSON}.json # --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto # factory-reset: true @@ -48,7 +66,8 @@ from chip.clusters.Types import NullValue from chip.interaction_model import Status from chip.testing.apps import AppServerSubprocess -from chip.testing.matter_testing import MatterBaseTest, TestStep, async_test_body, default_matter_test_main, type_matches +from chip.testing.matter_testing import (MatterBaseTest, SetupParameters, TestStep, async_test_body, default_matter_test_main, + type_matches) from chip.tlv import uint from mobly import asserts @@ -92,22 +111,26 @@ async def _setup_ci_prerequisites(self): logging.info("Temporary storage directory: %s", self.storage.name) self.th_server_port = 5544 - self.th_server_discriminator = random.randint(0, 4095) - self.th_server_passcode = 20202021 + self.th_server_setup_params = SetupParameters( + discriminator=random.randint(0, 4095), + passcode=20202021) # Start the server app. self.th_server = AppServerSubprocess( th_server_app, storage_dir=self.storage.name, port=self.th_server_port, - discriminator=self.th_server_discriminator, - passcode=self.th_server_passcode) + discriminator=self.th_server_setup_params.discriminator, + passcode=self.th_server_setup_params.passcode) self.th_server.start( expected_output="Server initialization complete", timeout=30) # Add some server to the DUT_FSA's Aggregator/Bridge. - self.dut_fsa_stdin.write(f"pairing onnetwork 2 {self.th_server_passcode}\n") + if self.user_params.get("unified_fabric_sync_app"): + self.dut_fsa_stdin.write(f"app pair-device 2 {self.th_server_setup_params.qr_code}\n") + else: + self.dut_fsa_stdin.write(f"pairing onnetwork 2 {self.th_server_setup_params.passcode}\n") self.dut_fsa_stdin.flush() # Wait for the commissioning to complete. await asyncio.sleep(5) diff --git a/src/python_testing/TC_ECOINFO_2_2.py b/src/python_testing/TC_ECOINFO_2_2.py index ce98a806cef785..0e53f0f52932dd 100644 --- a/src/python_testing/TC_ECOINFO_2_2.py +++ b/src/python_testing/TC_ECOINFO_2_2.py @@ -31,7 +31,25 @@ # --commissioning-method on-network # --discriminator 1234 # --passcode 20202021 -# --string-arg th_server_app_path:${ALL_CLUSTERS_APP} dut_fsa_stdin_pipe:dut-fsa-stdin +# --string-arg th_server_app_path:${ALL_CLUSTERS_APP} +# --string-arg dut_fsa_stdin_pipe:dut-fsa-stdin +# --trace-to json:${TRACE_TEST_JSON}.json +# --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# factory-reset: true +# quiet: true +# run2: +# app: ${FABRIC_SYNC_APP} +# app-args: --discriminator=1234 +# app-stdin-pipe: dut-fsa-stdin +# script-args: > +# --PICS src/app/tests/suites/certification/ci-pics-values +# --storage-path admin_storage.json +# --commissioning-method on-network +# --discriminator 1234 +# --passcode 20202021 +# --bool-arg unified_fabric_sync_app:true +# --string-arg th_server_app_path:${ALL_CLUSTERS_APP} +# --string-arg dut_fsa_stdin_pipe:dut-fsa-stdin # --trace-to json:${TRACE_TEST_JSON}.json # --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto # factory-reset: true @@ -47,7 +65,7 @@ import chip.clusters as Clusters from chip.interaction_model import Status from chip.testing.apps import AppServerSubprocess -from chip.testing.matter_testing import MatterBaseTest, TestStep, async_test_body, default_matter_test_main +from chip.testing.matter_testing import MatterBaseTest, SetupParameters, TestStep, async_test_body, default_matter_test_main from mobly import asserts _DEVICE_TYPE_AGGREGATOR = 0x000E @@ -91,7 +109,9 @@ def _setup_ci_prerequisites(self): logging.info("Temporary storage directory: %s", self.storage.name) self.th_server_port = 5544 - self.th_server_discriminator = random.randint(0, 4095) + self.th_server_setup_params = SetupParameters( + discriminator=random.randint(0, 4095), + passcode=20202021) self.th_server_passcode = 20202021 # Start the server app. @@ -99,8 +119,8 @@ def _setup_ci_prerequisites(self): th_server_app, storage_dir=self.storage.name, port=self.th_server_port, - discriminator=self.th_server_discriminator, - passcode=self.th_server_passcode) + discriminator=self.th_server_setup_params.discriminator, + passcode=self.th_server_setup_params.passcode) self.th_server.start( expected_output="Server initialization complete", timeout=30) @@ -161,7 +181,10 @@ async def test_TC_ECOINFO_2_2(self): self.wait_for_user_input("Add a bridged device using method indicated by the manufacturer") else: # Add some server to the DUT_FSA's Aggregator/Bridge. - self.dut_fsa_stdin.write(f"pairing onnetwork 2 {self.th_server_passcode}\n") + if self.user_params.get("unified_fabric_sync_app"): + self.dut_fsa_stdin.write(f"app pair-device 2 {self.th_server_setup_params.qr_code}\n") + else: + self.dut_fsa_stdin.write(f"pairing onnetwork 2 {self.th_server_setup_params.passcode}\n") self.dut_fsa_stdin.flush() # Wait for the commissioning to complete. await asyncio.sleep(5) @@ -200,7 +223,10 @@ async def test_TC_ECOINFO_2_2(self): self.wait_for_user_input("Removed bridged device added in step 2a using method indicated by the manufacturer") else: # Remove previously added server from the DUT_FSA's Aggregator/Bridge. - self.dut_fsa_stdin.write("pairing unpair 2\n") + if self.user_params.get("unified_fabric_sync_app"): + self.dut_fsa_stdin.write("app remove-device 2\n") + else: + self.dut_fsa_stdin.write("pairing unpair 2\n") self.dut_fsa_stdin.flush() # Wait for the command to complete. await asyncio.sleep(2)