Skip to content

Commit

Permalink
[TC-MWOxxx] Add MWO tests (#30856)
Browse files Browse the repository at this point in the history
This PR adds test for the MWO clusters.
- Test for Microwave Oven Mode cluster
- Test for Microwave Oven Control cluster

Note: tests reflect spec [PR 8588](https://github.com/CHIP-Specifications/connectedhomeip-spec/pull/8588) and [PR 8715](https://github.com/CHIP-Specifications/connectedhomeip-spec/pull/8715)

This PR also:
- Adds a CI build target for the microwave oven example app
- Adds the python tests to CI
- Uses the example app for tests instead of all-clusters
- Fixes an SDK build problem for the microwave control cluster
  • Loading branch information
rbultman authored and pull[bot] committed Jul 31, 2024
1 parent eb6e6ea commit 1112896
Show file tree
Hide file tree
Showing 23 changed files with 891 additions and 13 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/darwin-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ jobs:
--target darwin-x64-tv-app-${BUILD_VARIANT} \
--target darwin-x64-bridge-${BUILD_VARIANT} \
--target darwin-x64-lit-icd-${BUILD_VARIANT} \
--target darwin-x64-microwave-oven-${BUILD_VARIANT} \
build \
--copy-artifacts-to objdir-clone \
"
Expand All @@ -118,6 +119,7 @@ jobs:
--ota-requestor-app ./out/darwin-x64-ota-requestor-${BUILD_VARIANT}/chip-ota-requestor-app \
--tv-app ./out/darwin-x64-tv-app-${BUILD_VARIANT}/chip-tv-app \
--bridge-app ./out/darwin-x64-bridge-${BUILD_VARIANT}/chip-bridge-app \
--microwave-oven-app ./out/darwin-x64-microwave-oven-${BUILD_VARIANT}/chip-microwave-oven-app \
"
- name: Run OTA Test
run: |
Expand Down
13 changes: 12 additions & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ jobs:
--target linux-x64-tv-app-${BUILD_VARIANT} \
--target linux-x64-bridge-${BUILD_VARIANT} \
--target linux-x64-lit-icd-${BUILD_VARIANT} \
--target linux-x64-microwave-oven-${BUILD_VARIANT} \
build \
--copy-artifacts-to objdir-clone \
"
Expand All @@ -232,6 +233,7 @@ jobs:
--tv-app ./out/linux-x64-tv-app-${BUILD_VARIANT}/chip-tv-app \
--bridge-app ./out/linux-x64-bridge-${BUILD_VARIANT}/chip-bridge-app \
--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 \
"
- name: Run purposeful failure tests using the python parser sending commands to chip-tool
Expand Down Expand Up @@ -271,6 +273,7 @@ jobs:
--tv-app ./out/linux-x64-tv-app-${BUILD_VARIANT}/chip-tv-app \
--bridge-app ./out/linux-x64-bridge-${BUILD_VARIANT}/chip-bridge-app \
--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 \
"
- name: Run Tests using chip-repl (including slow)
if: github.event_name == 'push'
Expand All @@ -288,6 +291,7 @@ jobs:
--tv-app ./out/linux-x64-tv-app-${BUILD_VARIANT}/chip-tv-app \
--bridge-app ./out/linux-x64-bridge-${BUILD_VARIANT}/chip-bridge-app \
--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 \
"
- name: Uploading core files
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -354,6 +358,7 @@ jobs:
--target darwin-x64-tv-app-${BUILD_VARIANT} \
--target darwin-x64-bridge-${BUILD_VARIANT} \
--target darwin-x64-lit-icd-${BUILD_VARIANT} \
--target darwin-x64-microwave-oven-${BUILD_VARIANT} \
build \
--copy-artifacts-to objdir-clone \
"
Expand All @@ -374,7 +379,8 @@ jobs:
--ota-requestor-app ./out/darwin-x64-ota-requestor-${BUILD_VARIANT}/chip-ota-requestor-app \
--tv-app ./out/darwin-x64-tv-app-${BUILD_VARIANT}/chip-tv-app \
--bridge-app ./out/darwin-x64-bridge-${BUILD_VARIANT}/chip-bridge-app \
--lit-icd-app ./out/darwin-x64-lit-icd-${BUILD_VARIANT}/lit-icd-app \
--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 \
"
- name: Run purposeful failure tests using the python parser sending commands to chip-tool
Expand Down Expand Up @@ -453,6 +459,7 @@ jobs:
--target linux-x64-lock-ipv6only-no-ble-no-wifi-tsan-clang-test \
--target linux-x64-lit-icd-ipv6only-no-ble-no-wifi-tsan-clang-test \
--target linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test \
--target linux-x64-microwave-oven-ipv6only-no-ble-no-wifi-tsan-clang-test \
--target linux-x64-python-bindings \
build \
--copy-artifacts-to objdir-clone \
Expand Down Expand Up @@ -512,6 +519,10 @@ jobs:
scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --script "src/python_testing/TestMatterTestingSupport.py" --script-args "--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 --script "src/python_testing/TestSpecParsingSupport.py" --script-args "--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/TestTimeSyncTrustedTimeSourceRunner.py'
scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-microwave-oven-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-microwave-oven-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_MWOCTRL_2_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --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 --app out/linux-x64-microwave-oven-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-microwave-oven-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_MWOCTRL_2_3.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --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 --app out/linux-x64-microwave-oven-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-microwave-oven-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_MWOCTRL_2_4.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --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 --app out/linux-x64-microwave-oven-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-microwave-oven-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_MWOM_1_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"'
- name: Uploading core files
uses: actions/upload-artifact@v4
if: ${{ failure() && !env.ACT }}
Expand Down
12 changes: 12 additions & 0 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,10 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") {
enable_linux_lighting_app_build =
enable_default_builds && (host_os == "linux" || host_os == "mac")

# Build the Linux microwave oven app example.
enable_microwave_oven_app_build =
enable_default_builds && (host_os == "linux" || host_os == "mac")

# Build the Linux thermostat app example.
enable_linux_thermostat_app_build =
enable_default_builds && (host_os == "linux" || host_os == "mac")
Expand Down Expand Up @@ -594,6 +598,14 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") {
extra_build_deps += [ ":linux_bridge_app" ]
}

if (enable_microwave_oven_app_build) {
group("linux_microwave_oven_app") {
deps = [ "${chip_root}/examples/microwave-oven-app/linux(${standalone_toolchain})" ]
}

extra_build_deps += [ ":linux_microwave_oven_app" ]
}

if (enable_linux_lighting_app_build) {
group("linux_lighting_app") {
deps = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ class ExampleMicrowaveOvenDevice : public MicrowaveOvenControl::Delegate,
static constexpr uint8_t kMaxPowerNum = 90u;
static constexpr uint8_t kPowerStepNum = 10u;
static constexpr uint32_t kMaxCookTimeSec = 86400u;
static constexpr uint8_t kDefaultPowerSettingNum = 100u;
static constexpr uint8_t kDefaultPowerSettingNum = kMaxPowerNum;

// define the mode value
static constexpr uint8_t kModeNormal = 0u;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@ using namespace chip::app::Clusters::OperationalState;
using namespace chip::app::Clusters::ModeBase;
using namespace chip::app::Clusters::MicrowaveOvenControl;
template <typename T>
using List = chip::app::DataModel::List<T>;
using ModeTagStructType = chip::app::Clusters::detail::Structs::ModeTagStruct::Type;
using OperationalStateEnum = chip::app::Clusters::OperationalState::OperationalStateEnum;
using Status = Protocols::InteractionModel::Status;
using List = chip::app::DataModel::List<T>;
using ModeTagStructType = chip::app::Clusters::detail::Structs::ModeTagStruct::Type;
using Status = Protocols::InteractionModel::Status;

void ExampleMicrowaveOvenDevice::MicrowaveOvenInit()
{
Expand Down
4 changes: 2 additions & 2 deletions scripts/build/builders/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,8 @@ def OutputNames(self):
yield 'dishwasher-app'
yield 'dishwasher-app.map'
elif self == HostApp.MICROWAVE_OVEN:
yield 'microwave-oven-app'
yield 'microwave-oven-app.map'
yield 'chip-microwave-oven-app'
yield 'chip-microwave-oven-app.map'
elif self == HostApp.REFRIGERATOR:
yield 'refrigerator-app'
yield 'refrigerator-app.map'
Expand Down
2 changes: 1 addition & 1 deletion scripts/build/gn_gen_cirque.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ echo "Setup build environment"
source "./scripts/activate.sh"

echo "Build: GN configure"
gn --root="$CHIP_ROOT" gen --check --fail-on-unused-args out/debug --args='target_os="all"'"chip_build_tests=false chip_enable_wifi=false chip_im_force_fabric_quota_check=true enable_default_builds=false enable_host_gcc_build=true enable_standalone_chip_tool_build=true enable_linux_all_clusters_app_build=true enable_linux_lighting_app_build=true enable_linux_lit_icd_app_build=true"
gn --root="$CHIP_ROOT" gen --check --fail-on-unused-args out/debug --args='target_os="all"'"chip_build_tests=false chip_enable_wifi=false chip_im_force_fabric_quota_check=true enable_default_builds=false enable_host_gcc_build=true enable_standalone_chip_tool_build=true enable_linux_all_clusters_app_build=true enable_linux_lighting_app_build=true enable_microwave_oven_app_build=true enable_linux_lit_icd_app_build=true"

echo "Build: Ninja build"
time ninja -C out/debug all check
2 changes: 2 additions & 0 deletions scripts/tests/chiptest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,8 @@ def target_for_name(name: str):
return TestTarget.BRIDGE
if name.startswith("TestIcd") or name.startswith("Test_TC_ICDM_"):
return TestTarget.LIT_ICD
if name.startswith("Test_TC_MWOCTRL_") or name.startswith("Test_TC_MWOM_"):
return TestTarget.MWO
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 @@ -182,6 +182,7 @@ def PathsWithNetworkNamespaces(paths: ApplicationPaths) -> ApplicationPaths:
ota_requestor_app='ip netns exec app'.split() + paths.ota_requestor_app,
tv_app='ip netns exec app'.split() + paths.tv_app,
lit_icd_app='ip netns exec app'.split() + paths.lit_icd_app,
microwave_oven_app='ip netns exec app'.split() + paths.microwave_oven_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 @@ -175,6 +175,7 @@ class TestTarget(Enum):
OTA = auto()
BRIDGE = auto()
LIT_ICD = auto()
MWO = auto()


@dataclass
Expand All @@ -187,12 +188,13 @@ class ApplicationPaths:
tv_app: typing.List[str]
bridge_app: typing.List[str]
lit_icd_app: typing.List[str]
microwave_oven_app: typing.List[str]
chip_repl_yaml_tester_cmd: typing.List[str]
chip_tool_with_python_cmd: 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.chip_repl_yaml_tester_cmd, self.chip_tool_with_python_cmd]
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]


@dataclass
Expand Down Expand Up @@ -301,6 +303,8 @@ def Run(self, runner, apps_register, paths: ApplicationPaths, pics_file: str,
target_app = paths.bridge_app
elif self.target == TestTarget.LIT_ICD:
target_app = paths.lit_icd_app
elif self.target == TestTarget.MWO:
target_app = paths.microwave_oven_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 @@ -254,6 +254,9 @@ def cmd_list(context):
@click.option(
'--lit-icd-app',
help='what lit-icd app to use')
@click.option(
'--microwave-oven-app',
help='what microwave oven 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 @@ -285,7 +288,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, 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, 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 @@ -315,6 +318,9 @@ def cmd_run(context, iterations, all_clusters_app, lock_app, ota_provider_app, o
if lit_icd_app is None:
lit_icd_app = paths_finder.get('lit-icd-app')

if microwave_oven_app is None:
microwave_oven_app = paths_finder.get('chip-microwave-oven-app')

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

Expand All @@ -334,6 +340,7 @@ def cmd_run(context, iterations, all_clusters_app, lock_app, ota_provider_app, o
tv_app=[tv_app],
bridge_app=[bridge_app],
lit_icd_app=[lit_icd_app],
microwave_oven_app=[microwave_oven_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 @@ -229,7 +229,7 @@ void Instance::InvokeCommand(HandlerContext & handlerContext)
void Instance::HandleSetCookingParameters(HandlerContext & ctx, const Commands::SetCookingParameters::DecodableType & req)
{
ChipLogDetail(Zcl, "Microwave Oven Control: HandleSetCookingParameters");
Status status;
Status status = Status::Success;
uint8_t opState;
uint8_t modeValue;
uint8_t reqCookMode;
Expand Down
24 changes: 24 additions & 0 deletions src/app/tests/suites/certification/PICS.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1905,6 +1905,30 @@ PICS:
"Does the device implement sending the ChangeToModeResponse command?"
id: DISHM.S.C01.Tx

#
# Microwave Oven Mode Cluster
#
- label:
"Does the device implement the Microwave Oven Mode cluster as a server"
id: MWOM.S

#
# Microwave Oven Control Cluster
#
- label:
"Does the device implement the Microwave Oven Control cluster as a
server"
id: MWOCTRL.S

#
# server / features
#
- label: "Does the device support the power as a number feature"
id: MWOCTRL.S.F00

- label: "Does the device support the power number limits feature"
id: MWOCTRL.S.F02

# Descriptor Cluster TestPlan
- label: "Does the device implement the Descriptor cluster as a server?"
id: DESC.S
Expand Down
Loading

0 comments on commit 1112896

Please sign in to comment.