From 146810804893d336f53e4446ae620713bb530dc6 Mon Sep 17 00:00:00 2001 From: Tennessee Carmel-Veilleux Date: Wed, 16 Feb 2022 10:42:55 -0500 Subject: [PATCH] Fix TC_SWDIAG_3_1.yaml test case on Linux (#15215) * Fix TC_SWDIAG_3_1.yaml test case on Linux - The test case previously expected used/free heap value of 0. - Now the SDK is implementing heap read properly from Linux when built with glibc. This made the code return a real value that fails the test. - Overall, there is no "value" value for heap, we just need a value. The explicit value was replaced with expecting a returned value back. * Restyled by whitespace * Restyled by shfmt Co-authored-by: Restyled.io --- scripts/tools/zap_regen_yaml_tests.sh | 26 +++++++++++++++++++ .../certification/Test_TC_SWDIAG_3_1.yaml | 6 +++-- .../Framework/CHIPTests/CHIPClustersTests.m | 10 ------- .../chip-tool/zap-generated/test/Commands.h | 6 ++--- 4 files changed, 32 insertions(+), 16 deletions(-) create mode 100755 scripts/tools/zap_regen_yaml_tests.sh diff --git a/scripts/tools/zap_regen_yaml_tests.sh b/scripts/tools/zap_regen_yaml_tests.sh new file mode 100755 index 00000000000000..2bd5b4cd68f5ca --- /dev/null +++ b/scripts/tools/zap_regen_yaml_tests.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +# +# +# Copyright (c) 2022 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. +# + +# +# Description: +# Run this from root of SDK to regenerate only the ZAP needed by chip-tool, +# rather than all of zap like `./scripts/tools/zap_regen_all.py +# + +./scripts/tools/zap/generate.py src/controller/data_model/controller-clusters.zap \ + -o zzz_generated/chip-tool/zap-generated -t examples/chip-tool/templates/templates.json diff --git a/src/app/tests/suites/certification/Test_TC_SWDIAG_3_1.yaml b/src/app/tests/suites/certification/Test_TC_SWDIAG_3_1.yaml index 426229bfabeee1..a7b1cd48a0236f 100644 --- a/src/app/tests/suites/certification/Test_TC_SWDIAG_3_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_SWDIAG_3_1.yaml @@ -47,7 +47,8 @@ tests: attribute: "CurrentHeapUsed" PICS: A_CURRENTHEAPUSED response: - value: 0 + constraints: + type: uint64 - label: "Reads CurrentHeapHighWaterMark attribute value from DUT" optional: true @@ -55,4 +56,5 @@ tests: attribute: "CurrentHeapHighWatermark" PICS: A_CURRENTHEAPHIGHWATERMARK response: - value: 0 + constraints: + type: uint64 diff --git a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m index 18a96b87b9eae5..186b905ec4b01b 100644 --- a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m +++ b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m @@ -45112,11 +45112,6 @@ - (void)testSendClusterTest_TC_SWDIAG_3_1_000002_ReadAttribute XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedLongLongValue], 0ULL); - } - [expectation fulfill]; }]; @@ -45141,11 +45136,6 @@ - (void)testSendClusterTest_TC_SWDIAG_3_1_000003_ReadAttribute XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedLongLongValue], 0ULL); - } - [expectation fulfill]; }]; diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index bb6ffc3e2a942b..bc445feeeaa7f7 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -81421,8 +81421,7 @@ class Test_TC_SWDIAG_3_1 : public TestCommand void OnSuccessResponse_2(uint64_t currentHeapUsed) { - VerifyOrReturn(CheckValue("currentHeapUsed", currentHeapUsed, 0ULL)); - + VerifyOrReturn(CheckConstraintType("currentHeapUsed", "", "uint64")); NextTest(); } @@ -81448,8 +81447,7 @@ class Test_TC_SWDIAG_3_1 : public TestCommand void OnSuccessResponse_3(uint64_t currentHeapHighWatermark) { - VerifyOrReturn(CheckValue("currentHeapHighWatermark", currentHeapHighWatermark, 0ULL)); - + VerifyOrReturn(CheckConstraintType("currentHeapHighWatermark", "", "uint64")); NextTest(); } };