Skip to content

Commit

Permalink
Merge branch 'master' into feature/app-install-flow-public
Browse files Browse the repository at this point in the history
  • Loading branch information
lazarkov authored Jul 10, 2024
2 parents 3f815e9 + f83d67b commit 33aaac8
Show file tree
Hide file tree
Showing 110 changed files with 6,782 additions and 553 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ on:
run-codeql:
required: false
type: boolean

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

env:
CHIP_NO_LOG_TIMESTAMPS: true

jobs:
build_linux_gcc_debug:
name: Build on Linux (gcc_debug)
Expand Down Expand Up @@ -210,7 +210,7 @@ jobs:
./scripts/run_in_build_env.sh \
"./scripts/run-clang-tidy-on-compile-commands.py \
--compile-database out/sanitizers/compile_commands.json \
--file-exclude-regex '/(repo|zzz_generated|lwip/standalone)/|-ReadImpl|-InvokeSubscribeImpl|CodegenDataModel_Write' \
--file-exclude-regex '/(repo|zzz_generated|lwip/standalone)/|-ReadImpl|-InvokeSubscribeImpl|CodegenDataModel_Write|QuieterReporting' \
check \
"
- name: Clean output
Expand Down Expand Up @@ -243,7 +243,7 @@ jobs:
run: |
rm -rf ./zzz_pregenerated
mv scripts/codegen.py.renamed scripts/codegen.py
mv scripts/tools/zap/generate.py.renamed scripts/tools/zap/generate.py
mv scripts/tools/zap/generate.py.renamed scripts/tools/zap/generate.py
- name: Run fake linux tests with build_examples
run: |
./scripts/run_in_build_env.sh \
Expand All @@ -253,7 +253,7 @@ jobs:
uses: ./.github/actions/perform-codeql-analysis
with:
language: cpp

- name: Uploading core files
uses: actions/upload-artifact@v4
if: ${{ failure() && !env.ACT }}
Expand Down Expand Up @@ -430,7 +430,7 @@ jobs:
./scripts/run_in_build_env.sh \
"./scripts/run-clang-tidy-on-compile-commands.py \
--compile-database out/default/compile_commands.json \
--file-exclude-regex '/(repo|zzz_generated|lwip/standalone)/|CodegenDataModel_Write' \
--file-exclude-regex '/(repo|zzz_generated|lwip/standalone)/|CodegenDataModel_Write|QuieterReporting' \
check \
"
- name: Uploading diagnostic logs
Expand All @@ -445,7 +445,7 @@ jobs:
uses: ./.github/actions/perform-codeql-analysis
with:
language: cpp

# TODO Log Upload https://github.com/project-chip/connectedhomeip/issues/2227
# TODO https://github.com/project-chip/connectedhomeip/issues/1512

Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ jobs:
src/app/zap-templates/zcl/data-model/chip/channel-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/clusters-extensions.xml \
src/app/zap-templates/zcl/data-model/chip/color-control-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/commissioner-control-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/concentration-measurement-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/content-launch-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/content-app-observer-cluster.xml \
Expand Down Expand Up @@ -494,7 +495,7 @@ jobs:
- name: Run Tests
run: |
mkdir -p out/trace_data
scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script-args "--log-level INFO -t 3600 --disable-test ClusterObjectTests.TestTimedRequestTimeout --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"'
scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/controller/python/test/test_scripts/mobile-device-test.py'
scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_ACE_1_2.py'
scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_ACE_1_3.py'
scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_ACE_1_4.py'
Expand Down
114 changes: 62 additions & 52 deletions docs/testing/python.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,58 +85,8 @@ The default_matter_test_main() function is used to run the test on the command
line. These two lines should appear verbatim at the bottom of every python test
file.

## Defining the test arguments

Below is the format:

