Skip to content

Commit

Permalink
Merge branch 'master' into improve_doxygen
Browse files Browse the repository at this point in the history
  • Loading branch information
woody-apple authored Nov 30, 2021
2 parents f18a42b + 677d87e commit ebfa8c5
Show file tree
Hide file tree
Showing 272 changed files with 13,738 additions and 23,576 deletions.
5 changes: 5 additions & 0 deletions .github/.wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ armeabi
ARMmbed
armv
asdk
AssertionError
ASYNC
att
attId
Expand Down Expand Up @@ -387,6 +388,7 @@ FOTA
FreeRTOS
FreeRTOSConfig
fsl
fstab
fsync
fullclean
gcloud
Expand Down Expand Up @@ -768,6 +770,7 @@ PyFunction
pylint
PyObject
PyRun
pytest
QEMU
Qorvo
QPG
Expand All @@ -781,6 +784,7 @@ qvCHIP
RADVD
raspberryPi
RasPi
rAv
RCP
ReadConfigValue
readelf
Expand Down Expand Up @@ -866,6 +870,7 @@ SLAAC
SLTB
SLWSTK
SmartThings
smoketest
SMP
socat
socio
Expand Down
11 changes: 9 additions & 2 deletions .github/workflows/examples-infineon.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ concurrency:
jobs:
infineon:
name: Infineon examples building
timeout-minutes: 30
timeout-minutes: 60

runs-on: ubuntu-latest
if: github.actor != 'restyled-io[bot]'
Expand Down Expand Up @@ -72,7 +72,14 @@ jobs:
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
p6 default all-clusters-app \
out/infineon-p6-all-clusters/chip-p6-clusters-example.out
- name: Build lighting-app example
timeout-minutes: 10
run: |
scripts/run_in_build_env.sh \
"scripts/build/build_examples.py --no-log-timestamps --target 'infineon-p6-light' build"
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
p6 default light-app \
out/infineon-p6-light/chip-p6-lighting-example.out
- name: Uploading Size Reports
uses: actions/upload-artifact@v2
if: ${{ !env.ACT }}
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,14 @@ jobs:

strategy:
matrix:
type: [tsan]
type: [tsan, asan]
eventloop: [eventloop_same, eventloop_separate]
env:
USE_SEPARATE_EVENTLOOP: ${{ matrix.eventloop == 'eventloop_separate' }}
USE_TSAN: ${{ matrix.type == 'tsan' }}

USE_ASAN: ${{ matrix.type == 'asan' }}

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

