Skip to content

Commit

Permalink
Merge branch 'master' into duyen-tran/opstate-add-checks-for-pics
Browse files Browse the repository at this point in the history
  • Loading branch information
duyen-tran authored Aug 10, 2023
2 parents 6afde17 + 570eb83 commit 2563ee4
Show file tree
Hide file tree
Showing 38 changed files with 553 additions and 74 deletions.
7 changes: 6 additions & 1 deletion .github/actions/bootstrap/action.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
name: Bootstrap
description: Bootstrap
inputs:
platform:
description: "Platform name"
required: false
default: none
runs:
using: "composite"
steps:
- name: Bootstrap
shell: bash
run: bash scripts/bootstrap.sh
run: bash scripts/bootstrap.sh -p all,${{ inputs.platform }}
2 changes: 2 additions & 0 deletions .github/actions/checkout-submodules-and-bootstrap/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ runs:
uses: ./.github/actions/bootstrap-cache
- name: Bootstrap
uses: ./.github/actions/bootstrap
with:
platform: ${{ inputs.platform }}
- name: Upload Bootstrap Logs
uses: ./.github/actions/upload-bootstrap-logs
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ jobs:
- name: Build Python REPL and example apps
run: |
scripts/run_in_build_env.sh './scripts/build_python.sh --install_virtual_env out/venv --extra_packages "mobly"'
scripts/run_in_build_env.sh './scripts/build_python.sh --install_virtual_env out/venv'
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py \
--target linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test \
Expand Down
168 changes: 166 additions & 2 deletions examples/all-clusters-app/all-clusters-common/src/smco-stub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,173 @@
* limitations under the License.
*/

#include <lib/core/DataModelTypes.h>
#include <app/clusters/smoke-co-alarm-server/SmokeCOTestEventTriggerDelegate.h>
#include <app/clusters/smoke-co-alarm-server/smoke-co-alarm-server.h>

bool emberAfPluginSmokeCoAlarmSelfTestRequestCommand(chip::EndpointId endpointId)
#include <platform/CHIPDeviceLayer.h>

using namespace chip;
using namespace chip::app::Clusters::SmokeCoAlarm;
using namespace chip::DeviceLayer;

namespace {

constexpr const uint16_t kSelfTestingTimeoutSec = 10;

} // namespace

static std::array<ExpressedStateEnum, SmokeCoAlarmServer::kPriorityOrderLength> sPriorityOrder = {
ExpressedStateEnum::kSmokeAlarm, ExpressedStateEnum::kInterconnectSmoke, ExpressedStateEnum::kCOAlarm,
ExpressedStateEnum::kInterconnectCO, ExpressedStateEnum::kHardwareFault, ExpressedStateEnum::kTesting,
ExpressedStateEnum::kEndOfService, ExpressedStateEnum::kBatteryAlert
};

void EndSelfTestingEventHandler(System::Layer * systemLayer, void * appState)
{
SmokeCoAlarmServer::Instance().SetTestInProgress(1, false);
SmokeCoAlarmServer::Instance().SetExpressedStateByPriority(1, sPriorityOrder);

ChipLogProgress(Support, "[Smoke-CO-Alarm] => Self test complete");
}

bool emberAfPluginSmokeCoAlarmSelfTestRequestCommand(EndpointId endpointId)
{
SmokeCoAlarmServer::Instance().SetTestInProgress(1, true);

ChipLogProgress(Support, "[Smoke-CO-Alarm] => Self test running");

DeviceLayer::SystemLayer().StartTimer(System::Clock::Seconds32(kSelfTestingTimeoutSec), EndSelfTestingEventHandler, nullptr);

return true;
}

