Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

THNETDIR / WIFINM: Test scripts and small fixes #34469

Merged
merged 14 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ jobs:
src/app/zap-templates/zcl/data-model/chip/thermostat-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/thread-border-router-management-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/thread-network-diagnostics-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/thread-network-directory-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/time-format-localization-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/time-synchronization-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/timer-cluster.xml \
Expand Down Expand Up @@ -222,6 +223,7 @@ jobs:
--target linux-x64-lit-icd-${BUILD_VARIANT} \
--target linux-x64-microwave-oven-${BUILD_VARIANT} \
--target linux-x64-rvc-${BUILD_VARIANT} \
--target linux-x64-network-manager-${BUILD_VARIANT} \
build \
--copy-artifacts-to objdir-clone \
"
Expand All @@ -244,6 +246,7 @@ jobs:
--lit-icd-app ./out/linux-x64-lit-icd-${BUILD_VARIANT}/lit-icd-app \
--microwave-oven-app ./out/linux-x64-microwave-oven-${BUILD_VARIANT}/chip-microwave-oven-app \
--rvc-app ./out/linux-x64-rvc-${BUILD_VARIANT}/chip-rvc-app \
--network-manager-app ./out/linux-x64-network-manager-${BUILD_VARIANT}/matter-network-manager-app \
"

- name: Run purposeful failure tests using the python parser sending commands to chip-tool
Expand Down Expand Up @@ -285,6 +288,7 @@ jobs:
--lit-icd-app ./out/linux-x64-lit-icd-${BUILD_VARIANT}/lit-icd-app \
--microwave-oven-app ./out/linux-x64-microwave-oven-${BUILD_VARIANT}/chip-microwave-oven-app \
--rvc-app ./out/linux-x64-rvc-${BUILD_VARIANT}/chip-rvc-app \
--network-manager-app ./out/linux-x64-network-manager-${BUILD_VARIANT}/matter-network-manager-app \
"
- name: Run Tests using chip-repl (including slow)
if: github.event_name == 'push'
Expand All @@ -304,6 +308,7 @@ jobs:
--lit-icd-app ./out/linux-x64-lit-icd-${BUILD_VARIANT}/lit-icd-app \
--microwave-oven-app ./out/linux-x64-microwave-oven-${BUILD_VARIANT}/chip-microwave-oven-app \
--rvc-app ./out/linux-x64-rvc-${BUILD_VARIANT}/chip-rvc-app \
--network-manager-app ./out/linux-x64-network-manager-${BUILD_VARIANT}/matter-network-manager-app \
"
- name: Uploading core files
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -372,6 +377,7 @@ jobs:
--target darwin-x64-lit-icd-${BUILD_VARIANT} \
--target darwin-x64-microwave-oven-${BUILD_VARIANT} \
--target darwin-x64-rvc-${BUILD_VARIANT} \
--target darwin-x64-network-manager-${BUILD_VARIANT} \
build \
--copy-artifacts-to objdir-clone \
"
Expand All @@ -395,6 +401,7 @@ jobs:
--lit-icd-app ./out/darwin-x64-lit-icd-${BUILD_VARIANT}/lit-icd-app \
--microwave-oven-app ./out/darwin-x64-microwave-oven-${BUILD_VARIANT}/chip-microwave-oven-app \
--rvc-app ./out/darwin-x64-rvc-${BUILD_VARIANT}/chip-rvc-app \
--network-manager-app ./out/darwin-x64-network-manager-${BUILD_VARIANT}/matter-network-manager-app \
"

- name: Run purposeful failure tests using the python parser sending commands to chip-tool
Expand Down
10 changes: 9 additions & 1 deletion build/config/compiler/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import("//build_overrides/build.gni")
import("//build_overrides/pigweed.gni")
import("//build_overrides/pigweed_environment.gni")
import("${build_root}/chip/java/config.gni")
import("${build_root}/config/compiler/compiler.gni")
import("${build_root}/config/sysroot.gni")
Expand Down Expand Up @@ -348,7 +349,14 @@ config("cosmetic_default") {
}

