Skip to content

Commit 8398491

Browse files
authored
[TC-MWOxxx] Add MWO tests (#30856)
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](CHIP-Specifications/connectedhomeip-spec#8588) and [PR 8715](CHIP-Specifications/connectedhomeip-spec#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
1 parent 356317a commit 8398491

23 files changed

+891
-13
lines changed

.github/workflows/darwin-tests.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ jobs:
9999
--target darwin-x64-tv-app-${BUILD_VARIANT} \
100100
--target darwin-x64-bridge-${BUILD_VARIANT} \
101101
--target darwin-x64-lit-icd-${BUILD_VARIANT} \
102+
--target darwin-x64-microwave-oven-${BUILD_VARIANT} \
102103
build \
103104
--copy-artifacts-to objdir-clone \
104105
"
@@ -118,6 +119,7 @@ jobs:
118119
--ota-requestor-app ./out/darwin-x64-ota-requestor-${BUILD_VARIANT}/chip-ota-requestor-app \
119120
--tv-app ./out/darwin-x64-tv-app-${BUILD_VARIANT}/chip-tv-app \
120121
--bridge-app ./out/darwin-x64-bridge-${BUILD_VARIANT}/chip-bridge-app \
122+
--microwave-oven-app ./out/darwin-x64-microwave-oven-${BUILD_VARIANT}/chip-microwave-oven-app \
121123
"
122124
- name: Run OTA Test
123125
run: |

.github/workflows/tests.yaml

+12-1
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ jobs:
212212
--target linux-x64-tv-app-${BUILD_VARIANT} \
213213
--target linux-x64-bridge-${BUILD_VARIANT} \
214214
--target linux-x64-lit-icd-${BUILD_VARIANT} \
215+
--target linux-x64-microwave-oven-${BUILD_VARIANT} \
215216
build \
216217
--copy-artifacts-to objdir-clone \
217218
"
@@ -232,6 +233,7 @@ jobs:
232233
--tv-app ./out/linux-x64-tv-app-${BUILD_VARIANT}/chip-tv-app \
233234
--bridge-app ./out/linux-x64-bridge-${BUILD_VARIANT}/chip-bridge-app \
234235
--lit-icd-app ./out/linux-x64-lit-icd-${BUILD_VARIANT}/lit-icd-app \
236+
--microwave-oven-app ./out/linux-x64-microwave-oven-${BUILD_VARIANT}/chip-microwave-oven-app \
235237
"
236238
237239
- name: Run purposeful failure tests using the python parser sending commands to chip-tool
@@ -271,6 +273,7 @@ jobs:
271273
--tv-app ./out/linux-x64-tv-app-${BUILD_VARIANT}/chip-tv-app \
272274
--bridge-app ./out/linux-x64-bridge-${BUILD_VARIANT}/chip-bridge-app \
273275
--lit-icd-app ./out/linux-x64-lit-icd-${BUILD_VARIANT}/lit-icd-app \
276+
--microwave-oven-app ./out/linux-x64-microwave-oven-${BUILD_VARIANT}/chip-microwave-oven-app \
274277
"
275278
- name: Run Tests using chip-repl (including slow)
276279
if: github.event_name == 'push'
@@ -288,6 +291,7 @@ jobs:
288291
--tv-app ./out/linux-x64-tv-app-${BUILD_VARIANT}/chip-tv-app \
289292
--bridge-app ./out/linux-x64-bridge-${BUILD_VARIANT}/chip-bridge-app \
290293
--lit-icd-app ./out/linux-x64-lit-icd-${BUILD_VARIANT}/lit-icd-app \
294+
--microwave-oven-app ./out/linux-x64-microwave-oven-${BUILD_VARIANT}/chip-microwave-oven-app \
291295
"
292296
- name: Uploading core files
293297
uses: actions/upload-artifact@v4
@@ -354,6 +358,7 @@ jobs:
354358
--target darwin-x64-tv-app-${BUILD_VARIANT} \
355359
--target darwin-x64-bridge-${BUILD_VARIANT} \
356360
--target darwin-x64-lit-icd-${BUILD_VARIANT} \
361+
--target darwin-x64-microwave-oven-${BUILD_VARIANT} \
357362
build \
358363
--copy-artifacts-to objdir-clone \
359364
"
@@ -374,7 +379,8 @@ jobs:
374379
--ota-requestor-app ./out/darwin-x64-ota-requestor-${BUILD_VARIANT}/chip-ota-requestor-app \
375380
--tv-app ./out/darwin-x64-tv-app-${BUILD_VARIANT}/chip-tv-app \
376381
--bridge-app ./out/darwin-x64-bridge-${BUILD_VARIANT}/chip-bridge-app \
377-
--lit-icd-app ./out/darwin-x64-lit-icd-${BUILD_VARIANT}/lit-icd-app \
382+
--lit-icd-app ./out/darwin-x64-lit-icd-${BUILD_VARIANT}/lit-icd-app \
383+
--microwave-oven-app ./out/darwin-x64-microwave-oven-${BUILD_VARIANT}/chip-microwave-oven-app \
378384
"
379385
380386
- name: Run purposeful failure tests using the python parser sending commands to chip-tool
@@ -453,6 +459,7 @@ jobs:
453459
--target linux-x64-lock-ipv6only-no-ble-no-wifi-tsan-clang-test \
454460
--target linux-x64-lit-icd-ipv6only-no-ble-no-wifi-tsan-clang-test \
455461
--target linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test \
462+
--target linux-x64-microwave-oven-ipv6only-no-ble-no-wifi-tsan-clang-test \
456463
--target linux-x64-python-bindings \
457464
build \
458465
--copy-artifacts-to objdir-clone \
@@ -512,6 +519,10 @@ jobs:
512519
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"'
513520
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"'
514521
scripts/run_in_python_env.sh out/venv './scripts/tests/TestTimeSyncTrustedTimeSourceRunner.py'
522+
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"'
523+
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"'
524+
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"'
525+
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"'
515526
- name: Uploading core files
516527
uses: actions/upload-artifact@v4
517528
if: ${{ failure() && !env.ACT }}

BUILD.gn

+12
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,10 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") {
347347
enable_linux_lighting_app_build =
348348
enable_default_builds && (host_os == "linux" || host_os == "mac")
349349

350+
# Build the Linux microwave oven app example.
351+
enable_microwave_oven_app_build =
352+
enable_default_builds && (host_os == "linux" || host_os == "mac")
353+
350354
# Build the Linux thermostat app example.
351355
enable_linux_thermostat_app_build =
352356
enable_default_builds && (host_os == "linux" || host_os == "mac")
@@ -594,6 +598,14 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") {
594598
extra_build_deps += [ ":linux_bridge_app" ]
595599
}
596600

