From 0a1767e8fba59344215d067e35692710bad54a78 Mon Sep 17 00:00:00 2001 From: Mathieu Kardous Date: Mon, 5 Aug 2024 13:54:17 -0400 Subject: [PATCH 1/6] Add ICDM 3.2 Python Certification Script --- .github/workflows/tests.yaml | 91 ++-- .../certification/Test_TC_ICDM_3_2.yaml | 346 --------------- src/app/tests/suites/manualTests.json | 5 +- src/python_testing/TC_ICDM_3_2.py | 408 ++++++++++++++++++ 4 files changed, 475 insertions(+), 375 deletions(-) delete mode 100644 src/app/tests/suites/certification/Test_TC_ICDM_3_2.yaml create mode 100644 src/python_testing/TC_ICDM_3_2.py diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 6974999d0d134f..e0099cfba44440 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -17,13 +17,14 @@ name: Tests on: push: branches-ignore: - - 'dependabot/**' + - "dependabot/**" pull_request: merge_group: workflow_dispatch: concurrency: - group: ${{ github.ref }}-${{ github.workflow }}-${{ (github.event_name == + group: + ${{ github.ref }}-${{ github.workflow }}-${{ (github.event_name == 'pull_request' && github.event.number) || (github.event_name == 'workflow_dispatch' && github.run_number) || github.sha }} cancel-in-progress: true @@ -42,7 +43,9 @@ jobs: env: BUILD_VARIANT: ${{matrix.build_variant}} CHIP_TOOL_VARIANT: ${{matrix.chip_tool}} - TSAN_OPTIONS: "halt_on_error=1 suppressions=scripts/tests/chiptest/tsan-linux-suppressions.txt" + TSAN_OPTIONS: + "halt_on_error=1 + suppressions=scripts/tests/chiptest/tsan-linux-suppressions.txt" LSAN_OPTIONS: detect_leaks=1 if: github.actor != 'restyled-io[bot]' @@ -50,7 +53,8 @@ jobs: container: image: ghcr.io/project-chip/chip-build:54 - options: --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 + options: + --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 net.ipv4.conf.all.forwarding=1 net.ipv6.conf.all.forwarding=1" steps: @@ -68,9 +72,12 @@ jobs: - name: Checkout submodules & Bootstrap uses: ./.github/actions/checkout-submodules-and-bootstrap with: - platform: linux - bootstrap-log-name: bootstrap-logs-linux-${{ matrix.build_variant }}${{ matrix.chip_tool }} - - name: Try to ensure the directories for core dumping exist and we + platform: linux + bootstrap-log-name: + bootstrap-logs-linux-${{ matrix.build_variant }}${{ + matrix.chip_tool }} + - name: + Try to ensure the directories for core dumping exist and we can write them. run: | mkdir /tmp/cores || true @@ -231,7 +238,9 @@ jobs: --copy-artifacts-to objdir-clone \ " - - name: Run Tests using the python parser sending commands to chip-tool + - name: + Run Tests using the python parser sending commands to + chip-tool run: | ./scripts/run_in_build_env.sh \ "./scripts/tests/run_test_suite.py \ @@ -252,7 +261,9 @@ jobs: --network-manager-app ./out/linux-x64-network-manager-${BUILD_VARIANT}/matter-network-manager-app \ " - - name: Run purposeful failure tests using the python parser sending commands to chip-tool + - name: + Run purposeful failure tests using the python parser sending + commands to chip-tool run: | ./scripts/run_in_build_env.sh \ "./scripts/tests/run_test_suite.py \ @@ -317,7 +328,9 @@ jobs: uses: actions/upload-artifact@v4 if: ${{ failure() && !env.ACT }} with: - name: crash-core-linux-${{ matrix.build_variant }}${{ matrix.chip_tool }} + name: + crash-core-linux-${{ matrix.build_variant }}${{ + matrix.chip_tool }} path: /tmp/cores/ # Cores are big; don't hold on to them too long. retention-days: 5 @@ -325,7 +338,9 @@ jobs: uses: actions/upload-artifact@v4 if: ${{ failure() && !env.ACT }} with: - name: crash-objdir-linux-${{ matrix.build_variant }}${{ matrix.chip_tool }} + name: + crash-objdir-linux-${{ matrix.build_variant }}${{ + matrix.chip_tool }} path: objdir-clone/ # objdirs are big; don't hold on to them too long. retention-days: 5 @@ -341,7 +356,9 @@ jobs: BUILD_VARIANT: ${{matrix.build_variant}} CHIP_TOOL_VARIANT: ${{matrix.chip_tool}} TSAN_OPTIONS: "halt_on_error=1" - LSAN_OPTIONS: detect_leaks=1 suppressions=scripts/tests/chiptest/lsan-mac-suppressions.txt + LSAN_OPTIONS: + detect_leaks=1 + suppressions=scripts/tests/chiptest/lsan-mac-suppressions.txt if: github.actor != 'restyled-io[bot]' runs-on: macos-13 @@ -362,9 +379,10 @@ jobs: - name: Checkout submodules & Bootstrap uses: ./.github/actions/checkout-submodules-and-bootstrap with: - platform: darwin - bootstrap-log-name: bootstrap-logs-darwin-${{ matrix.build_variant }}${{ matrix.chip_tool }} - + platform: darwin + bootstrap-log-name: + bootstrap-logs-darwin-${{ matrix.build_variant }}${{ + matrix.chip_tool }} - name: Build Apps run: | @@ -385,7 +403,9 @@ jobs: --copy-artifacts-to objdir-clone \ " - - name: Run Tests using the python parser sending commands to chip-tool + - name: + Run Tests using the python parser sending commands to + chip-tool run: | ./scripts/run_in_build_env.sh \ "./scripts/tests/run_test_suite.py \ @@ -407,7 +427,9 @@ jobs: --network-manager-app ./out/darwin-x64-network-manager-${BUILD_VARIANT}/matter-network-manager-app \ " - - name: Run purposeful failure tests using the python parser sending commands to chip-tool + - name: + Run purposeful failure tests using the python parser sending + commands to chip-tool run: | ./scripts/run_in_build_env.sh \ "./scripts/tests/run_test_suite.py \ @@ -426,7 +448,9 @@ jobs: uses: actions/upload-artifact@v4 if: ${{ failure() && !env.ACT }} with: - name: crash-core-darwin-${{ matrix.build_variant }}${{ matrix.chip_tool }} + name: + crash-core-darwin-${{ matrix.build_variant }}${{ + matrix.chip_tool }} path: /cores/ # Cores are big; don't hold on to them too long. retention-days: 5 @@ -434,13 +458,17 @@ jobs: uses: actions/upload-artifact@v4 if: ${{ failure() && !env.ACT }} with: - name: crash-log-darwin-${{ matrix.build_variant }}${{ matrix.chip_tool }} + name: + crash-log-darwin-${{ matrix.build_variant }}${{ + matrix.chip_tool }} path: ~/Library/Logs/DiagnosticReports/ - name: Uploading objdir for debugging uses: actions/upload-artifact@v4 if: ${{ failure() && !env.ACT }} with: - name: crash-objdir-darwin-${{ matrix.build_variant }}${{ matrix.chip_tool }} + name: + crash-objdir-darwin-${{ matrix.build_variant }}${{ + matrix.chip_tool }} path: objdir-clone/ # objdirs are big; don't hold on to them too long. retention-days: 5 @@ -449,14 +477,17 @@ jobs: name: REPL Tests - Linux env: - TSAN_OPTIONS: "halt_on_error=1 suppressions=scripts/tests/chiptest/tsan-linux-suppressions.txt" + TSAN_OPTIONS: + "halt_on_error=1 + suppressions=scripts/tests/chiptest/tsan-linux-suppressions.txt" if: github.actor != 'restyled-io[bot]' runs-on: ubuntu-latest container: image: ghcr.io/project-chip/chip-build:66 - options: --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 + options: + --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 net.ipv4.conf.all.forwarding=0 net.ipv6.conf.all.forwarding=0" steps: @@ -465,9 +496,12 @@ jobs: - name: Checkout submodules & Bootstrap uses: ./.github/actions/checkout-submodules-and-bootstrap with: - platform: linux - bootstrap-log-name: bootstrap-logs-linux-${{ matrix.build_variant }}${{ matrix.chip_tool }} - - name: Try to ensure the directories for core dumping exist and we + platform: linux + bootstrap-log-name: + bootstrap-logs-linux-${{ matrix.build_variant }}${{ + matrix.chip_tool }} + - name: + Try to ensure the directories for core dumping exist and we can write them. run: | mkdir /tmp/cores || true @@ -519,7 +553,6 @@ jobs: scripts/run_in_python_env.sh out/venv 'python3 ./src/python_testing/test_testing/test_TC_SC_7_1.py' scripts/run_in_python_env.sh out/venv 'python3 ./src/python_testing/test_testing/TestDecorators.py' - - name: Uploading core files uses: actions/upload-artifact@v4 if: ${{ failure() && !env.ACT }} @@ -566,8 +599,10 @@ jobs: - name: Checkout submodules & Bootstrap uses: ./.github/actions/checkout-submodules-and-bootstrap with: - platform: darwin - bootstrap-log-name: bootstrap-logs-darwin-${{ matrix.build_variant }}${{ matrix.chip_tool }} + platform: darwin + bootstrap-log-name: + bootstrap-logs-darwin-${{ matrix.build_variant }}${{ + matrix.chip_tool }} - name: Build Python REPL and example apps run: | diff --git a/src/app/tests/suites/certification/Test_TC_ICDM_3_2.yaml b/src/app/tests/suites/certification/Test_TC_ICDM_3_2.yaml deleted file mode 100644 index f6104a53d411d1..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_ICDM_3_2.yaml +++ /dev/null @@ -1,346 +0,0 @@ -# Copyright (c) 2024 Project CHIP Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# Auto-generated scripts for harness use only, please review before automation. The endpoints and cluster names are currently set to default - -name: 217.2.3. [TC-ICDM-3.2] Verify RegisterClient command with DUT as Server - -PICS: - - ICDM.S - - ICDM.S.C00.Rsp - - ICDM.S.C02.Rsp - -config: - nodeId: 0x12344321 - cluster: "Basic Information" - endpoint: 0 - -tests: - - label: "Preconditions" - verification: | - 1.Commission DUT to TH (can be skipped if done in a preceding test). - 2a.TH reads from the DUT the RegisteredClients attribute. - 2b.If list of registered clients is not empty, unregister existing client(s) - 2c.TH reads from the DUT the RegisteredClients attribute. Verify that the DUT response contains empty list of registered clients. - disabled: true - - - label: - "Step 1a: TH sends RegisterClient command. - CheckInNodeID: - registering clients node ID (CheckInNodeID1) - MonitoredSubject: - monitored subject ID (MonitorSubID1) - Key: shared secret between the - client and the ICD (Key1)" - PICS: ICDM.S.C00.Rsp - verification: | - ./chip-tool icdmanagement register-client 1 1 hex:1234567890abcdef1234567890abcdef 1 0 - - [1702418857.289325][1350:1352] CHIP:DMG: Received Command Response Data, Endpoint=0 Cluster=0x0000_0046 Command=0x0000_0001 - [1702418857.289426][1350:1352] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_0046 Command 0x0000_0001 - [1702418857.289635][1350:1352] CHIP:TOO: RegisterClientResponse: { - [1702418857.289725][1350:1352] CHIP:TOO: ICDCounter: 1321491095 - [1702418857.289781][1350:1352] CHIP:TOO: } - disabled: true - - - label: "Step 1b: TH reads from the DUT the RegisteredClients attribute." - PICS: ICDM.S.A0003 - verification: | - ./chip-tool icdmanagement read registered-clients 1 0 - - [1702418868.283920][1353:1355] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_0046 Attribute 0x0000_0003 DataVersion: 4124981277 - [1702418868.284152][1353:1355] CHIP:TOO: RegisteredClients: 2 entries - [1702418868.284338][1353:1355] CHIP:TOO: [1]: { - [1702418868.284396][1353:1355] CHIP:TOO: CheckInNodeID: 112233 - [1702418868.284449][1353:1355] CHIP:TOO: MonitoredSubject: 112233 - [1702418868.284525][1353:1355] CHIP:TOO: FabricIndex: 1 - [1702418868.284577][1353:1355] CHIP:TOO: } - [1702418868.284647][1353:1355] CHIP:TOO: [2]: { - [1702418868.284700][1353:1355] CHIP:TOO: CheckInNodeID: 1 - [1702418868.284751][1353:1355] CHIP:TOO: MonitoredSubject: 1 - [1702418868.284801][1353:1355] CHIP:TOO: FabricIndex: 1 - [1702418868.284849][1353:1355] CHIP:TOO: } - disabled: true - - - label: "Step 1c: Power cycle DUT" - verification: | - Power cycle DUT - disabled: true - - - label: "Step 1d: TH reads from the DUT the RegisteredClients attribute." - PICS: ICDM.S.A0003(RegisteredClients) - verification: | - ./chip-tool icdmanagement read registered-clients 1 0 - - [1702418876.828984][1356:1358] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_0046 Attribute 0x0000_0003 DataVersion: 4124981277 - [1702418876.829201][1356:1358] CHIP:TOO: RegisteredClients: 2 entries - [1702418876.829372][1356:1358] CHIP:TOO: [1]: { - [1702418876.829426][1356:1358] CHIP:TOO: CheckInNodeID: 112233 - [1702418876.829535][1356:1358] CHIP:TOO: MonitoredSubject: 112233 - [1702418876.829609][1356:1358] CHIP:TOO: FabricIndex: 1 - [1702418876.829655][1356:1358] CHIP:TOO: } - [1702418876.829719][1356:1358] CHIP:TOO: [2]: { - [1702418876.829766][1356:1358] CHIP:TOO: CheckInNodeID: 1 - [1702418876.829867][1356:1358] CHIP:TOO: MonitoredSubject: 1 - [1702418876.829912][1356:1358] CHIP:TOO: FabricIndex: 1 - [1702418876.829955][1356:1358] CHIP:TOO: } - disabled: true - - - label: - "Step 2a: Setup the TH such that is has administrator privileges for - the ICDM cluster." - verification: | - chip-tool default with admin privilege. - disabled: true - - - label: - "Step 2b: TH sends RegisterClient command with same CheckInNodeID as - in Step 1a and different MonitoredSubject and Key. - CheckInNodeID: - registering clients node ID (CheckInNodeID1) - MonitoredSubject: - monitored subject ID (MonitorSubID2) - Key: shared secret between the - client and the ICD (Key2)" - PICS: ICDM.S.C00.Rsp - verification: | - ./chip-tool icdmanagement register-client 1 2 hex:abcdef1234567890abcdef1234567890 1 0 - - [1702418883.807797][1359:1361] CHIP:DMG: Received Command Response Data, Endpoint=0 Cluster=0x0000_0046 Command=0x0000_0001 - [1702418883.807919][1359:1361] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_0046 Command 0x0000_0001 - [1702418883.808188][1359:1361] CHIP:TOO: RegisterClientResponse: { - [1702418883.808260][1359:1361] CHIP:TOO: ICDCounter: 1321491095 - [1702418883.808316][1359:1361] CHIP:TOO: } - disabled: true - - - label: "Step 2c: TH reads from the DUT the ICDCounter attribute." - PICS: ICDM.S.A0004 - verification: | - ./chip-tool icdmanagement read icdcounter 1 0 - - [1702418902.706877][1365:1367] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_0046 Attribute 0x0000_0004 DataVersion: 4124981277 - [1702418902.706989][1365:1367] CHIP:TOO: ICDCounter: 1321491095 - disabled: true - - - label: "Step 2d: TH reads from the DUT the RegisteredClients attribute." - PICS: ICDM.S.A0003 - verification: | - ./chip-tool icdmanagement read registered-clients 1 0 - - [1702418891.793516][1362:1364] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_0046 Attribute 0x0000_0003 DataVersion: 4124981277 - [1702418891.793737][1362:1364] CHIP:TOO: RegisteredClients: 2 entries - [1702418891.793959][1362:1364] CHIP:TOO: [1]: { - [1702418891.794016][1362:1364] CHIP:TOO: CheckInNodeID: 112233 - [1702418891.794065][1362:1364] CHIP:TOO: MonitoredSubject: 112233 - [1702418891.794133][1362:1364] CHIP:TOO: FabricIndex: 1 - [1702418891.794179][1362:1364] CHIP:TOO: } - [1702418891.794290][1362:1364] CHIP:TOO: [2]: { - [1702418891.794344][1362:1364] CHIP:TOO: CheckInNodeID: 1 - [1702418891.794390][1362:1364] CHIP:TOO: MonitoredSubject: 2 - [1702418891.794483][1362:1364] CHIP:TOO: FabricIndex: 1 - [1702418891.794531][1362:1364] CHIP:TOO: } - disabled: true - - - label: - "Step 2e: TH sends UnregisterClient command with the CheckInNodeID - (CheckInNodeID1)." - PICS: ICDM.S.C02.Rsp - verification: | - ./chip-tool icdmanagement unregister-client 1 1 0 - - [1702419153.281757][1380:1382] CHIP:DMG: InvokeResponseMessage = - [1702419153.281885][1380:1382] CHIP:DMG: { - [1702419153.282005][1380:1382] CHIP:DMG: suppressResponse = false, - [1702419153.282061][1380:1382] CHIP:DMG: InvokeResponseIBs = - [1702419153.282126][1380:1382] CHIP:DMG: [ - [1702419153.282177][1380:1382] CHIP:DMG: InvokeResponseIB = - [1702419153.282243][1380:1382] CHIP:DMG: { - [1702419153.282296][1380:1382] CHIP:DMG: CommandStatusIB = - [1702419153.282357][1380:1382] CHIP:DMG: { - [1702419153.282576][1380:1382] CHIP:DMG: CommandPathIB = - [1702419153.282650][1380:1382] CHIP:DMG: { - [1702419153.282725][1380:1382] CHIP:DMG: EndpointId = 0x0, - [1702419153.282812][1380:1382] CHIP:DMG: ClusterId = 0x46, - [1702419153.282895][1380:1382] CHIP:DMG: CommandId = 0x2, - [1702419153.282973][1380:1382] CHIP:DMG: }, - [1702419153.283183][1380:1382] CHIP:DMG: - [1702419153.283246][1380:1382] CHIP:DMG: StatusIB = - [1702419153.283327][1380:1382] CHIP:DMG: { - [1702419153.283409][1380:1382] CHIP:DMG: status = 0x00 (SUCCESS), - [1702419153.283490][1380:1382] CHIP:DMG: }, - [1702419153.283562][1380:1382] CHIP:DMG: - [1702419153.283626][1380:1382] CHIP:DMG: }, - [1702419153.283699][1380:1382] CHIP:DMG: - [1702419153.283751][1380:1382] CHIP:DMG: }, - [1702419153.283811][1380:1382] CHIP:DMG: - [1702419153.283859][1380:1382] CHIP:DMG: ], - [1702419153.283919][1380:1382] CHIP:DMG: - [1702419153.283966][1380:1382] CHIP:DMG: InteractionModelRevision = 11 - [1702419153.284013][1380:1382] CHIP:DMG: }, - [1702419153.284182][1380:1382] CHIP:DMG: Received Command Response Status for Endpoint=0 Cluster=0x0000_0046 Command=0x0000_0002 Status=0x0 - disabled: true - - - label: "Step 2f: TH reads from the DUT the RegisteredClients attribute." - PICS: ICDM.S.A0003 - verification: | - ./chip-tool icdmanagement read registered-clients 1 0 - - [1702419210.157158][1385:1387] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_0046 Attribute 0x0000_0003 DataVersion: 4124981277 - [1702419210.157311][1385:1387] CHIP:TOO: RegisteredClients: 1 entries - [1702419210.157489][1385:1387] CHIP:TOO: [1]: { - [1702419210.157543][1385:1387] CHIP:TOO: CheckInNodeID: 112233 - [1702419210.157591][1385:1387] CHIP:TOO: MonitoredSubject: 112233 - [1702419210.157662][1385:1387] CHIP:TOO: FabricIndex: 1 - [1702419210.157730][1385:1387] CHIP:TOO: } - disabled: true - - - label: - "Step 2g: Clear the THs administrator privileges for the ICDM cluster." - verification: | - ./chip-tool accesscontrol write acl '[{"fabricIndex": 1, "privilege": 4, "authMode": 2, "subjects": [112233], "targets": null } ]' 1 0 - disabled: true - - - label: - "Step 3a: TH sends RegisterClient command. - CheckInNodeID: - registering clients node ID (CheckInNodeID3) - MonitoredSubject: - monitored subject ID (MonitorSubID3) - Key: shared secret between the - client and the ICD (Key3) - VerificationKey: verification key - (VerificationKey3)" - PICS: ICDM.S.C00.Rsp - verification: | - ./chip-tool icdmanagement register-client 3 3 hex:3334567890abcdef3334567890abcdef 1 0 --VerificationKey hex:abcdef1234567890abcdef1234567890 - - [1702433488.601132][2043:2045] CHIP:DMG: Received Command Response Data, Endpoint=0 Cluster=0x0000_0046 Command=0x0000_0001 - [1702433488.601231][2043:2045] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_0046 Command 0x0000_0001 - [1702433488.601414][2043:2045] CHIP:TOO: RegisterClientResponse: { - [1702433488.601478][2043:2045] CHIP:TOO: ICDCounter: 228745926 - [1702433488.601531][2043:2045] CHIP:TOO: } - disabled: true - - - label: "Step 3b: TH reads from the DUT the RegisteredClients attribute." - PICS: ICDM.S.A0003 - verification: | - ./chip-tool icdmanagement read registered-clients 1 0 - - [1702433698.808800][2095:2097] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_0046 Attribute 0x0000_0003 DataVersion: 2083795792 - [1702433698.808939][2095:2097] CHIP:TOO: RegisteredClients: 2 entries - [1702433698.809081][2095:2097] CHIP:TOO: [1]: { - [1702433698.809126][2095:2097] CHIP:TOO: CheckInNodeID: 112233 - [1702433698.809167][2095:2097] CHIP:TOO: MonitoredSubject: 112233 - [1702433698.809226][2095:2097] CHIP:TOO: FabricIndex: 1 - [1702433698.809266][2095:2097] CHIP:TOO: } - [1702433698.809319][2095:2097] CHIP:TOO: [2]: { - [1702433698.809359][2095:2097] CHIP:TOO: CheckInNodeID: 3 - [1702433698.809399][2095:2097] CHIP:TOO: MonitoredSubject: 3 - [1702433698.809514][2095:2097] CHIP:TOO: FabricIndex: 1 - [1702433698.809559][2095:2097] CHIP:TOO: } - disabled: true - - - label: - "Step 4: TH sends RegisterClient command with same CheckInNodeID as in - Step 3a and different MonitoredSubject and Key, and an invalid - VerificationKey - CheckInNodeID: registering clients node ID - (CheckInNodeID3) - MonitoredSubject: monitored subject ID - (MonitorSubID4) - Key: shared secret between the client and the ICD - (Key4) - VerificationKey: invalid verification key (VerificationKey4)" - PICS: ICDM.S.C00.Rsp - verification: | - ./chip-tool icdmanagement register-client 3 4 hex:3334567890abcdef3334567890abcdef 1 0 --VerificationKey hex:abcdef1234567890 - - [1703266655.434604][2378:2381] CHIP:DMG: Received Command Response Status for Endpoint=0 Cluster=0x0000_0046 Command=0x0000_0000 Status=0x1 - [1703266655.434688][2378:2381] CHIP:TOO: Error: IM Error 0x00000501: General error: 0x01 (FAILURE) - disabled: true - - - label: - "Step 5: TH sends RegisterClient command with same CheckInNodeID as in - Step 3a and different MonitoredSubject, Key, and VerificationKey - - CheckInNodeID: registering clients node ID (CheckInNodeID3) - - MonitoredSubject: monitored subject ID (MonitorSubID5) - Key: shared - secret between the client and the ICD (Key5) - VerificationKey: valid - verification key (VerificationKey5)" - PICS: ICDM.S.C00.Rsp - verification: | - ./chip-tool icdmanagement register-client 3 5 hex:3334567890abcdef3334567890abcdef 1 0 --VerificationKey hex:abcdef1234567890abcdef1234500000 - - [1703266705.829853][2551:2553] CHIP:DMG: Received Command Response Status for Endpoint=0 Cluster=0x0000_0046 Command=0x0000_0000 Status=0x1 - [1703266705.829994][2551:2553] CHIP:TOO: Error: IM Error 0x00000501: General error: 0x01 (FAILURE) - disabled: true - - - label: - "Step 6a: TH sends RegisterClient command with same CheckInNodeID and - VerificationKey as in Step 3a and different MonitoredSubject and Key - - CheckInNodeID: registering clients node ID (CheckInNodeID3) - - MonitoredSubject: monitored subject ID (MonitorSubID6) - Key: shared - secret between the client and the ICD (Key6) - VerificationKey: - verification key (VerificationKey3)" - PICS: ICDM.S.C00.Rsp - verification: | - ./chip-tool icdmanagement register-client 3 6 hex:3334567890abcdef3334567890abcdef 1 0 --VerificationKey hex:abcdef1234567890abcdef1234567890 - - [1703267703.849366][2694:2696] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_0046 Command 0x0000_0001 - [1703267703.849532][2694:2696] CHIP:TOO: RegisterClientResponse: { - [1703267703.849587][2694:2696] CHIP:TOO: ICDCounter: 228745930 - [1703267703.849633][2694:2696] CHIP:TOO: } - disabled: true - - - label: "Step 6b: TH reads from the DUT the RegisteredClients attribute." - PICS: ICDM.S.A0003 - verification: | - ./chip-tool icdmanagement read registered-clients 1 0 - - [1702433698.808800][2095:2097] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_0046 Attribute 0x0000_0003 DataVersion: 2083795792 - [1702433698.808939][2095:2097] CHIP:TOO: RegisteredClients: 2 entries - [1702433698.809081][2095:2097] CHIP:TOO: [1]: { - [1702433698.809126][2095:2097] CHIP:TOO: CheckInNodeID: 112233 - [1702433698.809167][2095:2097] CHIP:TOO: MonitoredSubject: 112233 - [1702433698.809226][2095:2097] CHIP:TOO: FabricIndex: 1 - [1702433698.809266][2095:2097] CHIP:TOO: } - [1702433698.809319][2095:2097] CHIP:TOO: [2]: { - [1702433698.809359][2095:2097] CHIP:TOO: CheckInNodeID: 3 - [1702433698.809399][2095:2097] CHIP:TOO: MonitoredSubject: 6 - [1702433698.809514][2095:2097] CHIP:TOO: FabricIndex: 1 - [1702433698.809559][2095:2097] CHIP:TOO: } - disabled: true - - - label: - "Step 6c: TH sends UnregisterClient command with the CheckInNodeID - (CheckInNodeID3) and VerificationKey (VerificationKey3)." - PICS: ICDM.S.C02.Rsp - verification: | - ./chip-tool icdmanagement unregister-client 3 3 0 - - [1702419153.281757][1380:1382] CHIP:DMG: InvokeResponseMessage = - [1702419153.281885][1380:1382] CHIP:DMG: { - [1702419153.282005][1380:1382] CHIP:DMG: suppressResponse = false, - [1702419153.282061][1380:1382] CHIP:DMG: InvokeResponseIBs = - [1702419153.282126][1380:1382] CHIP:DMG: [ - [1702419153.282177][1380:1382] CHIP:DMG: InvokeResponseIB = - [1702419153.282243][1380:1382] CHIP:DMG: { - [1702419153.282296][1380:1382] CHIP:DMG: CommandStatusIB = - [1702419153.282357][1380:1382] CHIP:DMG: { - [1702419153.282576][1380:1382] CHIP:DMG: CommandPathIB = - [1702419153.282650][1380:1382] CHIP:DMG: { - [1702419153.282725][1380:1382] CHIP:DMG: EndpointId = 0x0, - [1702419153.282812][1380:1382] CHIP:DMG: ClusterId = 0x46, - [1702419153.282895][1380:1382] CHIP:DMG: CommandId = 0x2, - [1702419153.282973][1380:1382] CHIP:DMG: }, - [1702419153.283183][1380:1382] CHIP:DMG: - [1702419153.283246][1380:1382] CHIP:DMG: StatusIB = - [1702419153.283327][1380:1382] CHIP:DMG: { - [1702419153.283409][1380:1382] CHIP:DMG: status = 0x00 (SUCCESS), - [1702419153.283490][1380:1382] CHIP:DMG: }, - [1702419153.283562][1380:1382] CHIP:DMG: - [1702419153.283626][1380:1382] CHIP:DMG: }, - [1702419153.283699][1380:1382] CHIP:DMG: - [1702419153.283751][1380:1382] CHIP:DMG: }, - [1702419153.283811][1380:1382] CHIP:DMG: - [1702419153.283859][1380:1382] CHIP:DMG: ], - [1702419153.283919][1380:1382] CHIP:DMG: - [1702419153.283966][1380:1382] CHIP:DMG: InteractionModelRevision = 11 - [1702419153.284013][1380:1382] CHIP:DMG: }, - [1702419153.284182][1380:1382] CHIP:DMG: Received Command Response Status for Endpoint=0 Cluster=0x0000_0046 Command=0x0000_0002 Status=0x0 - disabled: true diff --git a/src/app/tests/suites/manualTests.json b/src/app/tests/suites/manualTests.json index 5edf1cbe71a264..7aef9cd2736a08 100644 --- a/src/app/tests/suites/manualTests.json +++ b/src/app/tests/suites/manualTests.json @@ -117,7 +117,10 @@ "GeneralCommissioning": ["Test_TC_CGEN_2_2"], "GeneralDiagnostics": ["Test_TC_DGGEN_2_2"], "Identify": ["Test_TC_I_3_2"], - "IcdManagement": ["Test_TC_ICDM_3_2", "Test_TC_ICDM_5_1"], + "IcdManagement": [ + "Test_TC_ICDM_4_1", + "Test_TC_ICDM_5_1" + ], "IlluminanceMeasurement": [], "InteractionDataModel": [ "Test_TC_IDM_1_1", diff --git a/src/python_testing/TC_ICDM_3_2.py b/src/python_testing/TC_ICDM_3_2.py new file mode 100644 index 00000000000000..0f69b1d63624bb --- /dev/null +++ b/src/python_testing/TC_ICDM_3_2.py @@ -0,0 +1,408 @@ + +# +# Copyright (c) 2023 Project CHIP Authors +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import logging +import os +from dataclasses import dataclass +import time + + +import chip.clusters as Clusters +from chip.interaction_model import InteractionModelError, Status +from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main +from mobly import asserts + +logger = logging.getLogger(__name__) + +# ========================== +# Constants +# ========================== + +kRootEndpointId = 0 + +cluster = Clusters.Objects.IcdManagement +commands = cluster.Commands +ClientTypeEnum = cluster.Enums.ClientTypeEnum +attributes = cluster.Attributes + + +@dataclass +class Client: + checkInNodeID: int + subjectId: int + key: bytes + clientType: ClientTypeEnum + + +# +# Test Input Data +# +kIncorrectKey = b"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1a" +kInvalidKey = b"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e1g" + +client1 = Client( + checkInNodeID=1, + subjectId=1, + key=b"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f", + clientType=ClientTypeEnum.kEphemeral +) + +client2 = Client( + checkInNodeID=1, + subjectId=2, + key=b"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1e", + clientType=ClientTypeEnum.kEphemeral +) + +client3 = Client( + checkInNodeID=1, + subjectId=3, + key=b"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1d", + clientType=ClientTypeEnum.kEphemeral +) + +client4 = Client( + checkInNodeID=1, + subjectId=4, + key=b"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1c", + clientType=ClientTypeEnum.kEphemeral +) + +client5 = Client( + checkInNodeID=5, + subjectId=5, + key=b"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1b", + clientType=ClientTypeEnum.kEphemeral +) + +client6 = Client( + checkInNodeID=5, + subjectId=6, + key=b"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1a", + clientType=ClientTypeEnum.kEphemeral +) + +client7 = Client( + checkInNodeID=5, + subjectId=7, + key=b"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x0f", + clientType=ClientTypeEnum.kEphemeral +) + +client8 = Client( + checkInNodeID=5, + subjectId=8, + key=b"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x0e", + clientType=ClientTypeEnum.kEphemeral +) + + +class TC_ICDM_3_2(MatterBaseTest): + + # + # Class Helper functions + # + async def _read_icdm_attribute_expect_success(self, attribute): + return await self.read_single_attribute_check_success(endpoint=kRootEndpointId, cluster=cluster, attribute=attribute) + + async def _send_single_icdm_command(self, command): + return await self.send_single_cmd(command, endpoint=kRootEndpointId) + # + # Test Harness Helpers + # + + def desc_TC_ICDM_3_2(self) -> str: + """Returns a description of this test""" + return "[TC-ICDM-3.2] Verify RegisterClient Command with DUT as Server" + + def steps_TC_ICDM_3_2(self) -> list[TestStep]: + steps = [ + TestStep(0, "Commissioning, already done", is_commissioning=True), + TestStep(1, "TH reads from the DUT the RegisteredClients attribute. RegisteredClients is empty."), + TestStep("2a", "TH sends RegisterClient command."), + TestStep("2b", "TH reads from the DUT the RegisteredClients attribute."), + TestStep("2c", "Power cycle DUT."), + TestStep("2d", "TH waits for {PIXIT.WAITTIME.REBOOT}"), + TestStep("2e", "TH reads from the DUT the RegisteredClients attribute."), + TestStep("3a", "TH sends RegisterClient command with same CheckInNodeID1 as in Step 1a and different MonitorSubID2 and Key2."), + TestStep("3b", "TH reads from the DUT the RegisteredClients attribute."), + TestStep("4a", "TH sends RegisterClient command with same CheckInNodeID1 as in Step 1a and different MonitorSubID3 and Key3, and an invalid VerificationKey3."), + TestStep("4b", "TH reads from the DUT the RegisteredClients attribute."), + TestStep("5a", "TH sends RegisterClient command with same CheckInNodeID1 as in Step 1a and different MonitorSubID4 and Key4, and a valid wrong VerificationKey4."), + TestStep("5b", "TH reads from the DUT the RegisteredClients attribute."), + TestStep("6a", "TH sends UnregisterClient command with CheckInNodeID1."), + TestStep("6b", "TH reads from the DUT the RegisteredClients attribute."), + TestStep(7, "Set the TH to Manage privilege for ICDM cluster."), + TestStep("8a", "TH sends RegisterClient command."), + TestStep("8b", "TH sends RegisterClient command with same CheckInNodeID5 as in Step 6a and different MonitorSubID6 and Key6, and an invalid VerificationKey6."), + TestStep("8c", "TH sends RegisterClient command with same CheckInNodeID5 as in Step 6a and different MonitorSubID7 and Key7, and an valid wrong VerificationKey7."), + TestStep("8d", "TH sends RegisterClient command with same CheckInNodeID5 and VerificationKey5 as in Step 6a and different MonitorSubID9 and Key9."), + TestStep(9, "TH sends UnregisterClient command with the CheckInNodeID5 and VerificationKey5."), + ] + return steps + + def pics_TC_ICDM_3_2(self) -> list[str]: + """ This function returns a list of PICS for this test case that must be True for the test to be run""" + pics = [ + "ICDM.S", + "ICDM.S.F00" + ] + return pics + + # + # ICDM 3.2 Test Body + # + + @ async_test_body + async def test_TC_ICDM_3_2(self): + is_ci = self.check_pics("PICS_SDK_CI_ONLY") + + if not is_ci: + asserts.assert_true('PIXIT.WAITTIME.REBOOT' in self.matter_test_config.global_test_params, + "PIXIT.WAITTIME.REBOOT must be included on the command line in " + "the --int-arg flag as PIXIT.WAITTIME.REBOOT:") + + wait_time_reboot = self.matter_test_config.global_test_params['PIXIT.WAITTIME.REBOOT'] + if wait_time_reboot == 0: + asserts.fail("PIXIT.WAITTIME.REBOOT shall be higher than 0.") + + # Pre-Condition: Commissioning + self.step(0) + + # Empty RegisteredClients attribute for all registrations + self.step(1) + registeredClients = await self._read_icdm_attribute_expect_success( + attributes.RegisteredClients) + + for client in registeredClients: + try: + await self._send_single_icdm_command(commands.UnregisterClient(checkInNodeID=client.checkInNodeID)) + except InteractionModelError as e: + asserts.assert_equal( + e.status, Status.Success, "Unexpected error returned") + + try: + self.step("2a") + try: + await self._send_single_icdm_command(commands.RegisterClient(checkInNodeID=client1.checkInNodeID, monitoredSubject=client1.subjectId, key=client1.key, clientType=client1.clientType)) + except InteractionModelError as e: + asserts.assert_equal( + e.status, Status.Success, "Unexpected error returned") + + self.step("2b") + registeredClients = await self._read_icdm_attribute_expect_success( + attributes.RegisteredClients) + # Validate list size + asserts.assert_equal(len(registeredClients), 1, + "The expected length of RegisteredClients is 1. List has the wrong size.") + + # Validate entry values + asserts.assert_equal( + registeredClients[0].checkInNodeID, client1.checkInNodeID, "The read attribute does not match the registered value.") + asserts.assert_equal( + registeredClients[0].monitoredSubject, client1.subjectId, "The read attribute does not match the registered value.") + asserts.assert_equal( + registeredClients[0].clientType, client1.clientType, "The read attribute does not match the registered value.") + + # Reboot + self.step("2c") + if not is_ci: + self.wait_for_user_input(prompt_msg=f"Restart DUT. Press Enter when restart has been initiated.") + + self.step("2d") + if not is_ci: + time.sleep(wait_time_reboot) + + self.step("2e") + registeredClients = await self._read_icdm_attribute_expect_success( + attributes.RegisteredClients) + # Validate list size + asserts.assert_equal(len(registeredClients), 1, + "The expected length of RegisteredClients is 1. List has the wrong size.") + + # Validate entry values + asserts.assert_equal( + registeredClients[0].checkInNodeID, client1.checkInNodeID, "The read attribute does not match the registered value.") + asserts.assert_equal( + registeredClients[0].monitoredSubject, client1.subjectId, "The read attribute does not match the registered value.") + asserts.assert_equal( + registeredClients[0].clientType, client1.clientType, "The read attribute does not match the registered value.") + + self.step("3a") + try: + await self._send_single_icdm_command(commands.RegisterClient(checkInNodeID=client2.checkInNodeID, monitoredSubject=client2.subjectId, key=client2.key, clientType=client2.clientType)) + except InteractionModelError as e: + asserts.assert_equal( + e.status, Status.Success, "Unexpected error returned") + + self.step("3b") + registeredClients = await self._read_icdm_attribute_expect_success( + attributes.RegisteredClients) + # Validate list size + asserts.assert_equal(len(registeredClients), 1, + "The expected length of RegisteredClients is 1. List has the wrong size.") + + # Validate entry values + asserts.assert_equal( + registeredClients[0].checkInNodeID, client2.checkInNodeID, "The read attribute does not match the registered value.") + asserts.assert_equal( + registeredClients[0].monitoredSubject, client2.subjectId, "The read attribute does not match the registered value.") + asserts.assert_equal( + registeredClients[0].clientType, client2.clientType, "The read attribute does not match the registered value.") + + self.step("4a") + try: + await self._send_single_icdm_command(commands.RegisterClient(checkInNodeID=client3.checkInNodeID, monitoredSubject=client3.subjectId, key=client3.key, clientType=client3.clientType, verificationKey=kInvalidKey)) + except InteractionModelError as e: + asserts.assert_equal( + e.status, Status.Success, "Unexpected error returned") + + self.step("4b") + registeredClients = await self._read_icdm_attribute_expect_success( + attributes.RegisteredClients) + # Validate list size + asserts.assert_equal(len(registeredClients), 1, + "The expected length of RegisteredClients is 1. List has the wrong size.") + + # Validate entry values + asserts.assert_equal( + registeredClients[0].checkInNodeID, client3.checkInNodeID, "The read attribute does not match the registered value.") + asserts.assert_equal( + registeredClients[0].monitoredSubject, client3.subjectId, "The read attribute does not match the registered value.") + asserts.assert_equal( + registeredClients[0].clientType, client3.clientType, "The read attribute does not match the registered value.") + + self.step("5a") + try: + await self._send_single_icdm_command(commands.RegisterClient(checkInNodeID=client4.checkInNodeID, monitoredSubject=client4.subjectId, key=client4.key, clientType=client4.clientType, verificationKey=kIncorrectKey)) + except InteractionModelError as e: + asserts.assert_equal( + e.status, Status.Success, "Unexpected error returned") + + self.step("5b") + registeredClients = await self._read_icdm_attribute_expect_success( + attributes.RegisteredClients) + # Validate list size + asserts.assert_equal(len(registeredClients), 1, + "The expected length of RegisteredClients is 1. List has the wrong size.") + + # Validate entry values + asserts.assert_equal( + registeredClients[0].checkInNodeID, client4.checkInNodeID, "The read attribute does not match the registered value.") + asserts.assert_equal( + registeredClients[0].monitoredSubject, client4.subjectId, "The read attribute does not match the registered value.") + asserts.assert_equal( + registeredClients[0].clientType, client4.clientType, "The read attribute does not match the registered value.") + + self.step("6a") + try: + await self._send_single_icdm_command(commands.UnregisterClient(checkInNodeID=client4.checkInNodeID)) + except InteractionModelError as e: + asserts.assert_equal( + e.status, Status.Success, "Unexpected error returned") + + self.step("6b") + registeredClients = await self._read_icdm_attribute_expect_success( + attributes.RegisteredClients) + asserts.assert_equal(len(registeredClients), 0, + "The RegisteredClients list must be empty. List has the wrong size.") + + self.step(7) + ac = Clusters.AccessControl + previousAcl = await self.read_single_attribute_check_success(cluster=ac, attribute=ac.Attributes.Acl) + newAcls = [] + + # Set Admin permissions on Access Control cluster + newAclEntry = ac.Structs.AccessControlEntryStruct(privilege=ac.Enums.AccessControlEntryPrivilegeEnum.kAdminister, + authMode=ac.Enums.AccessControlEntryAuthModeEnum.kCase, + subjects=previousAcl[0].subjects, targets=[ac.Structs.AccessControlTargetStruct( + cluster=Clusters.AccessControl.id)], fabricIndex=previousAcl[0].fabricIndex + ) + newAcls.append(newAclEntry) + + # Set Manage permissions on ICD Management cluster + newAclEntry = ac.Structs.AccessControlEntryStruct(privilege=ac.Enums.AccessControlEntryPrivilegeEnum.kManage, + authMode=ac.Enums.AccessControlEntryAuthModeEnum.kCase, + subjects=previousAcl[0].subjects, targets=[ac.Structs.AccessControlTargetStruct( + cluster=Clusters.IcdManagement.id)], fabricIndex=previousAcl[0].fabricIndex + ) + newAcls.append(newAclEntry) + + try: + await self.default_controller.WriteAttribute(nodeid=self.dut_node_id, attributes=[(0, ac.Attributes.Acl(newAcls))]) + except InteractionModelError as e: + asserts.assert_equal( + e.status, Status.Success, "Unexpected error returned") + + self.step("8a") + try: + await self._send_single_icdm_command(commands.RegisterClient(checkInNodeID=client5.checkInNodeID, monitoredSubject=client5.subjectId, key=client5.key, clientType=client5.clientType)) + except InteractionModelError as e: + asserts.assert_equal( + e.status, Status.Success, "Unexpected error returned") + + self.step("8b") + try: + await self._send_single_icdm_command(commands.RegisterClient(checkInNodeID=client6.checkInNodeID, monitoredSubject=client6.subjectId, key=client6.key, clientType=client6.clientType, verificationKey=kInvalidKey)) + except InteractionModelError as e: + asserts.assert_equal( + e.status, Status.Failure, "Unexpected error returned") + + self.step("8c") + try: + await self._send_single_icdm_command(commands.RegisterClient(checkInNodeID=client7.checkInNodeID, monitoredSubject=client7.subjectId, key=client7.key, clientType=client7.clientType, verificationKey=kIncorrectKey)) + except InteractionModelError as e: + asserts.assert_equal( + e.status, Status.Failure, "Unexpected error returned") + + self.step("8d") + try: + await self._send_single_icdm_command(commands.RegisterClient(checkInNodeID=client8.checkInNodeID, monitoredSubject=client8.subjectId, key=client8.key, clientType=client8.clientType, verificationKey=client5.key)) + except InteractionModelError as e: + asserts.assert_equal( + e.status, Status.Success, "Unexpected error returned") + + self.step(9) + try: + await self._send_single_icdm_command(commands.UnregisterClient(checkInNodeID=client8.checkInNodeID, verificationKey=client8.key)) + except InteractionModelError as e: + asserts.assert_equal( + e.status, Status.Success, "Unexpected error returned") + + # Post-Condition steps + finally: + # Reset ACLs + try: + await self.default_controller.WriteAttribute(nodeid=self.dut_node_id, attributes=[(0, ac.Attributes.Acl(previousAcl))]) + except InteractionModelError as e: + asserts.assert_equal( + e.status, Status.Success, "Unexpected error returned") + + # Clear all RegisteredClients + registeredClients = await self._read_icdm_attribute_expect_success( + attributes.RegisteredClients) + + for client in registeredClients: + try: + await self._send_single_icdm_command(commands.UnregisterClient(checkInNodeID=client.checkInNodeID)) + except InteractionModelError as e: + asserts.assert_equal( + e.status, Status.Success, "Unexpected error returned") + + +if __name__ == "__main__": + default_matter_test_main() From 12202708cff0a3133311ef66acc2e11c947aa248 Mon Sep 17 00:00:00 2001 From: Mathieu Kardous Date: Mon, 5 Aug 2024 13:55:03 -0400 Subject: [PATCH 2/6] fix restyle --- .github/workflows/tests.yaml | 91 +++++++++++------------------------- 1 file changed, 28 insertions(+), 63 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index e0099cfba44440..6974999d0d134f 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -17,14 +17,13 @@ name: Tests on: push: branches-ignore: - - "dependabot/**" + - 'dependabot/**' pull_request: merge_group: workflow_dispatch: concurrency: - group: - ${{ github.ref }}-${{ github.workflow }}-${{ (github.event_name == + group: ${{ github.ref }}-${{ github.workflow }}-${{ (github.event_name == 'pull_request' && github.event.number) || (github.event_name == 'workflow_dispatch' && github.run_number) || github.sha }} cancel-in-progress: true @@ -43,9 +42,7 @@ jobs: env: BUILD_VARIANT: ${{matrix.build_variant}} CHIP_TOOL_VARIANT: ${{matrix.chip_tool}} - TSAN_OPTIONS: - "halt_on_error=1 - suppressions=scripts/tests/chiptest/tsan-linux-suppressions.txt" + TSAN_OPTIONS: "halt_on_error=1 suppressions=scripts/tests/chiptest/tsan-linux-suppressions.txt" LSAN_OPTIONS: detect_leaks=1 if: github.actor != 'restyled-io[bot]' @@ -53,8 +50,7 @@ jobs: container: image: ghcr.io/project-chip/chip-build:54 - options: - --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 + options: --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 net.ipv4.conf.all.forwarding=1 net.ipv6.conf.all.forwarding=1" steps: @@ -72,12 +68,9 @@ jobs: - name: Checkout submodules & Bootstrap uses: ./.github/actions/checkout-submodules-and-bootstrap with: - platform: linux - bootstrap-log-name: - bootstrap-logs-linux-${{ matrix.build_variant }}${{ - matrix.chip_tool }} - - name: - Try to ensure the directories for core dumping exist and we + platform: linux + bootstrap-log-name: bootstrap-logs-linux-${{ matrix.build_variant }}${{ matrix.chip_tool }} + - name: Try to ensure the directories for core dumping exist and we can write them. run: | mkdir /tmp/cores || true @@ -238,9 +231,7 @@ jobs: --copy-artifacts-to objdir-clone \ " - - name: - Run Tests using the python parser sending commands to - chip-tool + - name: Run Tests using the python parser sending commands to chip-tool run: | ./scripts/run_in_build_env.sh \ "./scripts/tests/run_test_suite.py \ @@ -261,9 +252,7 @@ jobs: --network-manager-app ./out/linux-x64-network-manager-${BUILD_VARIANT}/matter-network-manager-app \ " - - name: - Run purposeful failure tests using the python parser sending - commands to chip-tool + - name: Run purposeful failure tests using the python parser sending commands to chip-tool run: | ./scripts/run_in_build_env.sh \ "./scripts/tests/run_test_suite.py \ @@ -328,9 +317,7 @@ jobs: uses: actions/upload-artifact@v4 if: ${{ failure() && !env.ACT }} with: - name: - crash-core-linux-${{ matrix.build_variant }}${{ - matrix.chip_tool }} + name: crash-core-linux-${{ matrix.build_variant }}${{ matrix.chip_tool }} path: /tmp/cores/ # Cores are big; don't hold on to them too long. retention-days: 5 @@ -338,9 +325,7 @@ jobs: uses: actions/upload-artifact@v4 if: ${{ failure() && !env.ACT }} with: - name: - crash-objdir-linux-${{ matrix.build_variant }}${{ - matrix.chip_tool }} + name: crash-objdir-linux-${{ matrix.build_variant }}${{ matrix.chip_tool }} path: objdir-clone/ # objdirs are big; don't hold on to them too long. retention-days: 5 @@ -356,9 +341,7 @@ jobs: BUILD_VARIANT: ${{matrix.build_variant}} CHIP_TOOL_VARIANT: ${{matrix.chip_tool}} TSAN_OPTIONS: "halt_on_error=1" - LSAN_OPTIONS: - detect_leaks=1 - suppressions=scripts/tests/chiptest/lsan-mac-suppressions.txt + LSAN_OPTIONS: detect_leaks=1 suppressions=scripts/tests/chiptest/lsan-mac-suppressions.txt if: github.actor != 'restyled-io[bot]' runs-on: macos-13 @@ -379,10 +362,9 @@ jobs: - name: Checkout submodules & Bootstrap uses: ./.github/actions/checkout-submodules-and-bootstrap with: - platform: darwin - bootstrap-log-name: - bootstrap-logs-darwin-${{ matrix.build_variant }}${{ - matrix.chip_tool }} + platform: darwin + bootstrap-log-name: bootstrap-logs-darwin-${{ matrix.build_variant }}${{ matrix.chip_tool }} + - name: Build Apps run: | @@ -403,9 +385,7 @@ jobs: --copy-artifacts-to objdir-clone \ " - - name: - Run Tests using the python parser sending commands to - chip-tool + - name: Run Tests using the python parser sending commands to chip-tool run: | ./scripts/run_in_build_env.sh \ "./scripts/tests/run_test_suite.py \ @@ -427,9 +407,7 @@ jobs: --network-manager-app ./out/darwin-x64-network-manager-${BUILD_VARIANT}/matter-network-manager-app \ " - - name: - Run purposeful failure tests using the python parser sending - commands to chip-tool + - name: Run purposeful failure tests using the python parser sending commands to chip-tool run: | ./scripts/run_in_build_env.sh \ "./scripts/tests/run_test_suite.py \ @@ -448,9 +426,7 @@ jobs: uses: actions/upload-artifact@v4 if: ${{ failure() && !env.ACT }} with: - name: - crash-core-darwin-${{ matrix.build_variant }}${{ - matrix.chip_tool }} + name: crash-core-darwin-${{ matrix.build_variant }}${{ matrix.chip_tool }} path: /cores/ # Cores are big; don't hold on to them too long. retention-days: 5 @@ -458,17 +434,13 @@ jobs: uses: actions/upload-artifact@v4 if: ${{ failure() && !env.ACT }} with: - name: - crash-log-darwin-${{ matrix.build_variant }}${{ - matrix.chip_tool }} + name: crash-log-darwin-${{ matrix.build_variant }}${{ matrix.chip_tool }} path: ~/Library/Logs/DiagnosticReports/ - name: Uploading objdir for debugging uses: actions/upload-artifact@v4 if: ${{ failure() && !env.ACT }} with: - name: - crash-objdir-darwin-${{ matrix.build_variant }}${{ - matrix.chip_tool }} + name: crash-objdir-darwin-${{ matrix.build_variant }}${{ matrix.chip_tool }} path: objdir-clone/ # objdirs are big; don't hold on to them too long. retention-days: 5 @@ -477,17 +449,14 @@ jobs: name: REPL Tests - Linux env: - TSAN_OPTIONS: - "halt_on_error=1 - suppressions=scripts/tests/chiptest/tsan-linux-suppressions.txt" + TSAN_OPTIONS: "halt_on_error=1 suppressions=scripts/tests/chiptest/tsan-linux-suppressions.txt" if: github.actor != 'restyled-io[bot]' runs-on: ubuntu-latest container: image: ghcr.io/project-chip/chip-build:66 - options: - --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 + options: --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 net.ipv4.conf.all.forwarding=0 net.ipv6.conf.all.forwarding=0" steps: @@ -496,12 +465,9 @@ jobs: - name: Checkout submodules & Bootstrap uses: ./.github/actions/checkout-submodules-and-bootstrap with: - platform: linux - bootstrap-log-name: - bootstrap-logs-linux-${{ matrix.build_variant }}${{ - matrix.chip_tool }} - - name: - Try to ensure the directories for core dumping exist and we + platform: linux + bootstrap-log-name: bootstrap-logs-linux-${{ matrix.build_variant }}${{ matrix.chip_tool }} + - name: Try to ensure the directories for core dumping exist and we can write them. run: | mkdir /tmp/cores || true @@ -553,6 +519,7 @@ jobs: scripts/run_in_python_env.sh out/venv 'python3 ./src/python_testing/test_testing/test_TC_SC_7_1.py' scripts/run_in_python_env.sh out/venv 'python3 ./src/python_testing/test_testing/TestDecorators.py' + - name: Uploading core files uses: actions/upload-artifact@v4 if: ${{ failure() && !env.ACT }} @@ -599,10 +566,8 @@ jobs: - name: Checkout submodules & Bootstrap uses: ./.github/actions/checkout-submodules-and-bootstrap with: - platform: darwin - bootstrap-log-name: - bootstrap-logs-darwin-${{ matrix.build_variant }}${{ - matrix.chip_tool }} + platform: darwin + bootstrap-log-name: bootstrap-logs-darwin-${{ matrix.build_variant }}${{ matrix.chip_tool }} - name: Build Python REPL and example apps run: | From 19dedf51c82440bf24e2ad39ba7c8f835cb221d2 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Mon, 5 Aug 2024 17:57:59 +0000 Subject: [PATCH 3/6] Restyled by prettier-json --- src/app/tests/suites/manualTests.json | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/app/tests/suites/manualTests.json b/src/app/tests/suites/manualTests.json index 7aef9cd2736a08..8048c7b3be6e22 100644 --- a/src/app/tests/suites/manualTests.json +++ b/src/app/tests/suites/manualTests.json @@ -117,10 +117,7 @@ "GeneralCommissioning": ["Test_TC_CGEN_2_2"], "GeneralDiagnostics": ["Test_TC_DGGEN_2_2"], "Identify": ["Test_TC_I_3_2"], - "IcdManagement": [ - "Test_TC_ICDM_4_1", - "Test_TC_ICDM_5_1" - ], + "IcdManagement": ["Test_TC_ICDM_4_1", "Test_TC_ICDM_5_1"], "IlluminanceMeasurement": [], "InteractionDataModel": [ "Test_TC_IDM_1_1", From d92d9d3fa5d9b123994fdde6c3e492a08a6728e0 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Mon, 5 Aug 2024 17:58:06 +0000 Subject: [PATCH 4/6] Restyled by isort --- src/python_testing/TC_ICDM_3_2.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/python_testing/TC_ICDM_3_2.py b/src/python_testing/TC_ICDM_3_2.py index 0f69b1d63624bb..0335d9f2834883 100644 --- a/src/python_testing/TC_ICDM_3_2.py +++ b/src/python_testing/TC_ICDM_3_2.py @@ -17,9 +17,8 @@ # import logging import os -from dataclasses import dataclass import time - +from dataclasses import dataclass import chip.clusters as Clusters from chip.interaction_model import InteractionModelError, Status From 138a3a8d5d8ac5eb739bb9f2447620b106ac1135 Mon Sep 17 00:00:00 2001 From: Mathieu Kardous Date: Mon, 5 Aug 2024 14:03:03 -0400 Subject: [PATCH 5/6] restyle and linter fix --- src/python_testing/TC_ICDM_3_2.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/python_testing/TC_ICDM_3_2.py b/src/python_testing/TC_ICDM_3_2.py index 0335d9f2834883..7ab0afbb3a90f8 100644 --- a/src/python_testing/TC_ICDM_3_2.py +++ b/src/python_testing/TC_ICDM_3_2.py @@ -16,7 +16,6 @@ # limitations under the License. # import logging -import os import time from dataclasses import dataclass @@ -220,7 +219,7 @@ async def test_TC_ICDM_3_2(self): # Reboot self.step("2c") if not is_ci: - self.wait_for_user_input(prompt_msg=f"Restart DUT. Press Enter when restart has been initiated.") + self.wait_for_user_input(prompt_msg="Restart DUT. Press Enter when restart has been initiated.") self.step("2d") if not is_ci: From 962f5c40609e9c7ae5801aab2b3a5d97d647685f Mon Sep 17 00:00:00 2001 From: Mathieu Kardous Date: Mon, 5 Aug 2024 16:02:35 -0400 Subject: [PATCH 6/6] Add CI test arguments --- src/python_testing/TC_ICDM_3_2.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/python_testing/TC_ICDM_3_2.py b/src/python_testing/TC_ICDM_3_2.py index 7ab0afbb3a90f8..5a194420c3619e 100644 --- a/src/python_testing/TC_ICDM_3_2.py +++ b/src/python_testing/TC_ICDM_3_2.py @@ -15,6 +15,19 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === +# test-runner-runs: run1 +# test-runner-run/run1/app: ${LIT_ICD_APP} +# test-runner-run/run1/factoryreset: True +# test-runner-run/run1/quiet: True +# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json +# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === + import logging import time from dataclasses import dataclass