bool HandleSmokeCOTestEventTrigger(uint64_t eventTrigger)
{
SmokeCOTrigger trigger = static_cast<SmokeCOTrigger>(eventTrigger);

switch (trigger)
{
case SmokeCOTrigger::kForceSmokeCritical:
ChipLogProgress(Support, "[Smoke-CO-Alarm-Test-Event] => Force smoke (critical)");
VerifyOrReturnValue(SmokeCoAlarmServer::Instance().SetSmokeState(1, AlarmStateEnum::kCritical), true);
SmokeCoAlarmServer::Instance().SetExpressedStateByPriority(1, sPriorityOrder);
break;
case SmokeCOTrigger::kForceSmokeWarning:
ChipLogProgress(Support, "[Smoke-CO-Alarm-Test-Event] => Force smoke (warning)");
VerifyOrReturnValue(SmokeCoAlarmServer::Instance().SetSmokeState(1, AlarmStateEnum::kWarning), true);
SmokeCoAlarmServer::Instance().SetExpressedStateByPriority(1, sPriorityOrder);
break;
case SmokeCOTrigger::kForceSmokeInterconnect:
ChipLogProgress(Support, "[Smoke-CO-Alarm-Test-Event] => Force smoke interconnect (warning)");
VerifyOrReturnValue(SmokeCoAlarmServer::Instance().SetInterconnectSmokeAlarm(1, AlarmStateEnum::kWarning), true);
SmokeCoAlarmServer::Instance().SetExpressedStateByPriority(1, sPriorityOrder);
break;
case SmokeCOTrigger::kForceCOCritical:
ChipLogProgress(Support, "[Smoke-CO-Alarm-Test-Event] => Force CO (critical)");
VerifyOrReturnValue(SmokeCoAlarmServer::Instance().SetCOState(1, AlarmStateEnum::kCritical), true);
SmokeCoAlarmServer::Instance().SetExpressedStateByPriority(1, sPriorityOrder);
break;
case SmokeCOTrigger::kForceCOWarning:
ChipLogProgress(Support, "[Smoke-CO-Alarm-Test-Event] => Force CO (warning)");
VerifyOrReturnValue(SmokeCoAlarmServer::Instance().SetCOState(1, AlarmStateEnum::kWarning), true);
SmokeCoAlarmServer::Instance().SetExpressedStateByPriority(1, sPriorityOrder);
break;
case SmokeCOTrigger::kForceCOInterconnect:
ChipLogProgress(Support, "[Smoke-CO-Alarm-Test-Event] => Force CO (warning)");
VerifyOrReturnValue(SmokeCoAlarmServer::Instance().SetInterconnectCOAlarm(1, AlarmStateEnum::kWarning), true);
SmokeCoAlarmServer::Instance().SetExpressedStateByPriority(1, sPriorityOrder);
break;
case SmokeCOTrigger::kForceSmokeContaminationHigh:
ChipLogProgress(Support, "[Smoke-CO-Alarm-Test-Event] => Force smoke contamination (critical)");
SmokeCoAlarmServer::Instance().SetContaminationState(1, ContaminationStateEnum::kCritical);
break;
case SmokeCOTrigger::kForceSmokeContaminationLow:
ChipLogProgress(Support, "[Smoke-CO-Alarm-Test-Event] => Force smoke contamination (warning)");
SmokeCoAlarmServer::Instance().SetContaminationState(1, ContaminationStateEnum::kLow);
break;
case SmokeCOTrigger::kForceSmokeSensitivityHigh:
ChipLogProgress(Support, "[Smoke-CO-Alarm-Test-Event] => Force smoke sensistivity (high)");
SmokeCoAlarmServer::Instance().SetSmokeSensitivityLevel(1, SensitivityEnum::kHigh);
break;
case SmokeCOTrigger::kForceSmokeSensitivityLow:
ChipLogProgress(Support, "[Smoke-CO-Alarm-Test-Event] => Force smoke sensitivity (low)");
SmokeCoAlarmServer::Instance().SetSmokeSensitivityLevel(1, SensitivityEnum::kLow);
break;
case SmokeCOTrigger::kForceMalfunction:
ChipLogProgress(Support, "[Smoke-CO-Alarm-Test-Event] => Force malfunction");
VerifyOrReturnValue(SmokeCoAlarmServer::Instance().SetHardwareFaultAlert(1, true), true);
SmokeCoAlarmServer::Instance().SetExpressedStateByPriority(1, sPriorityOrder);
break;
case SmokeCOTrigger::kForceLowBatteryWarning:
ChipLogProgress(Support, "[Smoke-CO-Alarm-Test-Event] => Force low battery (warning)");
VerifyOrReturnValue(SmokeCoAlarmServer::Instance().SetBatteryAlert(1, AlarmStateEnum::kWarning), true);
SmokeCoAlarmServer::Instance().SetExpressedStateByPriority(1, sPriorityOrder);
break;
case SmokeCOTrigger::kForceLowBatteryCritical:
ChipLogProgress(Support, "[Smoke-CO-Alarm-Test-Event] => Force low battery (critical)");
VerifyOrReturnValue(SmokeCoAlarmServer::Instance().SetBatteryAlert(1, AlarmStateEnum::kCritical), true);
SmokeCoAlarmServer::Instance().SetExpressedStateByPriority(1, sPriorityOrder);
break;
case SmokeCOTrigger::kForceEndOfLife:
ChipLogProgress(Support, "[Smoke-CO-Alarm-Test-Event] => Force end-of-life");
VerifyOrReturnValue(SmokeCoAlarmServer::Instance().SetEndOfServiceAlert(1, EndOfServiceEnum::kExpired), true);
SmokeCoAlarmServer::Instance().SetExpressedStateByPriority(1, sPriorityOrder);
break;
case SmokeCOTrigger::kForceSilence:
ChipLogProgress(Support, "[Smoke-CO-Alarm-Test-Event] => Force silence");
SmokeCoAlarmServer::Instance().SetDeviceMuted(1, MuteStateEnum::kMuted);
break;
case SmokeCOTrigger::kClearSmoke:
ChipLogProgress(Support, "[Smoke-CO-Alarm-Test-Event] => Clear smoke");
VerifyOrReturnValue(SmokeCoAlarmServer::Instance().SetSmokeState(1, AlarmStateEnum::kNormal), true);
SmokeCoAlarmServer::Instance().SetExpressedStateByPriority(1, sPriorityOrder);
break;
case SmokeCOTrigger::kClearCO:
ChipLogProgress(Support, "[Smoke-CO-Alarm-Test-Event] => Clear CO");
VerifyOrReturnValue(SmokeCoAlarmServer::Instance().SetCOState(1, AlarmStateEnum::kNormal), true);
SmokeCoAlarmServer::Instance().SetExpressedStateByPriority(1, sPriorityOrder);
break;
case SmokeCOTrigger::kClearSmokeInterconnect:
ChipLogProgress(Support, "[Smoke-CO-Alarm-Test-Event] => Clear smoke interconnect");
VerifyOrReturnValue(SmokeCoAlarmServer::Instance().SetInterconnectSmokeAlarm(1, AlarmStateEnum::kNormal), true);
SmokeCoAlarmServer::Instance().SetExpressedStateByPriority(1, sPriorityOrder);
break;
case SmokeCOTrigger::kClearCOInterconnect:
ChipLogProgress(Support, "[Smoke-CO-Alarm-Test-Event] => Clear CO interconnect");
VerifyOrReturnValue(SmokeCoAlarmServer::Instance().SetInterconnectCOAlarm(1, AlarmStateEnum::kNormal), true);
SmokeCoAlarmServer::Instance().SetExpressedStateByPriority(1, sPriorityOrder);
break;
case SmokeCOTrigger::kClearMalfunction:
ChipLogProgress(Support, "[Smoke-CO-Alarm-Test-Event] => Clear malfunction");
VerifyOrReturnValue(SmokeCoAlarmServer::Instance().SetHardwareFaultAlert(1, false), true);
SmokeCoAlarmServer::Instance().SetExpressedStateByPriority(1, sPriorityOrder);
break;
case SmokeCOTrigger::kClearEndOfLife:
ChipLogProgress(Support, "[Smoke-CO-Alarm-Test-Event] => Clear end-of-life");
VerifyOrReturnValue(SmokeCoAlarmServer::Instance().SetEndOfServiceAlert(1, EndOfServiceEnum::kNormal), true);
SmokeCoAlarmServer::Instance().SetExpressedStateByPriority(1, sPriorityOrder);
break;
case SmokeCOTrigger::kClearSilence:
ChipLogProgress(Support, "[Smoke-CO-Alarm-Test-Event] => Clear silence");
SmokeCoAlarmServer::Instance().SetDeviceMuted(1, MuteStateEnum::kNotMuted);
break;
case SmokeCOTrigger::kClearBatteryLevelLow:
ChipLogProgress(Support, "[Smoke-CO-Alarm-Test-Event] => Clear low battery");
VerifyOrReturnValue(SmokeCoAlarmServer::Instance().SetBatteryAlert(1, AlarmStateEnum::kNormal), true);
SmokeCoAlarmServer::Instance().SetExpressedStateByPriority(1, sPriorityOrder);
break;
case SmokeCOTrigger::kClearContamination:
ChipLogProgress(Support, "[Smoke-CO-Alarm-Test-Event] => Force SmokeContamination (warning)");
SmokeCoAlarmServer::Instance().SetContaminationState(1, ContaminationStateEnum::kNormal);
break;
case SmokeCOTrigger::kClearSensitivity:
ChipLogProgress(Support, "[Smoke-CO-Alarm-Test-Event] => Clear Smoke Sensitivity");
SmokeCoAlarmServer::Instance().SetSmokeSensitivityLevel(1, SensitivityEnum::kStandard);
break;
default:

return false;
}

return true;
}
1 change: 1 addition & 0 deletions examples/all-clusters-app/linux/args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ chip_project_config_include_dirs += [ "${chip_root}/config/standalone" ]
matter_enable_tracing_support = true
matter_log_json_payload_decode_full = true
matter_log_json_payload_hex = true
chip_enable_smoke_co_trigger = true
1 change: 1 addition & 0 deletions examples/all-clusters-app/tizen/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ source_set("chip-all-clusters-common") {

deps = [
"${chip_root}/examples/all-clusters-app/all-clusters-common",
"${chip_root}/examples/platform/tizen:app-main",
"${chip_root}/src/lib/shell:shell_core",
]

Expand Down
1 change: 1 addition & 0 deletions examples/all-clusters-minimal-app/tizen/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ source_set("chip-all-clusters-common") {

deps = [
"${chip_root}/examples/all-clusters-minimal-app/all-clusters-common",
"${chip_root}/examples/platform/tizen:app-main",
"${chip_root}/src/lib/shell:shell_core",
]

Expand Down
9 changes: 9 additions & 0 deletions examples/platform/linux/AppMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@
#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR
#include <app/clusters/ota-requestor/OTATestEventTriggerDelegate.h>
#endif
#if CHIP_DEVICE_CONFIG_ENABLE_SMOKE_CO_TRIGGER
#include <app/clusters/smoke-co-alarm-server/SmokeCOTestEventTriggerDelegate.h>
#endif
#include <app/TestEventTriggerDelegate.h>

#include <signal.h>
Expand Down Expand Up @@ -522,6 +525,12 @@ void ChipLinuxAppMainLoop(AppMainLoopImplementation * impl)
static OTATestEventTriggerDelegate otaTestEventTriggerDelegate{ ByteSpan(
LinuxDeviceOptions::GetInstance().testEventTriggerEnableKey) };
otherDelegate = &otaTestEventTriggerDelegate;
#endif
#if CHIP_DEVICE_CONFIG_ENABLE_SMOKE_CO_TRIGGER
static SmokeCOTestEventTriggerDelegate smokeCOTestEventTriggerDelegate{
ByteSpan(LinuxDeviceOptions::GetInstance().testEventTriggerEnableKey), otherDelegate
};
otherDelegate = &smokeCOTestEventTriggerDelegate;
#endif
// For general testing of TestEventTrigger, we have a common "core" event trigger delegate.
static SampleTestEventTriggerDelegate testEventTriggerDelegate;
Expand Down
13 changes: 13 additions & 0 deletions examples/platform/linux/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ import("${chip_root}/src/lib/core/core.gni")
import("${chip_root}/src/lib/lib.gni")
import("${chip_root}/src/tracing/tracing_args.gni")

declare_args() {
chip_enable_smoke_co_trigger = false
}

config("app-main-config") {
include_dirs = [ "." ]
}
Expand All @@ -29,6 +33,10 @@ source_set("ota-test-event-trigger") {
]
}

source_set("smco-test-event-trigger") {
sources = [ "${chip_root}/src/app/clusters/smoke-co-alarm-server/SmokeCOTestEventTriggerDelegate.h" ]
}

source_set("app-main") {
defines = [ "ENABLE_TRACING=${matter_enable_tracing_support}" ]
sources = [
Expand All @@ -51,6 +59,7 @@ source_set("app-main") {
]

public_deps = [
":smco-test-event-trigger",
"${chip_root}/src/lib",
"${chip_root}/src/platform/logging:force_stdio",
]
Expand Down Expand Up @@ -85,6 +94,10 @@ source_set("app-main") {
]
}

if (chip_enable_smoke_co_trigger) {
defines += [ "CHIP_DEVICE_CONFIG_ENABLE_SMOKE_CO_TRIGGER=1" ]
}

public_configs = [ ":app-main-config" ]
}

Expand Down
12 changes: 10 additions & 2 deletions examples/platform/telink/common/src/AppTaskCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ class AppFabricTableDelegate : public FabricTable::Delegate
{
if (chip::Server::GetInstance().GetFabricTable().FabricCount() == 0)
{
bool isCommissioningFailed = chip::Server::GetInstance().GetCommissioningWindowManager().IsCommissioningWindowOpen();
ChipLogProgress(DeviceLayer, "Performing erasing of settings partition");

#ifdef CONFIG_CHIP_FACTORY_RESET_ERASE_NVS
Expand All @@ -168,9 +169,12 @@ class AppFabricTableDelegate : public FabricTable::Delegate
status = nvs_clear(static_cast<nvs_fs *>(storage));
}

if (!status)
if (!isCommissioningFailed)
{
status = nvs_mount(static_cast<nvs_fs *>(storage));
if (!status)
{
status = nvs_mount(static_cast<nvs_fs *>(storage));
}
}

if (status)
Expand All @@ -187,6 +191,10 @@ class AppFabricTableDelegate : public FabricTable::Delegate

ConnectivityMgr().ErasePersistentInfo();
#endif
if (isCommissioningFailed)
{
PlatformMgr().Shutdown();
}
}
}
};
Expand Down
2 changes: 1 addition & 1 deletion integrations/docker/images/base/chip-build/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6 : Add support for K32W1 SDK
7 : Fix TI sysconfig root in vscode image
10 changes: 8 additions & 2 deletions integrations/docker/images/chip-cert-bins/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM ubuntu:22.04 as chip-build-cert
LABEL org.opencontainers.image.source https://github.com/project-chip/connectedhomeip
ARG TARGETPLATFORM
# COMMITHASH defines the target commit to build from. May be passed in using --build-arg.
ARG COMMITHASH=7b99e6399c6069037c613782d78132c69b9dcabb
ARG COMMITHASH=c1ec2d777456924dcaa59b53351b00d73caf378f