```
# test-runner-runs: <run_identifier>
# test-runner-run/<run_identifier>/app: ${TYPE_OF_APP}
# test-runner-run/<run_identifier>/factoryreset: <True|False>
# test-runner-run/<run_identifier>/quiet: <True|False>
# test-runner-run/<run_identifier>/app-args: <app_arguments>
# test-runner-run/<run_identifier>/script-args: <script_arguments>
```

### Description of Parameters

- test-runner-runs: Specifies the identifier for the run. This can be any
unique identifier.

- Example: run1

- test-runner-run/<run_identifier>/app: Indicates the application to be used
in the test. Different app types as needed could be referenced from section
[name: Generate an argument environment file ] of the file
[.github/workflows/tests.yaml](https://github.com/project-chip/connectedhomeip/blob/master/.github/workflows/tests.yaml)

- Example: \${TYPE_OF_APP}

- test-runner-run/<run_identifier>/factoryreset: Determines whether a factory
reset should be performed before the test.

- Example: True

- test-runner-run/<run_identifier>/quiet: Sets the verbosity level of the test
run. When set to True, the test run will be quieter.

- Example: True

- test-runner-run/<run_identifier>/app-args: Specifies the arguments to be
passed to the application during the test.

- Example: --discriminator 1234 --KVS kvs1 --trace-to
json:\${TRACE_APP}.json

- test-runner-run/<run_identifier>/script-args: Specifies the arguments to be
passed to the test script.
- Example: --storage-path admin_storage.json --commissioning-method
on-network --discriminator 1234 --passcode 20202021 --trace-to
json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto

This structured format ensures that all necessary configurations are clearly
defined and easily understood, allowing for consistent and reliable test
execution.
The structured comments above the class definition are used to set up the CI for
the tests. Please see [Running tests in CI](#running-tests-in-ci).

## Cluster Codegen

Expand Down Expand Up @@ -610,3 +560,63 @@ example DUT on the host and includes factory reset support
- if there are things in your test that will fail on CI (ex. test vendor
checks), gate them on the PICS_SDK_CI_ONLY
- is_ci = self.check_pics('PICS_SDK_CI_ONLY')

The CI test runner uses a structured environment setup that can be declared
using structured comments at the top of the test file. To use this structured
format, use the --load-from-env flag with the run_python_tests.py runner.

Ex:
`scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_ICDM_2_1.py'`

## Defining the CI test arguments

Below is the format:

```
# test-runner-runs: <run_identifier>
# test-runner-run/<run_identifier>/app: ${TYPE_OF_APP}
# test-runner-run/<run_identifier>/factoryreset: <True|False>
# test-runner-run/<run_identifier>/quiet: <True|False>
# test-runner-run/<run_identifier>/app-args: <app_arguments>
# test-runner-run/<run_identifier>/script-args: <script_arguments>
```

### Description of Parameters

- test-runner-runs: Specifies the identifier for the run. This can be any
unique identifier.

- Example: run1

- test-runner-run/<run_identifier>/app: Indicates the application to be used
in the test. Different app types as needed could be referenced from section
[name: Generate an argument environment file ] of the file
[.github/workflows/tests.yaml](https://github.com/project-chip/connectedhomeip/blob/master/.github/workflows/tests.yaml)

- Example: \${TYPE_OF_APP}

- test-runner-run/<run_identifier>/factoryreset: Determines whether a factory
reset should be performed before the test.

- Example: True

- test-runner-run/<run_identifier>/quiet: Sets the verbosity level of the test
run. When set to True, the test run will be quieter.

- Example: True

- test-runner-run/<run_identifier>/app-args: Specifies the arguments to be
passed to the application during the test.

- Example: --discriminator 1234 --KVS kvs1 --trace-to
json:\${TRACE_APP}.json

- test-runner-run/<run_identifier>/script-args: Specifies the arguments to be
passed to the test script.
- Example: --storage-path admin_storage.json --commissioning-method
on-network --discriminator 1234 --passcode 20202021 --trace-to
json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto

This structured format ensures that all necessary configurations are clearly
defined and easily understood, allowing for consistent and reliable test
execution.
1 change: 1 addition & 0 deletions docs/zap_clusters.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ Generally regenerate using one of:
| 1294 | 0x50E | AccountLogin |
| 1295 | 0x50F | ContentControl |
| 1296 | 0x510 | ContentAppObserver |
| 1873 | 0x751 | CommissionerControl |
| 2820 | 0xB04 | ElectricalMeasurement |
| 4294048773 | 0xFFF1FC05 | UnitTesting |
| 4294048774 | 0xFFF1FC06 | FaultInjection |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class CHIPCommandBridge : public Command {
{
AddArgument("commissioner-name", &mCommissionerName);
AddArgument("commissioner-nodeId", 0, UINT64_MAX, &mCommissionerNodeId,
"Sets the commisser node ID of the given "
"Sets the commissioner node ID of the given "
"commissioner-name. Interactive mode will only set a single commissioner on the inital command. "
"The commissioner node ID will be persisted until a different one is specified.");
AddArgument("paa-trust-store-path", &mPaaTrustStorePath,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ - (void)controller:(MTRDeviceController *)controller statusUpdate:(MTRCommission
ChipLogError(chipTool, "MTRCommissioningStatusDiscoveringMoreDevices: This should not happen.");
break;
case MTRCommissioningStatusUnknown:
ChipLogError(chipTool, "Uknown Pairing Status");
ChipLogError(chipTool, "Unknown Pairing Status");
break;
}
}
Expand Down
1 change: 1 addition & 0 deletions scripts/rules.matterlint
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ load "../src/app/zap-templates/zcl/data-model/chip/chip-ota.xml";
load "../src/app/zap-templates/zcl/data-model/chip/chip-types.xml";
load "../src/app/zap-templates/zcl/data-model/chip/clusters-extensions.xml";
load "../src/app/zap-templates/zcl/data-model/chip/color-control-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/commissioner-control-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/concentration-measurement-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/content-launch-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/content-app-observer-cluster.xml";
Expand Down
4 changes: 2 additions & 2 deletions scripts/setup/zap.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
"mac-amd64",
"windows-amd64"
],
"tags": ["version:2@v2024.06.10-nightly.1"]
"tags": ["version:2@v2024.07.10-nightly.1"]
},
{
"_comment": "Always get the amd64 version on mac until usable arm64 zap build is available",
"path": "fuchsia/third_party/zap/mac-amd64",
"platforms": ["mac-arm64"],
"tags": ["version:2@v2024.06.10-nightly.1"]
"tags": ["version:2@v2024.07.10-nightly.1"]
}
]
}
2 changes: 1 addition & 1 deletion scripts/setup/zap.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v2024.06.10-nightly
v2024.07.10-nightly
2 changes: 1 addition & 1 deletion scripts/tools/zap/zap_execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# Use scripts/tools/zap/version_update.py to manage ZAP versioning as many
# files may need updating for versions
#
MIN_ZAP_VERSION = '2024.6.6'
MIN_ZAP_VERSION = '2024.7.10'


class ZapTool:
Expand Down
23 changes: 22 additions & 1 deletion scripts/tools/zap_regen_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,8 @@ def setupArgumentsParser():

parser.add_argument('--parallel', action='store_true')
parser.add_argument('--no-parallel', action='store_false', dest='parallel')
parser.set_defaults(parallel=True)
parser.add_argument('--no-rerun-in-env', action='store_false', dest='rerun_in_env')
parser.set_defaults(parallel=True, rerun_in_env=True)

args = parser.parse_args()

Expand Down Expand Up @@ -495,6 +496,26 @@ def main():
level=logging.INFO,
format='%(asctime)s %(name)s %(levelname)-7s %(message)s'
)

