Skip to content

Commit

Permalink
Merge branch 'master' into fix-grpkey-pics-gen
Browse files Browse the repository at this point in the history
  • Loading branch information
andy31415 authored Jun 18, 2024
2 parents b58afb0 + e1d746a commit db852bb
Show file tree
Hide file tree
Showing 80 changed files with 454 additions and 991 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/examples-mbed.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ jobs:
rm -rf ./out
- name: Build unit tests
# Temporarily disable build due to running out of flash space
# Temporarily disabled build due to running out of flash space
# TODO Issue #33978: re-enable unit testing after split of unit tests is done
if: false
run: scripts/tests/mbed/mbed_unit_tests.sh -b=$APP_TARGET -p=$APP_PROFILE

Expand Down
8 changes: 8 additions & 0 deletions .pullapprove.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,14 @@ groups:
teams: [reviewers-google]
reviews:
request: 10
shared-reviewers-grundfos:
type: optional
conditions:
- files.include('*')
reviewers:
teams: [reviewers-grundfos]
reviews:
request: 10
shared-reviewers-irobot:
type: optional
conditions:
Expand Down
2 changes: 0 additions & 2 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import("//build_overrides/build.gni")
import("//build_overrides/chip.gni")
import("//build_overrides/mbedtls.gni")
import("//build_overrides/nlassert.gni")
import("//build_overrides/nlunit_test.gni")
import("//build_overrides/pigweed.gni")

import("//src/lwip/lwip.gni")
Expand Down Expand Up @@ -135,7 +134,6 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") {
"${chip_root}/src/system",
"${chip_root}/src/transport",
"${nlassert_root}:nlassert",
"${nlunit_test_root}:nlunit-test",
]

if (enable_fuzz_test_targets) {
Expand Down
101 changes: 2 additions & 99 deletions build/chip/chip_test_suite.gni
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ assert(chip_build_tests)
# ]
#
# test_sources = [
# "TestFoo.cpp", # Files are parsed for `CHIP_REGISTER_TEST_SUITE(...)`
# "TestBar.cpp", # and a driver is created automatically
# "TestFoo.cpp",
# "TestBar.cpp",
# ]
#
# public_deps = [
Expand Down Expand Up @@ -175,100 +175,3 @@ template("chip_test_suite") {
}
}
}