601+
if (enable_microwave_oven_app_build) {
602+
group("linux_microwave_oven_app") {
603+
deps = [ "${chip_root}/examples/microwave-oven-app/linux(${standalone_toolchain})" ]
604+
}
605+
606+
extra_build_deps += [ ":linux_microwave_oven_app" ]
607+
}
608+
597609
if (enable_linux_lighting_app_build) {
598610
group("linux_lighting_app") {
599611
deps = [

examples/microwave-oven-app/microwave-oven-common/include/microwave-oven-device.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ class ExampleMicrowaveOvenDevice : public MicrowaveOvenControl::Delegate,
230230
static constexpr uint8_t kMaxPowerNum = 90u;
231231
static constexpr uint8_t kPowerStepNum = 10u;
232232
static constexpr uint32_t kMaxCookTimeSec = 86400u;
233-
static constexpr uint8_t kDefaultPowerSettingNum = 100u;
233+
static constexpr uint8_t kDefaultPowerSettingNum = kMaxPowerNum;
234234

235235
// define the mode value
236236
static constexpr uint8_t kModeNormal = 0u;

examples/microwave-oven-app/microwave-oven-common/src/microwave-oven-device.cpp

+3-4
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,9 @@ using namespace chip::app::Clusters::OperationalState;
2424
using namespace chip::app::Clusters::ModeBase;
2525
using namespace chip::app::Clusters::MicrowaveOvenControl;
2626
template <typename T>
27-
using List = chip::app::DataModel::List<T>;
28-
using ModeTagStructType = chip::app::Clusters::detail::Structs::ModeTagStruct::Type;
29-
using OperationalStateEnum = chip::app::Clusters::OperationalState::OperationalStateEnum;
30-
using Status = Protocols::InteractionModel::Status;
27+
using List = chip::app::DataModel::List<T>;
28+
using ModeTagStructType = chip::app::Clusters::detail::Structs::ModeTagStruct::Type;
29+
using Status = Protocols::InteractionModel::Status;
3130

3231
void ExampleMicrowaveOvenDevice::MicrowaveOvenInit()
3332
{

scripts/build/builders/host.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,8 @@ def OutputNames(self):
228228
yield 'dishwasher-app'
229229
yield 'dishwasher-app.map'
230230
elif self == HostApp.MICROWAVE_OVEN:
231-
yield 'microwave-oven-app'
232-
yield 'microwave-oven-app.map'
231+
yield 'chip-microwave-oven-app'
232+
yield 'chip-microwave-oven-app.map'
233233
elif self == HostApp.REFRIGERATOR:
234234
yield 'refrigerator-app'
235235
yield 'refrigerator-app.map'

scripts/build/gn_gen_cirque.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ echo "Setup build environment"
3636
source "./scripts/activate.sh"
3737

3838
echo "Build: GN configure"
39-
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"
39+
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"
4040

4141
echo "Build: Ninja build"
4242
time ninja -C out/debug all check

scripts/tests/chiptest/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,8 @@ def target_for_name(name: str):
299299
return TestTarget.BRIDGE
300300
if name.startswith("TestIcd") or name.startswith("Test_TC_ICDM_"):
301301
return TestTarget.LIT_ICD
302+
if name.startswith("Test_TC_MWOCTRL_") or name.startswith("Test_TC_MWOM_"):
303+
return TestTarget.MWO
302304
return TestTarget.ALL_CLUSTERS
303305

304306

scripts/tests/chiptest/linux.py

+1
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ def PathsWithNetworkNamespaces(paths: ApplicationPaths) -> ApplicationPaths:
182182
ota_requestor_app='ip netns exec app'.split() + paths.ota_requestor_app,
183183
tv_app='ip netns exec app'.split() + paths.tv_app,
184184
lit_icd_app='ip netns exec app'.split() + paths.lit_icd_app,
185+
microwave_oven_app='ip netns exec app'.split() + paths.microwave_oven_app,
185186
bridge_app='ip netns exec app'.split() + paths.bridge_app,
186187
chip_repl_yaml_tester_cmd='ip netns exec tool'.split() + paths.chip_repl_yaml_tester_cmd,
187188
chip_tool_with_python_cmd='ip netns exec tool'.split() + paths.chip_tool_with_python_cmd,

scripts/tests/chiptest/test_definition.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ class TestTarget(Enum):
175175
OTA = auto()
176176
BRIDGE = auto()
177177
LIT_ICD = auto()
178+
MWO = auto()
178179

179180

180181
@dataclass
@@ -187,12 +188,13 @@ class ApplicationPaths:
187188
tv_app: typing.List[str]
188189
bridge_app: typing.List[str]
189190
lit_icd_app: typing.List[str]
191+
microwave_oven_app: typing.List[str]
190192
chip_repl_yaml_tester_cmd: typing.List[str]
191193
chip_tool_with_python_cmd: typing.List[str]
192194

193195
def items(self):
194196
return [self.chip_tool, self.all_clusters_app, self.lock_app, self.ota_provider_app, self.ota_requestor_app,
195-
self.tv_app, self.bridge_app, self.lit_icd_app, self.chip_repl_yaml_tester_cmd, self.chip_tool_with_python_cmd]
197+
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]
196198

197199

198200
@dataclass
@@ -301,6 +303,8 @@ def Run(self, runner, apps_register, paths: ApplicationPaths, pics_file: str,
301303
target_app = paths.bridge_app
302304
elif self.target == TestTarget.LIT_ICD:
303305
target_app = paths.lit_icd_app
306+
elif self.target == TestTarget.MWO:
307+
target_app = paths.microwave_oven_app
304308
else:
305309
raise Exception("Unknown test target - "
306310
"don't know which application to run")

scripts/tests/run_test_suite.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,9 @@ def cmd_list(context):
254254
@click.option(
255255
'--lit-icd-app',
256256
help='what lit-icd app to use')
257+
@click.option(
258+
'--microwave-oven-app',
259+
help='what microwave oven app to use')
257260
@click.option(
258261
'--chip-repl-yaml-tester',
259262
help='what python script to use for running yaml tests using chip-repl as controller')
@@ -285,7 +288,7 @@ def cmd_list(context):
285288
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')
286289
@click.pass_context
287290
def cmd_run(context, iterations, all_clusters_app, lock_app, ota_provider_app, ota_requestor_app,
288-
tv_app, bridge_app, lit_icd_app, chip_repl_yaml_tester, chip_tool_with_python, pics_file, keep_going, test_timeout_seconds, expected_failures):
291+
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):
289292
if expected_failures != 0 and not keep_going:
290293
logging.exception(f"'--expected-failures {expected_failures}' used without '--keep-going'")
291294
sys.exit(2)
@@ -315,6 +318,9 @@ def cmd_run(context, iterations, all_clusters_app, lock_app, ota_provider_app, o
315318
if lit_icd_app is None:
316319
lit_icd_app = paths_finder.get('lit-icd-app')
317320

321+
if microwave_oven_app is None:
322+
microwave_oven_app = paths_finder.get('chip-microwave-oven-app')
323+
318324
if chip_repl_yaml_tester is None:
319325
chip_repl_yaml_tester = paths_finder.get('yamltest_with_chip_repl_tester.py')
320326

@@ -334,6 +340,7 @@ def cmd_run(context, iterations, all_clusters_app, lock_app, ota_provider_app, o
334340
tv_app=[tv_app],
335341
bridge_app=[bridge_app],
336342
lit_icd_app=[lit_icd_app],
343+
microwave_oven_app=[microwave_oven_app],
337344
chip_repl_yaml_tester_cmd=['python3'] + [chip_repl_yaml_tester],
338345
chip_tool_with_python_cmd=['python3'] + [chip_tool_with_python],
339346
)

src/app/clusters/microwave-oven-control-server/microwave-oven-control-server.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ void Instance::InvokeCommand(HandlerContext & handlerContext)
229229
void Instance::HandleSetCookingParameters(HandlerContext & ctx, const Commands::SetCookingParameters::DecodableType & req)
230230
{
231231
ChipLogDetail(Zcl, "Microwave Oven Control: HandleSetCookingParameters");
232-
Status status;
232+
Status status = Status::Success;
233233
uint8_t opState;
234234
uint8_t modeValue;
235235
uint8_t reqCookMode;

src/app/tests/suites/certification/PICS.yaml

+24
Original file line numberDiff line numberDiff line change
@@ -1905,6 +1905,30 @@ PICS:
19051905
"Does the device implement sending the ChangeToModeResponse command?"
19061906
id: DISHM.S.C01.Tx
19071907

1908+
#
1909+
# Microwave Oven Mode Cluster
1910+
#
1911+
- label:
1912+
"Does the device implement the Microwave Oven Mode cluster as a server"
1913+
id: MWOM.S
1914+
1915+
#
1916+
# Microwave Oven Control Cluster
1917+
#
1918+
- label:
1919+
"Does the device implement the Microwave Oven Control cluster as a
1920+
server"
1921+
id: MWOCTRL.S
1922+
1923+
#
1924+
# server / features
1925+
#
1926+
- label: "Does the device support the power as a number feature"
1927+
id: MWOCTRL.S.F00
1928+
1929+
- label: "Does the device support the power number limits feature"
1930+
id: MWOCTRL.S.F02
1931+
19081932
# Descriptor Cluster TestPlan
19091933
- label: "Does the device implement the Descriptor cluster as a server?"
19101934
id: DESC.S

0 commit comments

Comments
 (0)