Expand Down Expand Up @@ -159,11 +161,11 @@ jobs:
- name: Run Build Test Server
timeout-minutes: 10
run: |
scripts/examples/gn_build_example.sh examples/all-clusters-app/linux out/debug/standalone/ chip_config_network_layer_ble=false is_tsan=${USE_TSAN}
scripts/examples/gn_build_example.sh examples/all-clusters-app/linux out/debug/standalone/ chip_config_network_layer_ble=false is_tsan=${USE_TSAN} is_asan=${USE_ASAN}
- name: Build chip-tool
timeout-minutes: 10
run: |
scripts/examples/gn_build_example.sh examples/chip-tool out/debug/standalone/ is_tsan=${USE_TSAN} config_use_separate_eventloop=${USE_SEPARATE_EVENTLOOP}
scripts/examples/gn_build_example.sh examples/chip-tool out/debug/standalone/ is_tsan=${USE_TSAN} is_asan=${USE_ASAN} config_use_separate_eventloop=${USE_SEPARATE_EVENTLOOP}
- name: Copy objdir
run: |
# The idea is to not upload our objdir unless builds have
Expand Down
8 changes: 4 additions & 4 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@
"name": "Debug Mbed unit tests",
"type": "cortex-debug",
"request": "launch",
"cwd": "${workspaceRoot}/src/test_driver/mbed",
"cwd": "${workspaceRoot}/src/test_driver/mbed/unit_tests",
"executable": "./build-${input:mbedTarget}/${input:mbedDebugProfile}/chip-mbed-unit-tests.elf",
"armToolchainPath": "${env:PW_ENVIRONMENT_ROOT}/cipd/pigweed/bin/", // Pigweed environment bootstraping required
"servertype": "openocd",
Expand Down Expand Up @@ -225,7 +225,7 @@
"name": "Debug Mbed unit tests [remote]",
"type": "cortex-debug",
"request": "launch",
"cwd": "${workspaceRoot}/src/test_driver/mbed",
"cwd": "${workspaceRoot}/src/test_driver/mbed/unit_tests",
"executable": "./build-${input:mbedTarget}/${input:mbedDebugProfile}/chip-mbed-unit-tests.elf",
"armToolchainPath": "${env:PW_ENVIRONMENT_ROOT}/cipd/pigweed/bin/", // Pigweed environment bootstraping required
"servertype": "external",
Expand All @@ -252,7 +252,7 @@
"name": "Flash Mbed unit tests",
"type": "cortex-debug",
"request": "launch",
"cwd": "${workspaceRoot}/src/test_driver/mbed",
"cwd": "${workspaceRoot}/src/test_driver/mbed//unit_tests",
"executable": "./build-${input:mbedTarget}/${input:mbedFlashProfile}/chip-mbed-unit-tests.elf",
"armToolchainPath": "${env:PW_ENVIRONMENT_ROOT}/cipd/pigweed/bin/", // Pigweed environment bootstraping required
"servertype": "openocd",
Expand All @@ -277,7 +277,7 @@
"name": "Flash Mbed unit tests [remote]",
"type": "cortex-debug",
"request": "launch",
"cwd": "${workspaceRoot}/src/test_driver/mbed",
"cwd": "${workspaceRoot}/src/test_driver/mbed/unit_tests",
"executable": "./build-${input:mbedTarget}/${input:mbedFlashProfile}/chip-mbed-unit-tests.elf",
"armToolchainPath": "${env:PW_ENVIRONMENT_ROOT}/cipd/pigweed/bin/", // Pigweed environment bootstraping required
"servertype": "external",
Expand Down
3 changes: 2 additions & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
"base": "$gcc",
"fileLocation": [
"relative",
"${workspaceFolder}/src/test_driver/mbed/build"
"${workspaceFolder}/src/test_driver/mbed/unit_tests/build"
]
}
}
Expand Down Expand Up @@ -246,6 +246,7 @@
"esp32-m5stack-all-clusters-rpc-ipv6only",
"infineon-p6-all-clusters",
"infineon-p6-lock",
"infineon-p6-light",
"linux-arm64-all-clusters",
"linux-arm64-all-clusters-ipv6only",
"linux-arm64-chip-tool",
Expand Down
3 changes: 3 additions & 0 deletions build/toolchain/flashable_executable.gni
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ template("gen_flashing_script") {
[
"flashing_script_generator",
"flashing_script_name",
"flashing_script_inputs",
"flashing_options",
"deps",
"data_deps",
Expand All @@ -72,6 +73,7 @@ template("gen_flashing_script") {
]

script = flashing_script_generator
inputs = flashing_script_inputs
}
}

Expand Down Expand Up @@ -131,6 +133,7 @@ template("flashable_executable") {

gen_flashing_script("$target_name.flashing") {
flashing_script_generator = invoker.flashing_script_generator
flashing_script_inputs = invoker.flashing_script_inputs
flashing_script_name = "$root_out_dir/${invoker.flashing_script_name}"
if (defined(invoker.flashing_options)) {
flashing_options = invoker.flashing_options
Expand Down
13 changes: 7 additions & 6 deletions examples/all-clusters-app/ameba/main/chipinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ std::string createSetupPayload()
ChipLogError(DeviceLayer, "Couldn't get discriminator: %s\r\n", ErrorStr(err));
return result;
}
ChipLogProgress(DeviceLayer, "Setup discriminator: %u (0x%x)\r\n", discriminator, discriminator);
ChipLogProgress(DeviceLayer, "Setup discriminator: %d (0x%x)\r\n", discriminator, discriminator);

uint32_t setupPINCode;
err = ConfigurationMgr().GetSetupPinCode(setupPINCode);
Expand All @@ -107,7 +107,7 @@ std::string createSetupPayload()
ChipLogError(DeviceLayer, "Couldn't get setupPINCode: %s\r\n", ErrorStr(err));
return result;
}
ChipLogProgress(DeviceLayer, "Setup PIN code: %u (0x%x)\r\n", setupPINCode, setupPINCode);
ChipLogProgress(DeviceLayer, "Setup PIN code: %lu (0x%lx)\r\n", setupPINCode, setupPINCode);

uint16_t vendorId;
err = ConfigurationMgr().GetVendorId(vendorId);
Expand Down Expand Up @@ -180,7 +180,7 @@ std::string createSetupPayload()

if (err != CHIP_NO_ERROR)
{
ChipLogError(DeviceLayer, "Couldn't get payload string %\r\n" CHIP_ERROR_FORMAT, err.Format());
ChipLogError(DeviceLayer, "Couldn't get payload string %lu\r\n" CHIP_ERROR_FORMAT, err.Format());
}
return result;
};
Expand Down Expand Up @@ -209,10 +209,11 @@ extern "C" void ChipTest(void)
// Initialize device attestation config
SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider());