# TODO [PW_MIGRATION]: remove this once transition away from nlunit-test is completed
template("chip_test_suite_using_nltest") {
_suite_name = target_name

# Ensures that the common library has sources containing both common
# and individual unit tests.
if (!defined(invoker.sources)) {
invoker.sources = []
}

if (defined(invoker.test_sources)) {
invoker.sources += invoker.test_sources
}

if (chip_build_test_static_libraries) {
_target_type = "static_library"
} else {
_target_type = "source_set"
}
target(_target_type, "${_suite_name}.lib") {
forward_variables_from(invoker, "*", [ "tests" ])

output_dir = "${root_out_dir}/lib"

if (!defined(invoker.public_deps)) {
public_deps = []
}

if (current_os != "zephyr" && current_os != "mbed") {
# Depend on stdio logging, and have it take precedence over the default platform backend
public_deps += [ "${chip_root}/src/platform/logging:force_stdio" ]
}
}
if (chip_link_tests) {
tests = []

if (defined(invoker.test_sources)) {
foreach(_test, invoker.test_sources) {
_test_name = string_replace(_test, ".cpp", "")

_driver_name = "${root_gen_dir}/${_test_name}.driver.cpp"

action("${_test_name}_generate_driver") {
script = "${chip_root}/scripts/gen_test_driver.py"

inputs = [ _test ]
outputs = [ _driver_name ]
args = [
"--input_file=" + rebase_path(_test, root_build_dir),
"--output_file=" + rebase_path(_driver_name, root_build_dir),
]
}

chip_test(_test_name) {
sources = [ _driver_name ]
public_deps = [
":${_suite_name}.lib",
":${_test_name}_generate_driver",
]
}
tests += [ _test_name ]
}
}

if (defined(invoker.tests)) {
foreach(_test, invoker.tests) {
chip_test(_test) {
sources = [ "${_test}Driver.cpp" ]

public_deps = [ ":${_suite_name}.lib" ]
}
tests += [ _test ]
}
}

group(_suite_name) {
deps = []
foreach(_test, tests) {
deps += [ ":${_test}" ]
}
}

if (chip_pw_run_tests) {
group("${_suite_name}_run") {
deps = []
foreach(_test, tests) {
deps += [ ":${_test}.run" ]
}
}
}
} else {
group(_suite_name) {
deps = [ ":${_suite_name}.lib" ]
}
}
}
1 change: 0 additions & 1 deletion build/chip/fuzz_test.gni
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ declare_args() {
#
# public_deps = [
# "${chip_root}/src/lib/foo", # add dependencies here
# "${nlunit_test_root}:nlunit-test",
# ]
# }
#
Expand Down
18 changes: 0 additions & 18 deletions build_overrides/nlunit_test.gni

This file was deleted.

1 change: 1 addition & 0 deletions examples/bridge-app/linux/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ int AddDeviceEndpoint(Device * dev, EmberAfEndpointType * ep, const Span<const E
}
if (err != CHIP_ERROR_ENDPOINT_EXISTS)
{
gDevices[index] = nullptr;
return -1;
}
// Handle wrap condition
Expand Down
18 changes: 0 additions & 18 deletions examples/build_overrides/nlunit_test.gni

This file was deleted.

2 changes: 2 additions & 0 deletions examples/fabric-admin/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ static_library("fabric-admin-utils") {
"${chip_root}/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp",
"commands/clusters/ModelCommand.cpp",
"commands/clusters/ModelCommand.h",
"commands/clusters/ReportCommand.cpp",
"commands/clusters/ReportCommand.h",
"commands/common/CHIPCommand.cpp",
"commands/common/CHIPCommand.h",
"commands/common/Command.cpp",
Expand Down
80 changes: 80 additions & 0 deletions examples/fabric-admin/commands/clusters/ReportCommand.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/*
* Copyright (c) 2024 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.
*
*/

#include "ReportCommand.h"

#include <app/InteractionModelEngine.h>
#include <inttypes.h>

using namespace ::chip;

void ReportCommand::OnAttributeData(const app::ConcreteDataAttributePath & path, TLV::TLVReader * data,
const app::StatusIB & status)
{
CHIP_ERROR error = status.ToChipError();
if (CHIP_NO_ERROR != error)
{
LogErrorOnFailure(RemoteDataModelLogger::LogErrorAsJSON(path, status));

ChipLogError(NotSpecified, "Response Failure: %s", ErrorStr(error));
mError = error;
return;
}

if (data == nullptr)
{
ChipLogError(NotSpecified, "Response Failure: No Data");
mError = CHIP_ERROR_INTERNAL;
return;
}

LogErrorOnFailure(RemoteDataModelLogger::LogAttributeAsJSON(path, data));
}

void ReportCommand::OnEventData(const app::EventHeader & eventHeader, TLV::TLVReader * data, const app::StatusIB * status)
{
if (status != nullptr)
{
CHIP_ERROR error = status->ToChipError();
if (CHIP_NO_ERROR != error)
{
LogErrorOnFailure(RemoteDataModelLogger::LogErrorAsJSON(eventHeader, *status));

ChipLogError(NotSpecified, "Response Failure: %s", ErrorStr(error));
mError = error;
return;
}
}

if (data == nullptr)
{
ChipLogError(NotSpecified, "Response Failure: No Data");
mError = CHIP_ERROR_INTERNAL;
return;
}

LogErrorOnFailure(RemoteDataModelLogger::LogEventAsJSON(eventHeader, data));

CHIP_ERROR error = DataModelLogger::LogEvent(eventHeader, data);
if (CHIP_NO_ERROR != error)
{
ChipLogError(NotSpecified, "Response Failure: Can not decode Data");
mError = error;
return;
}
}
63 changes: 2 additions & 61 deletions examples/fabric-admin/commands/clusters/ReportCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,69 +32,10 @@ class ReportCommand : public InteractionModelReports, public ModelCommand, publi

/////////// ReadClient Callback Interface /////////
void OnAttributeData(const chip::app::ConcreteDataAttributePath & path, chip::TLV::TLVReader * data,
const chip::app::StatusIB & status) override
{
CHIP_ERROR error = status.ToChipError();
if (CHIP_NO_ERROR != error)
{
LogErrorOnFailure(RemoteDataModelLogger::LogErrorAsJSON(path, status));

ChipLogError(NotSpecified, "Response Failure: %s", chip::ErrorStr(error));
mError = error;
return;
}

if (data == nullptr)
{
ChipLogError(NotSpecified, "Response Failure: No Data");
mError = CHIP_ERROR_INTERNAL;
return;
}

LogErrorOnFailure(RemoteDataModelLogger::LogAttributeAsJSON(path, data));

error = DataModelLogger::LogAttribute(path, data);
if (CHIP_NO_ERROR != error)
{
ChipLogError(NotSpecified, "Response Failure: Can not decode Data");
mError = error;
return;
}
}
const chip::app::StatusIB & status) override;

void OnEventData(const chip::app::EventHeader & eventHeader, chip::TLV::TLVReader * data,
const chip::app::StatusIB * status) override
{
if (status != nullptr)
{
CHIP_ERROR error = status->ToChipError();
if (CHIP_NO_ERROR != error)
{
LogErrorOnFailure(RemoteDataModelLogger::LogErrorAsJSON(eventHeader, *status));

ChipLogError(NotSpecified, "Response Failure: %s", chip::ErrorStr(error));
mError = error;
return;
}
}

if (data == nullptr)
{
ChipLogError(NotSpecified, "Response Failure: No Data");
mError = CHIP_ERROR_INTERNAL;
return;
}

LogErrorOnFailure(RemoteDataModelLogger::LogEventAsJSON(eventHeader, data));

CHIP_ERROR error = DataModelLogger::LogEvent(eventHeader, data);
if (CHIP_NO_ERROR != error)
{
ChipLogError(NotSpecified, "Response Failure: Can not decode Data");
mError = error;
return;
}
}
const chip::app::StatusIB * status) override;

void OnError(CHIP_ERROR error) override
{
Expand Down
Loading

0 comments on commit db852bb

Please sign in to comment.