Skip to content

Commit

Permalink
Merge branch 'master' into feature/unittest-transport-raw-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
feasel0 authored Apr 25, 2024
2 parents 130e766 + 742e65b commit 400d0e5
Show file tree
Hide file tree
Showing 30 changed files with 1,493 additions and 1,738 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ jobs:
build_darwin:
name: Build on Darwin (clang, python_lib, simulated)
runs-on: macos-latest
runs-on: macos-13
if: github.actor != 'restyled-io[bot]'

steps:
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/check-data-model-directory-updates.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# 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.

name: Check for changes to data_model directory without a sha update

on:
pull_request:
paths:
- "data_model/**"

jobs:
check-submodule-update-label:
name: Check for changes to data_model directory without a sha update
runs-on: ubuntu-latest
if: "git diff --name-only HEAD^..HEAD data_model/ | grep -q spec_sha"
steps:
- name: Error Message
run: echo This pull request attempts to update data_model directory, but is missing updates to spec_sha file with the latest version of the sha. Files in the data_model directory are generated automatically and should not be updated manually.
- name: Fail Job
run: exit 1
2 changes: 1 addition & 1 deletion .github/workflows/fuzzing-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:

build_darwin_fuzzing:
name: Build on Darwin
runs-on: macos-latest
runs-on: macos-13
if: github.actor != 'restyled-io[bot]'

steps:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ jobs:
LSAN_OPTIONS: detect_leaks=1 suppressions=scripts/tests/chiptest/lsan-mac-suppressions.txt

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

steps:
- name: Checkout
Expand Down Expand Up @@ -588,7 +588,7 @@ jobs:
TSAN_OPTIONS: "halt_on_error=1"

if: github.actor != 'restyled-io[bot]' && false
runs-on: macos-latest
runs-on: macos-13

steps:
- name: Checkout
Expand Down
13 changes: 7 additions & 6 deletions config/esp32/components/chip/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -726,12 +726,13 @@ menu "CHIP Device Layer"
should not start advertising automatically after power-up.

config USE_BLE_ONLY_FOR_COMMISSIONING
bool "Use BLE only for commissioning"
default y
help
Disable this flag if BLE is used for any other purpose than commissioning.
When enabled, it deinitialized the BLE on successful commissioning, and on
bootup do not initialize the BLE if device is already provisioned with Wi-Fi/Thread credentials.
depends on BT_ENABLED
bool "Use BLE only for commissioning"
default y
help
Disable this flag if BLE is used for any other purpose than commissioning.
When enabled, it deinitialized the BLE on successful commissioning, and on
bootup do not initialize the BLE if device is already provisioned with Wi-Fi/Thread credentials.

endmenu

