Skip to content

Commit

Permalink
Merge branch 'master' into mdns-resolver-tester
Browse files Browse the repository at this point in the history
  • Loading branch information
arkq committed May 4, 2023
2 parents 75f801b + 5ff1818 commit 2bb4003
Show file tree
Hide file tree
Showing 238 changed files with 7,940 additions and 10,309 deletions.
1 change: 0 additions & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ exclude = third_party
# TODO: Remove the paths below when all bugs are fixed
src/tools/chip-cert/*
src/test_driver/mbed/*
src/test_driver/linux-cirque/*
build/chip/java/tests/*
build/chip/linux/*
build/config/linux/*
Expand Down
45 changes: 45 additions & 0 deletions .github/workflows/minimal-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Copyright (c) 2023 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.

name: Minimal Build (Linux / configure)

on:
push:
pull_request:
merge_group:

concurrency:
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

jobs:
minimal:
name: Linux / configure build of all-clusters-app
timeout-minutes: 60

if: github.actor != 'restyled-io[bot]'
runs-on: ubuntu-latest

container:
image: connectedhomeip/chip-build-minimal:0.7.2

steps:
- name: Checkout
uses: actions/checkout@v3
- name: Checkout submodules
run: scripts/checkout_submodules.py --allow-changing-global-git-config --shallow --platform linux
- name: Configure and build All Clusters App
timeout-minutes: 10
run: |
CC=gcc CXX=g++ scripts/configure --project=examples/all-clusters-app/linux && ./ninja-build
11 changes: 10 additions & 1 deletion build/config/BUILDCONFIG.gn
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,17 @@ if (host_toolchain == "") {
}
}

_custom_toolchain = {
import("${_build_overrides.build_root}/toolchain/custom/custom.gni")
}

if (_chip_defaults.custom_toolchain != "") {
_default_toolchain = _chip_defaults.custom_toolchain
if (filter_include([ _chip_defaults.custom_toolchain ], [ "/*" ]) == []) {
# Interpret relative toolchain names relative to ${build_root}/toolchain/
_default_toolchain = "${_build_overrides.build_root}/toolchain/${_chip_defaults.custom_toolchain}"
} else {
_default_toolchain = _chip_defaults.custom_toolchain
}
} else if (target_os == "all") {
_default_toolchain = "${_pigweed_overrides.dir_pw_toolchain}/default"
} else if (target_os == "linux") {
Expand Down
12 changes: 1 addition & 11 deletions build/toolchain/custom/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,9 @@

import("//build_overrides/build.gni")
import("${build_root}/config/compiler/compiler.gni")
import("${build_root}/toolchain/custom/custom.gni")
import("${build_root}/toolchain/gcc_toolchain.gni")

declare_args() {
# C compiler to use for target build.
target_cc = ""

# C++ compiler to use for target build.
target_cxx = ""

# Archive tool to use for target build.
target_ar = ""
}

gcc_toolchain("custom") {
if (target_cc == "" || target_cxx == "" || target_ar == "") {
assert(false,
Expand Down
27 changes: 27 additions & 0 deletions build/toolchain/custom/custom.gni
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright (c) 2023 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.

declare_args() {
# C compiler to use for target build.
# Only relevant with custom_toolchain = "custom".
target_cc = ""

# C++ compiler to use for target build.
# Only relevant with custom_toolchain = "custom".
target_cxx = ""

# Archive tool to use for target build.
# Only relevant with custom_toolchain = "custom".
target_ar = ""
}
5 changes: 5 additions & 0 deletions config/tizen/chip-gn/platform/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ pkg_config("glib") {
]
}

pkg_config("capi-system-info") {
packages = [ "capi-system-info" ]
}

if (chip_mdns == "platform") {
pkg_config("nsd-dns-sd") {
packages = [ "nsd-dns-sd" ]
Expand Down Expand Up @@ -64,6 +68,7 @@ source_set("tizen") {
":dlog",
":glib",
":capi-appfw-preference",
":capi-system-info",
]

if (chip_mdns == "platform") {
Expand Down
52 changes: 51 additions & 1 deletion docs/guides/BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ sudo apt-get install git gcc g++ pkg-config libssl-dev libdbus-1-dev \

#### UI builds

If building `-with-ui` variant, also install SDL2:
If building via `build_examples.py` and `-with-ui` variant, also install SDL2:

```
sudo apt-get install libsdl2-dev
Expand Down Expand Up @@ -251,6 +251,56 @@ ninja -C out/host src/inet/tests:tests_run
>
> This means that the tests passed in a previous build.
## Using `build_examples.py`
The script `./scripts/build/build_examples.py` provides a uniform build
interface into using `gn`, `cmake`, `ninja` and other tools as needed to compile
various platforms.
Use `./scripts/build/build_examples.py targets` to see a list of supported
targets.
Example build commands:
```
# Compiles and runs all tests on the host:
./scripts/build/build_examples.py --target linux-x64-tests build

# Compiles fuzzing tagets using libfuzzer (fuzzing requires clang)
./scripts/build/build_examples.py --target linux-x64-tests-clang-asan-libfuzzer build

# Compiles a esp32 example
./scripts/build/build_examples.py --target esp32-m5stack-all-clusters build

# Compiles a nrf example
./scripts/build/build_examples.py --target nrf-nrf5340dk-pump build
```
### `libfuzzer` unit tests
`libfuzzer` unit tests tests are only compiled but not executed (you have to
manually execute them). For best error detection, some form of sanitizer like
`asan` should be used.
To compile, use:
```
./scripts/build/build_examples.py --target linux-x64-tests-clang-asan-libfuzzer build
```
After which tests should be located in
`out/linux-x64-tests-clang-asan-libfuzzer/tests/`.
#### `ossfuzz` configurations
`ossfuzz` configurations are not stand-alone fuzzing and instead serve as an
integration point with external fuzzing automated builds.
They pick up environment variables such as `$CFLAGS`, `$CXXFLAGS` and
`$LIB_FUZZING_ENGINE`.
You likely want `libfuzzer` + `asan` builds instead for local testing.
## Build custom configuration
The build is configured by setting build arguments. These you can set in one of
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,13 @@ server cluster Scenes = 5 {
}

response struct AddSceneResponse = 0 {
ENUM8 status = 0;
status status = 0;
group_id groupID = 1;
INT8U sceneID = 2;
}

response struct ViewSceneResponse = 1 {
ENUM8 status = 0;
status status = 0;
group_id groupID = 1;
INT8U sceneID = 2;
optional INT16U transitionTime = 3;
Expand All @@ -207,24 +207,24 @@ server cluster Scenes = 5 {
}

response struct RemoveSceneResponse = 2 {
ENUM8 status = 0;
status status = 0;
group_id groupID = 1;
INT8U sceneID = 2;
}

response struct RemoveAllScenesResponse = 3 {
ENUM8 status = 0;
status status = 0;
group_id groupID = 1;
}

response struct StoreSceneResponse = 4 {
ENUM8 status = 0;
status status = 0;
group_id groupID = 1;
INT8U sceneID = 2;
}

response struct GetSceneMembershipResponse = 6 {
ENUM8 status = 0;
status status = 0;
nullable INT8U capacity = 1;
group_id groupID = 2;
optional INT8U sceneList[] = 3;
Expand Down Expand Up @@ -702,11 +702,49 @@ server cluster Actions = 37 {
Commissioning and operational determination of Node characteristics, such as Vendor ID, Product ID and serial number,
which apply to the whole Node. Also allows setting user device information such as location. */
server cluster BasicInformation = 40 {
enum ColorEnum : ENUM8 {
kBlack = 0;
kNavy = 1;
kGreen = 2;
kTeal = 3;
kMaroon = 4;
kPurple = 5;
kOlive = 6;
kGray = 7;
kBlue = 8;
kLime = 9;
kAqua = 10;
kRed = 11;
kFuchsia = 12;
kYellow = 13;
kWhite = 14;
kNickel = 15;
kChrome = 16;
kBrass = 17;
kCopper = 18;
kSilver = 19;
kGold = 20;
}

enum ProductFinishEnum : ENUM8 {
kOther = 0;
kMatte = 1;
kSatin = 2;
kPolished = 3;
kRugged = 4;
kFabric = 5;
}

struct CapabilityMinimaStruct {
int16u caseSessionsPerFabric = 0;
int16u subscriptionsPerFabric = 1;
}

struct ProductAppearanceStruct {
ProductFinishEnum finish = 0;
nullable ColorEnum primaryColor = 1;
}

critical event StartUp = 0 {
INT32U softwareVersion = 0;
}
Expand Down Expand Up @@ -742,6 +780,7 @@ server cluster BasicInformation = 40 {
readonly attribute boolean reachable = 17;
readonly attribute char_string<32> uniqueID = 18;
readonly attribute CapabilityMinimaStruct capabilityMinima = 19;
readonly attribute ProductAppearanceStruct productAppearance = 20;
readonly attribute command_id generatedCommandList[] = 65528;
readonly attribute command_id acceptedCommandList[] = 65529;
readonly attribute event_id eventList[] = 65530;
Expand Down Expand Up @@ -4186,39 +4225,6 @@ server cluster ElectricalMeasurement = 2820 {
readonly attribute int16u clusterRevision = 65533;
}

/** Client Monitoring allows for ensuring that listed clients meet the required monitoring conditions on the server. */
server cluster ClientMonitoring = 4166 {
fabric_scoped struct MonitoringRegistration {
node_id clientNodeId = 1;
int64u ICid = 2;
fabric_idx fabricIndex = 254;
}

readonly attribute int32u idleModeInterval = 0;
readonly attribute int32u activeModeInterval = 1;
readonly attribute int16u activeModeThreshold = 2;
readonly attribute MonitoringRegistration expectedClients[] = 3;
readonly attribute command_id generatedCommandList[] = 65528;
readonly attribute command_id acceptedCommandList[] = 65529;
readonly attribute event_id eventList[] = 65530;
readonly attribute attrib_id attributeList[] = 65531;
readonly attribute bitmap32 featureMap = 65532;
readonly attribute int16u clusterRevision = 65533;

request struct RegisterClientMonitoringRequest {
node_id clientNodeId = 0;
INT64U ICid = 1;
}

request struct UnregisterClientMonitoringRequest {
node_id clientNodeId = 0;
INT64U ICid = 1;
}

command access(invoke: manage) RegisterClientMonitoring(RegisterClientMonitoringRequest): DefaultSuccess = 0;
command access(invoke: manage) UnregisterClientMonitoring(UnregisterClientMonitoringRequest): DefaultSuccess = 1;
}

/** The Test Cluster is meant to validate the generated code */
server cluster UnitTesting = 4294048773 {
enum SimpleEnum : ENUM8 {
Expand Down Expand Up @@ -4644,8 +4650,9 @@ endpoint 0 {
ram attribute reachable default = 1;
callback attribute uniqueID;
callback attribute capabilityMinima;
callback attribute productAppearance;
ram attribute featureMap default = 0;
ram attribute clusterRevision default = 1;
ram attribute clusterRevision default = 2;
}

server cluster OtaSoftwareUpdateRequestor {
Expand Down Expand Up @@ -4911,18 +4918,6 @@ endpoint 0 {
ram attribute clusterRevision default = 3;
}

server cluster ClientMonitoring {
ram attribute idleModeInterval default = 0x12C;
ram attribute activeModeInterval default = 0x12C;
ram attribute activeModeThreshold default = 0xFA0;
callback attribute expectedClients;
callback attribute generatedCommandList;
callback attribute acceptedCommandList;
callback attribute attributeList;
ram attribute featureMap default = 0;
ram attribute clusterRevision default = 1;
}

server cluster FaultInjection {
callback attribute generatedCommandList;
callback attribute acceptedCommandList;
Expand Down
Loading

0 comments on commit 2bb4003

Please sign in to comment.