# Ensure TARGETPLATFORM is set
RUN case ${TARGETPLATFORM} in \
Expand Down Expand Up @@ -268,5 +268,11 @@ COPY --from=chip-build-cert-bins /root/connectedhomeip/out/chip-app1 chip-app1
# Stage 3.1 Setup the Matter Python environment
COPY --from=chip-build-cert-bins /root/connectedhomeip/out/python_lib python_lib
COPY --from=chip-build-cert-bins /root/connectedhomeip/src/python_testing python_testing
RUN pip install click websockets lark diskcache

COPY --from=chip-build-cert-bins /root/connectedhomeip/scripts/tests/requirements.txt /tmp/requirements.txt
RUN pip install -r /tmp/requirements.txt && rm /tmp/requirements.txt

COPY --from=chip-build-cert-bins /root/connectedhomeip/src/python_testing/requirements.txt /tmp/requirements.txt
RUN pip install -r /tmp/requirements.txt && rm /tmp/requirements.txt

RUN pip install --no-cache-dir python_lib/controller/python/chip*.whl
4 changes: 2 additions & 2 deletions integrations/docker/images/stage-2/chip-build-k32w/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ RUN set -x \
&& : # last line

RUN set -x \
&& mkdir -p k32w1
&& mkdir -p k32w1 \
&& wget https://cache.nxp.com/lgfiles/bsps/SDK_2_12_5_K32W148-EVK.zip \
&& unzip SDK_2_12_5_K32W148-EVK.zip -d k32w1 \
&& rm -rf SDK_2_12_5_K32W148-EVK.zip \
&& rm -rf SDK_2_12_5_K32W148-EVK.zip