# The scripts executed by this generally MUST be within a bootstrapped environment because
# we need:
# - zap-cli in PATH
# - scripts/codegen.py uses click (can be in current pyenv, but guaranteed in bootstrap)
# - formatting is using bootstrapped clang-format
# Figure out if bootstrapped. For now assume `PW_ROOT` is such a marker in the environment
if "PW_ROOT" not in os.environ:
logging.error("Script MUST be run in a bootstrapped environment.")

# using the `--no-rerun-in-env` to avoid recursive infinite calls
if '--no-rerun-in-env' not in sys.argv:
import shlex
logging.info("Will re-try running in a build environment....")

what_to_run = sys.argv + ['--no-rerun-in-env']
launcher = os.path.join(CHIP_ROOT_DIR, 'scripts', 'run_in_build_env.sh')
os.execv(launcher, [launcher, shlex.join(what_to_run)])
sys.exit(1)

checkPythonVersion()
os.chdir(CHIP_ROOT_DIR)
args = setupArgumentsParser()
Expand Down
1 change: 1 addition & 0 deletions src/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ if (chip_build_tests) {
deps = []
tests = [
"${chip_root}/src/app/data-model/tests",
"${chip_root}/src/app/cluster-building-blocks/tests",
"${chip_root}/src/app/data-model-interface/tests",
"${chip_root}/src/access/tests",
"${chip_root}/src/crypto/tests",
Expand Down
8 changes: 3 additions & 5 deletions src/app/AttributeAccessInterfaceCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class AttributeAccessInterfaceCache
kDefinitelyUsed
};

constexpr AttributeAccessInterfaceCache() = default;
AttributeAccessInterfaceCache() { Invalidate(); }

/**
* @brief Invalidate the whole cache. Must be called every time list of AAI registrations changes.
Expand Down Expand Up @@ -106,8 +106,6 @@ class AttributeAccessInterfaceCache
private:
struct AttributeAccessCacheEntry
{
constexpr AttributeAccessCacheEntry() = default;

EndpointId endpointId = kInvalidEndpointId;
ClusterId clusterId = kInvalidClusterId;
AttributeAccessInterface * accessor = nullptr;
Expand Down Expand Up @@ -139,8 +137,8 @@ class AttributeAccessInterfaceCache
return &mCacheSlots[0];
}

AttributeAccessCacheEntry mCacheSlots[1] = {};
AttributeAccessCacheEntry mLastUnusedEntry{};
AttributeAccessCacheEntry mCacheSlots[1];
AttributeAccessCacheEntry mLastUnusedEntry;
};

} // namespace app
Expand Down
20 changes: 18 additions & 2 deletions src/app/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ static_library("interaction-model") {

public_deps = [
":app_config",
":command-handler",
":command-handler-impl",
":constants",
":paths",
":subscription-info-provider",
Expand Down Expand Up @@ -333,16 +333,32 @@ source_set("status-response") {
]
}

source_set("command-handler") {
source_set("command-handler-interface") {
sources = [
"CommandHandler.cpp",
"CommandHandler.h",
"CommandHandlerExchangeInterface.h",
]

public_deps = [
":paths",
"${chip_root}/src/access:types",
"${chip_root}/src/app/data-model",
"${chip_root}/src/lib/core",
"${chip_root}/src/lib/support",
"${chip_root}/src/messaging",
"${chip_root}/src/protocols/interaction_model",
]
}

source_set("command-handler-impl") {
sources = [
"CommandHandlerImpl.cpp",
"CommandHandlerImpl.h",
]

public_deps = [
":command-handler-interface",
":paths",
":required-privileges",
":status-response",
Expand Down
2 changes: 1 addition & 1 deletion src/app/EventLoggingTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ struct Timestamp
kSystem = 0,
kEpoch
};
constexpr Timestamp() = default;
Timestamp() {}
Timestamp(Type aType, uint64_t aValue) : mType(aType), mValue(aValue) {}
Timestamp(System::Clock::Timestamp aValue) : mType(Type::kSystem), mValue(aValue.count()) {}
static Timestamp Epoch(System::Clock::Timestamp aValue)
Expand Down
Loading

0 comments on commit 33aaac8

Please sign in to comment.