config("runtime_default") {
if (is_clang) { # Using Pigweed clang instead of Darwin host clang
if (is_clang &&
current_os == "mac") { # Using Pigweed clang instead of Darwin host clang
# Without pw_env_setup_CIPD_PIGWEED defined the hostclang:no_system_libcpp
# config silently uses the system libc++, usually resulting in linker errors.
assert(
defined(pw_env_setup_CIPD_PIGWEED),
"//build_overrides/pigweed_environment.gni must define pw_env_setup_CIPD_PIGWEED when using pigweed clang")

configs = [
"$dir_pw_toolchain/host_clang:no_system_libcpp",
"$dir_pw_toolchain/host_clang:xcode_sysroot",
Expand Down
4 changes: 2 additions & 2 deletions examples/network-manager-app/linux/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import("//build_overrides/build.gni")
import("//build_overrides/chip.gni")

executable("network-manager-app") {
executable("matter-network-manager-app") {
sources = [
"include/CHIPProjectAppConfig.h",
"main.cpp",
Expand All @@ -32,7 +32,7 @@ executable("network-manager-app") {
}

group("linux") {
deps = [ ":network-manager-app" ]
deps = [ ":matter-network-manager-app" ]
}

group("default") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1237,7 +1237,7 @@ cluster ThreadNetworkDirectory = 1107 {
/** Removes an entry from the ThreadNetworks list. */
timed command access(invoke: manage) RemoveNetwork(RemoveNetworkRequest): DefaultSuccess = 1;
/** Retrieves a Thread Operational Dataset from the ThreadNetworks list. */
timed command GetOperationalDataset(GetOperationalDatasetRequest): OperationalDatasetResponse = 2;
command GetOperationalDataset(GetOperationalDatasetRequest): OperationalDatasetResponse = 2;
}

endpoint 0 {
Expand Down
3 changes: 3 additions & 0 deletions scripts/build/builders/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,9 @@ def OutputNames(self):
elif self == HostApp.LIT_ICD:
yield 'lit-icd-app'
yield 'lit-icd-app.map'
elif self == HostApp.NETWORK_MANAGER:
yield 'matter-network-manager-app'
yield 'matter-network-manager-app.map'
elif self == HostApp.ENERGY_MANAGEMENT:
yield 'chip-energy-management-app'
yield 'chip-energy-management-app.map'
Expand Down
2 changes: 2 additions & 0 deletions scripts/tests/chiptest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,8 @@ def target_for_name(name: str):
return TestTarget.MWO
if name.startswith("Test_TC_RVCRUNM_") or name.startswith("Test_TC_RVCCLEANM_") or name.startswith("Test_TC_RVCOPSTATE_"):
return TestTarget.RVC
if name.startswith("Test_TC_THNETDIR_") or name.startswith("Test_TC_WIFINM_"):
return TestTarget.NETWORK_MANAGER
return TestTarget.ALL_CLUSTERS


Expand Down
1 change: 1 addition & 0 deletions scripts/tests/chiptest/linux.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ def PathsWithNetworkNamespaces(paths: ApplicationPaths) -> ApplicationPaths:
lit_icd_app='ip netns exec app'.split() + paths.lit_icd_app,
microwave_oven_app='ip netns exec app'.split() + paths.microwave_oven_app,
rvc_app='ip netns exec app'.split() + paths.rvc_app,
network_manager_app='ip netns exec app'.split() + paths.network_manager_app,
bridge_app='ip netns exec app'.split() + paths.bridge_app,
chip_repl_yaml_tester_cmd='ip netns exec tool'.split() + paths.chip_repl_yaml_tester_cmd,
chip_tool_with_python_cmd='ip netns exec tool'.split() + paths.chip_tool_with_python_cmd,
Expand Down
6 changes: 5 additions & 1 deletion scripts/tests/chiptest/test_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ class TestTarget(Enum):
LIT_ICD = auto()
MWO = auto()
RVC = auto()
NETWORK_MANAGER = auto()


@dataclass
Expand All @@ -193,10 +194,11 @@ class ApplicationPaths:
chip_repl_yaml_tester_cmd: typing.List[str]
chip_tool_with_python_cmd: typing.List[str]
rvc_app: typing.List[str]
network_manager_app: typing.List[str]

def items(self):
return [self.chip_tool, self.all_clusters_app, self.lock_app, self.ota_provider_app, self.ota_requestor_app,
self.tv_app, self.bridge_app, self.lit_icd_app, self.microwave_oven_app, self.chip_repl_yaml_tester_cmd, self.chip_tool_with_python_cmd, self.rvc_app]
self.tv_app, self.bridge_app, self.lit_icd_app, self.microwave_oven_app, self.chip_repl_yaml_tester_cmd, self.chip_tool_with_python_cmd, self.rvc_app, self.network_manager_app]


@dataclass
Expand Down Expand Up @@ -309,6 +311,8 @@ def Run(self, runner, apps_register, paths: ApplicationPaths, pics_file: str,
target_app = paths.microwave_oven_app
elif self.target == TestTarget.RVC:
target_app = paths.rvc_app
elif self.target == TestTarget.NETWORK_MANAGER:
target_app = paths.network_manager_app
else:
raise Exception("Unknown test target - "
"don't know which application to run")
Expand Down
9 changes: 8 additions & 1 deletion scripts/tests/run_test_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,9 @@ def cmd_list(context):
@click.option(
'--rvc-app',
help='what rvc app to use')
@click.option(
'--network-manager-app',
help='what network-manager app to use')
@click.option(
'--chip-repl-yaml-tester',
help='what python script to use for running yaml tests using chip-repl as controller')
Expand Down Expand Up @@ -291,7 +294,7 @@ def cmd_list(context):
help='Number of tests that are expected to fail in each iteration. Overall test will pass if the number of failures matches this. Nonzero values require --keep-going')
@click.pass_context
def cmd_run(context, iterations, all_clusters_app, lock_app, ota_provider_app, ota_requestor_app,
tv_app, bridge_app, lit_icd_app, microwave_oven_app, rvc_app, chip_repl_yaml_tester, chip_tool_with_python, pics_file, keep_going, test_timeout_seconds, expected_failures):
tv_app, bridge_app, lit_icd_app, microwave_oven_app, rvc_app, network_manager_app, chip_repl_yaml_tester, chip_tool_with_python, pics_file, keep_going, test_timeout_seconds, expected_failures):
if expected_failures != 0 and not keep_going:
logging.exception(f"'--expected-failures {expected_failures}' used without '--keep-going'")
sys.exit(2)
Expand Down Expand Up @@ -327,6 +330,9 @@ def cmd_run(context, iterations, all_clusters_app, lock_app, ota_provider_app, o
if rvc_app is None:
rvc_app = paths_finder.get('chip-rvc-app')

if network_manager_app is None:
network_manager_app = paths_finder.get('matter-network-manager-app')

if chip_repl_yaml_tester is None:
chip_repl_yaml_tester = paths_finder.get('yamltest_with_chip_repl_tester.py')

Expand All @@ -348,6 +354,7 @@ def cmd_run(context, iterations, all_clusters_app, lock_app, ota_provider_app, o
lit_icd_app=[lit_icd_app],
microwave_oven_app=[microwave_oven_app],
rvc_app=[rvc_app],
network_manager_app=[network_manager_app],
chip_repl_yaml_tester_cmd=['python3'] + [chip_repl_yaml_tester],
chip_tool_with_python_cmd=['python3'] + [chip_tool_with_python],
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,10 @@ void ThreadNetworkDirectoryServer::HandleOperationalDatasetRequest(

uint8_t datasetBuffer[kSizeOperationalDataset];
MutableByteSpan datasetSpan(datasetBuffer);
OperationalDatasetResponse::Type response;
SuccessOrExit(err = mStorage.GetNetworkDataset(ExtendedPanId(req.extendedPanID), datasetSpan));
ctx.mCommandHandler.AddStatus(ctx.mRequestPath, IMStatus::Success);
response.operationalDataset = datasetSpan;
ctx.mCommandHandler.AddResponse(ctx.mRequestPath, response);
return;
exit:
ChipLogError(Zcl, "GetOperationalDataset: %" CHIP_ERROR_FORMAT, err.Format());
Expand Down
16 changes: 16 additions & 0 deletions src/app/tests/suites/certification/PICS.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10199,3 +10199,19 @@ PICS:

- label: "Does the device implement the ActiveEndpoints attribute?"
id: PWRTL.S.A0001

#
# Thread Network Directory Cluster
#
- label:
"Does the device implement the Thread Network Directory cluster as a
server"
id: THNETDIR.S

#
# Wi-Fi Network Management Cluster
#
- label:
"Does the device implement the Wi-Fi Network Management cluster as a
server"
id: WIFINM.S
51 changes: 51 additions & 0 deletions src/app/tests/suites/certification/Test_TC_THNETDIR_2_1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# 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: "[TC-THNETDIR-2.1] Simple Attributes check with DUT as Server"

PICS:
- THNETDIR.S

config:
nodeId: 0x12344321
cluster: Thread Network Directory
endpoint: 1

tests:
- label: "Wait for the commissioned device to be retrieved"
cluster: DelayCommands
command: WaitForCommissionee
arguments:
values:
- name: nodeId
value: nodeId

- label: "TH reads SupportedFabrics attribute from DUT"
command: readAttribute
endpoint: 0
cluster: Operational Credentials
attribute: SupportedFabrics
response:
saveAs: supportedFabrics
constraints:
type: int8u

- label: "TH reads ThreadNetworkTableSize attribute from DUT"
command: readAttribute
attribute: ThreadNetworkTableSize
response:
constraints:
type: int8u
minValue: 10 # assume 5 supported fabrics
# python: value >= 2 * supportedFabrics
Loading
Loading