FROM ghcr.io/project-chip/chip-build:${VERSION}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ ENV QEMU_ESP32_DIR=/opt/espressif/qemu
ENV SYSROOT_AARCH64=/opt/ubuntu-22.04.1-aarch64-sysroot
ENV TELINK_ZEPHYR_BASE=/opt/telink/zephyrproject/zephyr
ENV TELINK_ZEPHYR_SDK_DIR=/opt/telink/zephyr-sdk-0.16.1
ENV TI_SYSCONFIG_ROOT=/opt/ti/sysconfig_1.13.0
ENV TI_SYSCONFIG_ROOT=/opt/ti/sysconfig_1.15.0
ENV ZEPHYR_BASE=/opt/NordicSemiconductor/nrfconnect/zephyr
ENV ZEPHYR_SDK_INSTALL_DIR=/opt/NordicSemiconductor/nRF5_tools/zephyr-sdk-0.16.0
ENV ZEPHYR_TOOLCHAIN_VARIANT=gnuarmemb
Expand Down
6 changes: 4 additions & 2 deletions scripts/build_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ Input Options:
<path> represents where the virtual environment is to be created.
-c, --clean_virtual_env <yes|no> When installing a virtual environment, create/clean it first.
Defaults to yes.
--include_pytest_deps <yes|no> Install requirements.python_tests.txt.
--include_pytest_deps <yes|no> Install requirements.txt for running scripts/tests and
src/python_testing scripts.
Defaults to yes.
--extra_packages PACKAGES Install extra Python packages from PyPI
--include_yamltests Whether to install the matter_yamltests wheel.
Expand Down Expand Up @@ -214,7 +215,8 @@ if [ -n "$install_virtual_env" ]; then

if [ "$install_pytest_requirements" = "yes" ]; then
echo_blue "Installing python test dependencies ..."
"$ENVIRONMENT_ROOT"/bin/pip install -r "$CHIP_ROOT/scripts/setup/requirements.python_tests.txt"
"$ENVIRONMENT_ROOT"/bin/pip install -r "$CHIP_ROOT/scripts/tests/requirements.txt"
"$ENVIRONMENT_ROOT"/bin/pip install -r "$CHIP_ROOT/src/python_testing/requirements.txt"
fi

echo ""
Expand Down
Loading

0 comments on commit 2563ee4

Please sign in to comment.