std::string qrCodeText = createSetupPayload();
ChipLogProgress(DeviceLayer, "QR CODE Text: '%s'\r\n", qrCodeText.c_str());

if (RTW_SUCCESS != wifi_is_connected_to_ap())
{
std::string qrCodeText = createSetupPayload();
ChipLogProgress(DeviceLayer, "QR CODE Text: '%s'\r\n", qrCodeText.c_str());

std::vector<char> qrCode(3 * qrCodeText.size() + 1);
err = EncodeQRCodeToUrl(qrCodeText.c_str(), qrCodeText.size(), qrCode.data(), qrCode.max_size());
if (err == CHIP_NO_ERROR)
Expand Down
9 changes: 8 additions & 1 deletion examples/all-clusters-app/p6/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,14 @@ int main(void)
// Init Chip memory management before the stack
chip::Platform::MemoryInit();

CHIP_ERROR ret = PlatformMgr().InitChipStack();
CHIP_ERROR ret = chip::DeviceLayer::PersistedStorage::KeyValueStoreMgrImpl().Init();
if (ret != CHIP_NO_ERROR)
{
P6_LOG("PersistedStorage::KeyValueStoreMgrImpl().Init() failed");
appError(ret);
}

ret = PlatformMgr().InitChipStack();
if (ret != CHIP_NO_ERROR)
{
P6_LOG("PlatformMgr().InitChipStack() failed");
Expand Down
2 changes: 1 addition & 1 deletion examples/chip-tool/commands/clusters/ModelCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
class ModelCommand : public CHIPCommand
{
public:
using ChipDevice = ::chip::DeviceProxy;
using ChipDevice = ::chip::OperationalDeviceProxy;

ModelCommand(const char * commandName) :
CHIPCommand(commandName), mOnDeviceConnectedCallback(OnDeviceConnectedFn, this),
Expand Down
2 changes: 1 addition & 1 deletion examples/chip-tool/commands/pairing/PairingCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ CHIP_ERROR PairingCommand::RunInternal(NodeId remoteId)
return err;
}

void PairingCommand::OnDeviceConnectedFn(void * context, chip::DeviceProxy * device)
void PairingCommand::OnDeviceConnectedFn(void * context, chip::OperationalDeviceProxy * device)
{
PairingCommand * command = reinterpret_cast<PairingCommand *>(context);
command->OpenCommissioningWindow();
Expand Down
2 changes: 1 addition & 1 deletion examples/chip-tool/commands/pairing/PairingCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ class PairingCommand : public CHIPCommand,
chip::Controller::NetworkCommissioningCluster mCluster;
chip::EndpointId mEndpointId = 0;

static void OnDeviceConnectedFn(void * context, chip::DeviceProxy * device);
static void OnDeviceConnectedFn(void * context, chip::OperationalDeviceProxy * device);
static void OnDeviceConnectionFailureFn(void * context, NodeId deviceId, CHIP_ERROR error);
static void OnOpenCommissioningWindowResponse(void * context, NodeId deviceId, CHIP_ERROR status, chip::SetupPayload payload);

Expand Down
2 changes: 1 addition & 1 deletion examples/chip-tool/commands/reporting/ReportingCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ CHIP_ERROR ReportingCommand::RunCommand()
return err;
}

void ReportingCommand::OnDeviceConnectedFn(void * context, chip::DeviceProxy * device)
void ReportingCommand::OnDeviceConnectedFn(void * context, chip::OperationalDeviceProxy * device)
{
ReportingCommand * command = reinterpret_cast<ReportingCommand *>(context);
VerifyOrReturn(command != nullptr,
Expand Down
2 changes: 1 addition & 1 deletion examples/chip-tool/commands/reporting/ReportingCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class ReportingCommand : public CHIPCommand
NodeId mNodeId;
uint8_t mEndPointId;

static void OnDeviceConnectedFn(void * context, chip::DeviceProxy * device);
static void OnDeviceConnectedFn(void * context, chip::OperationalDeviceProxy * device);
static void OnDeviceConnectionFailureFn(void * context, NodeId deviceId, CHIP_ERROR error);

chip::Callback::Callback<chip::OnDeviceConnected> mOnDeviceConnectedCallback;
Expand Down
2 changes: 1 addition & 1 deletion examples/chip-tool/commands/tests/TestCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ CHIP_ERROR TestCommand::RunCommand()
return mController.GetConnectedDevice(mNodeId, &mOnDeviceConnectedCallback, &mOnDeviceConnectionFailureCallback);
}

void TestCommand::OnDeviceConnectedFn(void * context, chip::DeviceProxy * device)
void TestCommand::OnDeviceConnectedFn(void * context, chip::OperationalDeviceProxy * device)
{
ChipLogProgress(chipTool, " **** Test Setup: Device Connected\n");
auto * command = static_cast<TestCommand *>(context);
Expand Down
13 changes: 11 additions & 2 deletions examples/chip-tool/commands/tests/TestCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
#include <type_traits>
#include <zap-generated/tests/CHIPClustersTest.h>

constexpr uint16_t kTimeoutInSeconds = 30;

class TestCommand : public CHIPCommand
{
public:
Expand All @@ -39,26 +41,32 @@ class TestCommand : public CHIPCommand
{
AddArgument("node-id", 0, UINT64_MAX, &mNodeId);
AddArgument("delayInMs", 0, UINT64_MAX, &mDelayInMs);
AddArgument("timeout", 0, UINT16_MAX, &mTimeout);
AddArgument("endpoint-id", CHIP_ZCL_ENDPOINT_MIN, CHIP_ZCL_ENDPOINT_MAX, &mEndpointId);
AddArgument("PICS", &mPICSFilePath);
}

/////////// CHIPCommand Interface /////////
CHIP_ERROR RunCommand() override;
chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(30); }
chip::System::Clock::Timeout GetWaitDuration() const override
{
return chip::System::Clock::Seconds16(mTimeout.HasValue() ? mTimeout.Value() : kTimeoutInSeconds);
}

virtual void NextTest() = 0;

/////////// GlobalCommands Interface /////////
CHIP_ERROR Wait(chip::System::Clock::Timeout ms);
CHIP_ERROR WaitForMs(uint16_t ms) { return Wait(chip::System::Clock::Milliseconds32(ms)); }
CHIP_ERROR WaitForCommissionee();
CHIP_ERROR Log(const char * message);
CHIP_ERROR Prompt(const char * message);

protected:
ChipDevice * mDevice;
chip::NodeId mNodeId;

static void OnDeviceConnectedFn(void * context, chip::DeviceProxy * device);
static void OnDeviceConnectedFn(void * context, chip::OperationalDeviceProxy * device);
static void OnDeviceConnectionFailureFn(void * context, NodeId deviceId, CHIP_ERROR error);
static void OnWaitForMsFn(chip::System::Layer * systemLayer, void * context);

Expand Down Expand Up @@ -261,5 +269,6 @@ class TestCommand : public CHIPCommand
chip::Optional<uint64_t> mDelayInMs;
chip::Optional<char *> mPICSFilePath;
chip::Optional<chip::EndpointId> mEndpointId;
chip::Optional<uint16_t> mTimeout;
chip::Optional<std::map<std::string, bool>> PICS;
};
19 changes: 14 additions & 5 deletions examples/chip-tool/templates/partials/test_cluster.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ class {{filename}}: public TestCommand
}
}

{{#if timeout}}
chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.HasValue() : mTimeout.Value() : {{timeout}}); }
{{/if}}

private:
std::atomic_uint16_t mTestIndex;
Expand Down Expand Up @@ -226,17 +229,23 @@ class {{filename}}: public TestCommand

void {{>failureResponse}}({{>failureArguments}})
{
{{~#unless response.error}}
{{#if optional}}(status == EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE) ? NextTest() : {{/if}}ThrowFailureResponse();
{{#if response.error}}
VerifyOrReturn(CheckValue("status", status, {{response.error}}));
{{#unless async}}NextTest();{{/unless}}
{{else if response.errorWrongValue}}
VerifyOrReturn(CheckConstraintNotValue("status", status, 0));
{{#unless async}}NextTest();{{/unless}}
{{else}}
{{#unless async}}NextTest();{{/unless}}
{{/unless}}
{{#if optional}}(status == EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE) ? NextTest() : {{/if}}ThrowFailureResponse();
{{/if}}
}

void {{>successResponse}}({{>successArguments}})
{
{{~#if response.error}}
ThrowSuccessResponse();
ThrowSuccessResponse();
{{else if response.errorWrongValue}}
ThrowSuccessResponse();
{{else}}
{{! This block can be removed if there is a mechanism to remove the report handler}}
{{#if isWaitForReport}}
Expand Down
Loading

0 comments on commit ebfa8c5

Please sign in to comment.