From 079a65de663b9dfeb7ae6e3ff62ac9018fba7549 Mon Sep 17 00:00:00 2001 From: Justin Wood Date: Thu, 28 Jul 2022 22:09:43 -0700 Subject: [PATCH] Remove weak MatterGetAccessPrivilegeForXX functions and add stubs for test-helper and chip-im-responder/initiator (#21220) (#21387) Co-authored-by: Wang Qixiang <43193572+wqx6@users.noreply.github.com> --- src/app/RequiredPrivilege.cpp | 20 ---------- src/app/tests/BUILD.gn | 1 + src/app/tests/integration/BUILD.gn | 2 + .../integration/RequiredPrivilegeStubs.cpp | 38 +++++++++++++++++++ 4 files changed, 41 insertions(+), 20 deletions(-) create mode 100644 src/app/tests/integration/RequiredPrivilegeStubs.cpp diff --git a/src/app/RequiredPrivilege.cpp b/src/app/RequiredPrivilege.cpp index 621105891431a3..012a48c421c130 100644 --- a/src/app/RequiredPrivilege.cpp +++ b/src/app/RequiredPrivilege.cpp @@ -25,23 +25,3 @@ constexpr Access::Privilege RequiredPrivilege::kPrivilegeMapper[]; } // namespace app } // namespace chip - -int __attribute__((weak)) MatterGetAccessPrivilegeForReadAttribute(chip::ClusterId cluster, chip::AttributeId attribute) -{ - return kMatterAccessPrivilegeAdminister; -} - -int __attribute__((weak)) MatterGetAccessPrivilegeForWriteAttribute(chip::ClusterId cluster, chip::AttributeId attribute) -{ - return kMatterAccessPrivilegeAdminister; -} - -int __attribute__((weak)) MatterGetAccessPrivilegeForInvokeCommand(chip::ClusterId cluster, chip::CommandId command) -{ - return kMatterAccessPrivilegeAdminister; -} - -int __attribute__((weak)) MatterGetAccessPrivilegeForReadEvent(chip::ClusterId cluster, chip::EventId event) -{ - return kMatterAccessPrivilegeAdminister; -} diff --git a/src/app/tests/BUILD.gn b/src/app/tests/BUILD.gn index 6646c32fb4b6e4..306c5896c754b1 100644 --- a/src/app/tests/BUILD.gn +++ b/src/app/tests/BUILD.gn @@ -26,6 +26,7 @@ static_library("helpers") { sources = [ "AppTestContext.cpp", "AppTestContext.h", + "integration/RequiredPrivilegeStubs.cpp", ] cflags = [ "-Wconversion" ] diff --git a/src/app/tests/integration/BUILD.gn b/src/app/tests/integration/BUILD.gn index 77eb99bcaa3f27..05e06d897ca690 100644 --- a/src/app/tests/integration/BUILD.gn +++ b/src/app/tests/integration/BUILD.gn @@ -21,6 +21,7 @@ assert(chip_build_tools) executable("chip-im-initiator") { sources = [ + "RequiredPrivilegeStubs.cpp", "chip_im_initiator.cpp", "common.cpp", ] @@ -41,6 +42,7 @@ executable("chip-im-initiator") { executable("chip-im-responder") { sources = [ "MockEvents.cpp", + "RequiredPrivilegeStubs.cpp", "chip_im_responder.cpp", "common.cpp", ] diff --git a/src/app/tests/integration/RequiredPrivilegeStubs.cpp b/src/app/tests/integration/RequiredPrivilegeStubs.cpp new file mode 100644 index 00000000000000..17dbc27490520c --- /dev/null +++ b/src/app/tests/integration/RequiredPrivilegeStubs.cpp @@ -0,0 +1,38 @@ +/* + * + * 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. + */ + +#include + +int MatterGetAccessPrivilegeForReadAttribute(chip::ClusterId cluster, chip::AttributeId attribute) +{ + return kMatterAccessPrivilegeAdminister; +} + +int MatterGetAccessPrivilegeForWriteAttribute(chip::ClusterId cluster, chip::AttributeId attribute) +{ + return kMatterAccessPrivilegeAdminister; +} + +int MatterGetAccessPrivilegeForInvokeCommand(chip::ClusterId cluster, chip::CommandId command) +{ + return kMatterAccessPrivilegeAdminister; +} + +int MatterGetAccessPrivilegeForReadEvent(chip::ClusterId cluster, chip::EventId event) +{ + return kMatterAccessPrivilegeAdminister; +}