Expand Down
29 changes: 17 additions & 12 deletions docs/guides/BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,22 +199,27 @@ permanently, you need to make the following changes:
## Installing ZAP tool
`bootstrap.sh` will download a compatible ZAP tool version and set it up in
`$PATH`. If you want to install or use a different version of the tool, you may
download one from the ZAP project's
[Releases](https://github.com/project-chip/zap/releases) page.
For platforms defined in [`scripts/setup/zap.json`](/scripts/setup/zap.json),
`bootstrap.sh` will download a compatible ZAP tool version from CIPD and set it
up in `$PATH`.
### Linux ARM
ZAP releases are copied to CIPD by an automated bot. You can check if a release
was copied by looking at tags created for
[ZAP CIPD Packages](https://chrome-infra-packages.appspot.com/p/fuchsia/third_party/zap)
in various platforms.
Zap does not provide binary releases for arm. Rosetta solves this for Darwin,
however for linux arm you will have to use a local ZAP, generally through
setting `$ZAP_DEVELOPMENT_PATH` (see the section `Which zap to use` below).
### Custom ZAP
If you want to install or use a different version of the tool, you may download
one from the [ZAP releases](https://github.com/project-chip/zap/releases) or
build it from source.
The file `scripts/setup/zap.json` contains the version that CIPD would download,
so you can download a compatible version from the zap project
[Releases](https://github.com/project-chip/zap/releases). To checkout as source
code the corresponding tag should exist in the zap
[repository tags](https://github.com/project-chip/zap/tags) list.
so you can refer to it to find a compatible version. The version is also
maintained at [`scripts/setup/zap.version`](/scripts/setup/zap.version).
To check out as source code, the corresponding tag should exist in the
[ZAP repository tags](https://github.com/project-chip/zap/tags) list.
Example commands:
Expand Down
2 changes: 1 addition & 1 deletion examples/platform/esp32/common/CommonDeviceCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ void CommonDeviceCallbacks::DeviceEventCallback(const ChipDeviceEvent * event, i

case DeviceEventType::kCHIPoBLEConnectionClosed:
ESP_LOGI(TAG, "CHIPoBLE disconnected");
Esp32AppServer::DeInitBLEIfCommissioned();
break;

case DeviceEventType::kDnssdInitialized:
Expand All @@ -67,6 +66,7 @@ void CommonDeviceCallbacks::DeviceEventCallback(const ChipDeviceEvent * event, i

case DeviceEventType::kCommissioningComplete: {
ESP_LOGI(TAG, "Commissioning complete");
Esp32AppServer::DeInitBLEIfCommissioned();
}
break;

Expand Down
45 changes: 5 additions & 40 deletions examples/platform/esp32/common/Esp32AppServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,47 +111,12 @@ static size_t hex_string_to_binary(const char * hex_string, uint8_t * buf, size_

void Esp32AppServer::DeInitBLEIfCommissioned(void)
{
#if CONFIG_BT_ENABLED && CONFIG_USE_BLE_ONLY_FOR_COMMISSIONING
#ifdef CONFIG_USE_BLE_ONLY_FOR_COMMISSIONING
if (chip::Server::GetInstance().GetFabricTable().FabricCount() > 0)
{
esp_err_t err = ESP_OK;

#if CONFIG_BT_NIMBLE_ENABLED
if (!ble_hs_is_enabled())
{
ESP_LOGI(TAG, "BLE already deinited");
return;
}
if (nimble_port_stop() != 0)
{
ESP_LOGE(TAG, "nimble_port_stop() failed");
return;
}
vTaskDelay(100);
nimble_port_deinit();

#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0)
err = esp_nimble_hci_and_controller_deinit();
#endif
#endif /* CONFIG_BT_NIMBLE_ENABLED */

#if CONFIG_IDF_TARGET_ESP32
err |= esp_bt_mem_release(ESP_BT_MODE_BTDM);
#elif CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32H2 || \
CONFIG_IDF_TARGET_ESP32C6
err |= esp_bt_mem_release(ESP_BT_MODE_BLE);
#endif

if (err != ESP_OK)
{
ESP_LOGE(TAG, "BLE deinit failed");
}
else
{
ESP_LOGI(TAG, "BLE deinit successful and memory reclaimed");
}
chip::DeviceLayer::Internal::BLEMgr().Shutdown();
}
#endif /* CONFIG_BT_ENABLED && CONFIG_USE_BLE_ONLY_FOR_COMMISSIONING */
#endif /* CONFIG_USE_BLE_ONLY_FOR_COMMISSIONING */
}

void Esp32AppServer::Init(AppDelegate * sAppDelegate)
Expand All @@ -162,7 +127,7 @@ void Esp32AppServer::Init(AppDelegate * sAppDelegate)
if (hex_string_to_binary(CONFIG_TEST_EVENT_TRIGGER_ENABLE_KEY, sTestEventTriggerEnableKey,
sizeof(sTestEventTriggerEnableKey)) == 0)
{
ESP_LOGE(TAG, "Failed to convert the EnableKey string to octstr type value");
ChipLogError(DeviceLayer, "Failed to convert the EnableKey string to octstr type value");
memset(sTestEventTriggerEnableKey, 0, sizeof(sTestEventTriggerEnableKey));
}
static SimpleTestEventTriggerDelegate sTestEventTriggerDelegate{};
Expand Down Expand Up @@ -190,7 +155,7 @@ void Esp32AppServer::Init(AppDelegate * sAppDelegate)
if (chip::DeviceLayer::ConnectivityMgr().IsThreadProvisioned() &&
(chip::Server::GetInstance().GetFabricTable().FabricCount() != 0))
{
ESP_LOGI(TAG, "Thread has been provisioned, publish the dns service now");
ChipLogProgress(DeviceLayer, "Thread has been provisioned, publish the dns service now");
chip::app::DnssdServer::Instance().StartServer();
}
#endif
Expand Down
1 change: 1 addition & 0 deletions src/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ if (chip_build_tests) {
"${chip_root}/src/credentials/tests",
"${chip_root}/src/lib/format/tests",
"${chip_root}/src/lib/support/tests",
"${chip_root}/src/lib/support/tests:tests_nltest",
"${chip_root}/src/protocols/secure_channel/tests",
"${chip_root}/src/system/tests",
"${chip_root}/src/transport/tests",
Expand Down
5 changes: 1 addition & 4 deletions src/crypto/tests/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@

import("//build_overrides/build.gni")
import("//build_overrides/chip.gni")
import("//build_overrides/nlunit_test.gni")

import("${chip_root}/build/chip/chip_test_suite.gni")
import("${chip_root}/src/crypto/crypto.gni")

chip_test_suite_using_nltest("tests") {
chip_test_suite("tests") {
output_name = "libChipCryptoTests"

sources = [
Expand Down Expand Up @@ -70,8 +69,6 @@ chip_test_suite_using_nltest("tests") {
"${chip_root}/src/crypto",
"${chip_root}/src/lib/core",
"${chip_root}/src/lib/support:testing",
"${chip_root}/src/lib/support:testing_nlunit",
"${chip_root}/src/platform",
"${nlunit_test_root}:nlunit-test",
]
}
Loading

0 comments on commit 400d0e5

Please sign in to comment.