From 3d13a4ea1efc8882cbc6008e902eda6362c79b7c Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Fri, 14 Oct 2022 10:59:07 -0400 Subject: [PATCH] Add support for running YAML tests against bridge-app. And run Test_TC_BRBINFO_* against it. Fixes https://github.com/project-chip/connectedhomeip/issues/23147 --- .github/workflows/darwin-tests.yaml | 2 ++ .github/workflows/tests.yaml | 4 ++++ scripts/tests/chiptest/__init__.py | 2 ++ scripts/tests/chiptest/linux.py | 1 + scripts/tests/chiptest/test_definition.py | 6 +++++- scripts/tests/run_test_suite.py | 11 +++++++++-- 6 files changed, 23 insertions(+), 3 deletions(-) diff --git a/.github/workflows/darwin-tests.yaml b/.github/workflows/darwin-tests.yaml index 82315575292a49..832011847dd5c4 100644 --- a/.github/workflows/darwin-tests.yaml +++ b/.github/workflows/darwin-tests.yaml @@ -94,6 +94,7 @@ jobs: --target darwin-x64-ota-provider-${BUILD_VARIANT} \ --target darwin-x64-ota-requestor-${BUILD_VARIANT} \ --target darwin-x64-tv-app-${BUILD_VARIANT} \ + --target darwin-x64-bridge-app-${BUILD_VARIANT} \ build \ --copy-artifacts-to objdir-clone \ " @@ -112,6 +113,7 @@ jobs: --ota-provider-app ./out/darwin-x64-ota-provider-${BUILD_VARIANT}/chip-ota-provider-app \ --ota-requestor-app ./out/darwin-x64-ota-requestor-${BUILD_VARIANT}/chip-ota-requestor-app \ --tv-app ./out/darwin-x64-tv-app-${BUILD_VARIANT}/chip-tv-app \ + --bridge-app ./out/darwin-x64-tv-app-${BUILD_VARIANT}/chip-bridge-app \ " - name: Uploading core files uses: actions/upload-artifact@v2 diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index e2542c27c78711..696338690aa98f 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -189,6 +189,7 @@ jobs: --target linux-x64-ota-provider-${BUILD_VARIANT} \ --target linux-x64-ota-requestor-${BUILD_VARIANT} \ --target linux-x64-tv-app-${BUILD_VARIANT} \ + --target linux-x64-bridge-app-${BUILD_VARIANT} \ build \ --copy-artifacts-to objdir-clone \ " @@ -206,6 +207,7 @@ jobs: --ota-provider-app ./out/linux-x64-ota-provider-${BUILD_VARIANT}/chip-ota-provider-app \ --ota-requestor-app ./out/linux-x64-ota-requestor-${BUILD_VARIANT}/chip-ota-requestor-app \ --tv-app ./out/linux-x64-tv-app-${BUILD_VARIANT}/chip-tv-app \ + --bridge-app ./out/linux-x64-tv-app-${BUILD_VARIANT}/chip-bridge-app \ " - name: Uploading core files uses: actions/upload-artifact@v2 @@ -291,6 +293,7 @@ jobs: --target darwin-x64-ota-provider-${BUILD_VARIANT} \ --target darwin-x64-ota-requestor-${BUILD_VARIANT} \ --target darwin-x64-tv-app-${BUILD_VARIANT} \ + --target darwin-x64-bridge-app-${BUILD_VARIANT} \ build \ --copy-artifacts-to objdir-clone \ " @@ -309,6 +312,7 @@ jobs: --ota-provider-app ./out/darwin-x64-ota-provider-${BUILD_VARIANT}/chip-ota-provider-app \ --ota-requestor-app ./out/darwin-x64-ota-requestor-${BUILD_VARIANT}/chip-ota-requestor-app \ --tv-app ./out/darwin-x64-tv-app-${BUILD_VARIANT}/chip-tv-app \ + --bridge-app ./out/darwin-x64-tv-app-${BUILD_VARIANT}/chip-bridge-app \ " - name: Uploading core files uses: actions/upload-artifact@v2 diff --git a/scripts/tests/chiptest/__init__.py b/scripts/tests/chiptest/__init__.py index 320f771e5d492b..f6bcad16a7c683 100644 --- a/scripts/tests/chiptest/__init__.py +++ b/scripts/tests/chiptest/__init__.py @@ -27,6 +27,8 @@ def target_for_name(name: str): return TestTarget.LOCK if name.startswith("OTA_"): return TestTarget.OTA + if name.startswith("Test_TC_BRBINFO_"): + return TestTarget.BRIDGE return TestTarget.ALL_CLUSTERS diff --git a/scripts/tests/chiptest/linux.py b/scripts/tests/chiptest/linux.py index 872d6b5040ea33..2bac22dca6ac57 100644 --- a/scripts/tests/chiptest/linux.py +++ b/scripts/tests/chiptest/linux.py @@ -148,4 +148,5 @@ def PathsWithNetworkNamespaces(paths: ApplicationPaths) -> ApplicationPaths: ota_provider_app='ip netns exec app'.split() + paths.ota_provider_app, ota_requestor_app='ip netns exec app'.split() + paths.ota_requestor_app, tv_app='ip netns exec app'.split() + paths.tv_app, + bridge_app='ip netns exec app'.split() + paths.bridge_app, ) diff --git a/scripts/tests/chiptest/test_definition.py b/scripts/tests/chiptest/test_definition.py index 3995a33ef0e5b1..530e4cb9e8dc1e 100644 --- a/scripts/tests/chiptest/test_definition.py +++ b/scripts/tests/chiptest/test_definition.py @@ -153,6 +153,7 @@ class TestTarget(Enum): TV = auto() LOCK = auto() OTA = auto() + BRIDGE = auto() @dataclass @@ -163,9 +164,10 @@ class ApplicationPaths: ota_provider_app: typing.List[str] ota_requestor_app: typing.List[str] tv_app: typing.List[str] + bridge_app: typing.List[str] def items(self): - return [self.chip_tool, self.all_clusters_app, self.lock_app, self.ota_provider_app, self.ota_requestor_app, self.tv_app] + return [self.chip_tool, self.all_clusters_app, self.lock_app, self.ota_provider_app, self.ota_requestor_app, self.tv_app, self.bridge_app] @dataclass @@ -229,6 +231,8 @@ def Run(self, runner, apps_register, paths: ApplicationPaths, pics_file: str, ti target_app = paths.lock_app elif self.target == TestTarget.OTA: target_app = paths.ota_requestor_app + elif self.target == TestTarget.BRIDGE: + target_app = paths.bridge_app else: raise Exception("Unknown test target - " "don't know which application to run") diff --git a/scripts/tests/run_test_suite.py b/scripts/tests/run_test_suite.py index 488bf0fd71beaf..dbbda2a3863da2 100755 --- a/scripts/tests/run_test_suite.py +++ b/scripts/tests/run_test_suite.py @@ -189,6 +189,9 @@ def cmd_list(context): @click.option( '--tv-app', help='what tv app to use') +@click.option( + '--bridge-app', + help='what bridge app to use') @click.option( '--pics-file', type=click.Path(exists=True), @@ -200,7 +203,7 @@ def cmd_list(context): type=int, help='If provided, fail if a test runs for longer than this time') @click.pass_context -def cmd_run(context, iterations, all_clusters_app, lock_app, ota_provider_app, ota_requestor_app, tv_app, pics_file, test_timeout_seconds): +def cmd_run(context, iterations, all_clusters_app, lock_app, ota_provider_app, ota_requestor_app, tv_app, bridge_app, pics_file, test_timeout_seconds): runner = chiptest.runner.Runner() if all_clusters_app is None: @@ -218,6 +221,9 @@ def cmd_run(context, iterations, all_clusters_app, lock_app, ota_provider_app, o if tv_app is None: tv_app = FindBinaryPath('chip-tv-app') + if bridge_app is None: + bridge_app = FindBinaryPath('chip-bridge-app') + # Command execution requires an array paths = chiptest.ApplicationPaths( chip_tool=[context.obj.chip_tool], @@ -225,7 +231,8 @@ def cmd_run(context, iterations, all_clusters_app, lock_app, ota_provider_app, o lock_app=[lock_app], ota_provider_app=[ota_provider_app], ota_requestor_app=[ota_requestor_app], - tv_app=[tv_app] + tv_app=[tv_app], + bridge_app=[bridge_app] ) if sys.platform == 'linux':