Skip to content

Commit

Permalink
[YAML] Update TestCommand.cpp so it does not automatically wait for t…
Browse files Browse the repository at this point in the history
…he device to be retrieved but do it conditionally if WaitForCommissionee is used in the test (#11833)

* Update TestCommand.cpp so it does not automatically wait for the device to be retrieved but do it conditionally if WaitForCommissionee is used in the test

* Update the tests to use the WaitForCommissionee step

* [Darwin] Add WaitForCommissionee support in tests

* Update generated tests code
  • Loading branch information
vivien-apple authored and pull[bot] committed Jul 14, 2023
1 parent d118f04 commit 4179939
Show file tree
Hide file tree
Showing 120 changed files with 17,962 additions and 13,203 deletions.
16 changes: 12 additions & 4 deletions examples/chip-tool/commands/tests/TestCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,18 @@
#include "TestCommand.h"

CHIP_ERROR TestCommand::RunCommand()
{
if (mPICSFilePath.HasValue())
{
PICS.SetValue(PICSBooleanReader::Read(mPICSFilePath.Value()));
}

NextTest();

return CHIP_NO_ERROR;
}

CHIP_ERROR TestCommand::WaitForCommissionee()
{
return CurrentCommissioner().GetConnectedDevice(mNodeId, &mOnDeviceConnectedCallback, &mOnDeviceConnectionFailureCallback);
}
Expand All @@ -30,10 +42,6 @@ void TestCommand::OnDeviceConnectedFn(void * context, chip::OperationalDevicePro
VerifyOrReturn(command != nullptr, ChipLogError(chipTool, "Device connected, but cannot run the test, as the context is null"));
command->mDevice = device;

if (command->mPICSFilePath.HasValue())
{
command->PICS.SetValue(PICSBooleanReader::Read(command->mPICSFilePath.Value()));
}
command->NextTest();
}

Expand Down
4 changes: 4 additions & 0 deletions src/app/tests/suites/TV_AccountLoginCluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ config:
endpoint: 3

tests:
- label: "Wait for the commissioned device to be retrieved"
cluster: "DelayCommands"
command: "WaitForCommissionee"

- label: "Get Setup PIN Command"
command: "GetSetupPIN"
arguments:
Expand Down
4 changes: 4 additions & 0 deletions src/app/tests/suites/TV_ApplicationBasicCluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ config:
endpoint: 3

tests:
- label: "Wait for the commissioned device to be retrieved"
cluster: "DelayCommands"
command: "WaitForCommissionee"

- label: "Change Status Command"
command: "ChangeStatus"
arguments:
Expand Down
4 changes: 4 additions & 0 deletions src/app/tests/suites/TV_ApplicationLauncherCluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ config:
endpoint: 1

tests:
- label: "Wait for the commissioned device to be retrieved"
cluster: "DelayCommands"
command: "WaitForCommissionee"

- label: "Read attribute Application Launcher list"
command: "readAttribute"
attribute: "Application Launcher List"
Expand Down
4 changes: 4 additions & 0 deletions src/app/tests/suites/TV_AudioOutputCluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ config:
endpoint: 2

tests:
- label: "Wait for the commissioned device to be retrieved"
cluster: "DelayCommands"
command: "WaitForCommissionee"

- label: "Read attribute Audio Output list"
command: "readAttribute"
attribute: "Audio Output List"
Expand Down
4 changes: 4 additions & 0 deletions src/app/tests/suites/TV_KeypadInputCluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ config:
endpoint: 1

tests:
- label: "Wait for the commissioned device to be retrieved"
cluster: "DelayCommands"
command: "WaitForCommissionee"

- label: "Send Key Command"
command: "SendKey"
arguments:
Expand Down
4 changes: 4 additions & 0 deletions src/app/tests/suites/TV_LowPowerCluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,9 @@ config:
endpoint: 1

tests:
- label: "Wait for the commissioned device to be retrieved"
cluster: "DelayCommands"
command: "WaitForCommissionee"

- label: "Sleep Input Status Command"
command: "Sleep"
4 changes: 4 additions & 0 deletions src/app/tests/suites/TV_MediaInputCluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ config:
endpoint: 1

tests:
- label: "Wait for the commissioned device to be retrieved"
cluster: "DelayCommands"
command: "WaitForCommissionee"

- label: "Read attribute media input list"
command: "readAttribute"
attribute: "media input list"
Expand Down
4 changes: 4 additions & 0 deletions src/app/tests/suites/TV_MediaPlaybackCluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ config:
endpoint: 3

tests:
- label: "Wait for the commissioned device to be retrieved"
cluster: "DelayCommands"
command: "WaitForCommissionee"

- label: "Media Playback Play Command"
command: "MediaPlay"
response:
Expand Down
4 changes: 4 additions & 0 deletions src/app/tests/suites/TV_TargetNavigatorCluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ config:
endpoint: 1

tests:
- label: "Wait for the commissioned device to be retrieved"
cluster: "DelayCommands"
command: "WaitForCommissionee"

- label: "Read attribute Target Navigator list"
command: "readAttribute"
attribute: "Target Navigator List"
Expand Down
4 changes: 4 additions & 0 deletions src/app/tests/suites/TV_TvChannelCluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ config:
endpoint: 1

tests:
- label: "Wait for the commissioned device to be retrieved"
cluster: "DelayCommands"
command: "WaitForCommissionee"

- label: "Read attribute TV Channel list"
command: "readAttribute"
attribute: "TV Channel list"
Expand Down
4 changes: 4 additions & 0 deletions src/app/tests/suites/TV_WakeOnLanCluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ config:
endpoint: 1

tests:
- label: "Wait for the commissioned device to be retrieved"
cluster: "DelayCommands"
command: "WaitForCommissionee"

- label: "Read mac address"
command: "readAttribute"
attribute: "wake on lan mac address"
Expand Down
4 changes: 4 additions & 0 deletions src/app/tests/suites/TestBasicInformation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ config:
endpoint: 0

tests:
- label: "Wait for the commissioned device to be retrieved"
cluster: "DelayCommands"
command: "WaitForCommissionee"

- label: "Read location"
command: "readAttribute"
attribute: "location"
Expand Down
4 changes: 4 additions & 0 deletions src/app/tests/suites/TestCluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ config:
endpoint: 1

tests:
- label: "Wait for the commissioned device to be retrieved"
cluster: "DelayCommands"
command: "WaitForCommissionee"

- label: "Send Test Command"
command: "test"

Expand Down
4 changes: 4 additions & 0 deletions src/app/tests/suites/TestClusterComplexTypes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ config:
endpoint: 1

tests:
- label: "Wait for the commissioned device to be retrieved"
cluster: "DelayCommands"
command: "WaitForCommissionee"

- label: "Send Test Command with optional arg set to null."
# Not in TestCluster.yaml for now because this test depends on
# distinguishing "null" and "not sent" for a nullable+optional
Expand Down
4 changes: 4 additions & 0 deletions src/app/tests/suites/TestConstraints.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ config:
endpoint: 1

tests:
- label: "Wait for the commissioned device to be retrieved"
cluster: "DelayCommands"
command: "WaitForCommissionee"

# Tests for INT32U attribute

- label: "Write attribute INT32U Value"
Expand Down
4 changes: 4 additions & 0 deletions src/app/tests/suites/TestDelayCommands.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ config:
endpoint: 1

tests:
- label: "Wait for the commissioned device to be retrieved"
cluster: "DelayCommands"
command: "WaitForCommissionee"

- label: "Wait 100ms"
cluster: "DelayCommands"
command: "WaitForMs"
Expand Down
4 changes: 4 additions & 0 deletions src/app/tests/suites/TestDescriptorCluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ config:
endpoint: 0

tests:
- label: "Wait for the commissioned device to be retrieved"
cluster: "DelayCommands"
command: "WaitForCommissionee"

- label: "Read attribute Device list"
command: "readAttribute"
attribute: "Device List"
Expand Down
4 changes: 4 additions & 0 deletions src/app/tests/suites/TestGroupMessaging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ config:
endpoint: 0

tests:
- label: "Wait for the commissioned device to be retrieved"
cluster: "DelayCommands"
command: "WaitForCommissionee"

#TODO : Add Group membership command when implemented Issue #11077
# - label: "Add device to Group"
# command: "TODO"
Expand Down
4 changes: 4 additions & 0 deletions src/app/tests/suites/TestGroupsCluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ config:
endpoint: 1

tests:
- label: "Wait for the commissioned device to be retrieved"
cluster: "DelayCommands"
command: "WaitForCommissionee"

- label: "View Group 0 (invalid)"
command: "ViewGroup"
arguments:
Expand Down
4 changes: 4 additions & 0 deletions src/app/tests/suites/TestIdentifyCluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ config:
endpoint: 0

tests:
- label: "Wait for the commissioned device to be retrieved"
cluster: "DelayCommands"
command: "WaitForCommissionee"

- label: "Send Identify command and expect success response"
command: "identify"
arguments:
Expand Down
4 changes: 4 additions & 0 deletions src/app/tests/suites/TestLogCommands.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ config:
endpoint: 1

tests:
- label: "Wait for the commissioned device to be retrieved"
cluster: "DelayCommands"
command: "WaitForCommissionee"

- label: "Log a simple message"
cluster: "LogCommands"
command: "Log"
Expand Down
4 changes: 4 additions & 0 deletions src/app/tests/suites/TestModeSelectCluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ config:
endpoint: 1

tests:
- label: "Wait for the commissioned device to be retrieved"
cluster: "DelayCommands"
command: "WaitForCommissionee"

- label: "Read CurrentMode"
command: "readAttribute"
attribute: "CurrentMode"
Expand Down
4 changes: 4 additions & 0 deletions src/app/tests/suites/TestOperationalCredentialsCluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ config:
endpoint: 0

tests:
- label: "Wait for the commissioned device to be retrieved"
cluster: "DelayCommands"
command: "WaitForCommissionee"

- label: "Read number of supported fabrics"
command: "readAttribute"
attribute: "SupportedFabrics"
Expand Down
4 changes: 4 additions & 0 deletions src/app/tests/suites/TestSaveAs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ config:
endpoint: 1

tests:
- label: "Wait for the commissioned device to be retrieved"
cluster: "DelayCommands"
command: "WaitForCommissionee"

- label: "Send Test Add Arguments Command"
command: "testAddArguments"
arguments:
Expand Down
4 changes: 4 additions & 0 deletions src/app/tests/suites/TestSubscribe_OnOff.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ config:
endpoint: 1

tests:
- label: "Wait for the commissioned device to be retrieved"
cluster: "DelayCommands"
command: "WaitForCommissionee"

- label: "Set OnOff Attribute to false"
command: "Off"

Expand Down
4 changes: 4 additions & 0 deletions src/app/tests/suites/certification/Test_TC_BI_1_1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ config:
endpoint: 1

tests:
- label: "Wait for the commissioned device to be retrieved"
cluster: "DelayCommands"
command: "WaitForCommissionee"

- label: "read the global attribute: ClusterRevision"
command: "readAttribute"
attribute: "ClusterRevision"
Expand Down
4 changes: 4 additions & 0 deletions src/app/tests/suites/certification/Test_TC_BI_2_1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ config:
endpoint: 1

tests:
- label: "Wait for the commissioned device to be retrieved"
cluster: "DelayCommands"
command: "WaitForCommissionee"

- label: "Read mandatory non-global attribute: OutOfService"
command: "readAttribute"
attribute: "out of service"
Expand Down
4 changes: 4 additions & 0 deletions src/app/tests/suites/certification/Test_TC_BI_2_2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ config:
endpoint: 1

tests:
- label: "Wait for the commissioned device to be retrieved"
cluster: "DelayCommands"
command: "WaitForCommissionee"

- label: "Reads PresentValue attribute from DUT"
command: "readAttribute"
attribute: "present value"
Expand Down
4 changes: 4 additions & 0 deletions src/app/tests/suites/certification/Test_TC_BOOL_1_1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ config:
endpoint: 1

tests:
- label: "Wait for the commissioned device to be retrieved"
cluster: "DelayCommands"
command: "WaitForCommissionee"

- label: "read the global attribute: ClusterRevision"
command: "readAttribute"
attribute: "ClusterRevision"
Expand Down
4 changes: 4 additions & 0 deletions src/app/tests/suites/certification/Test_TC_BOOL_2_1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ config:
endpoint: 1

tests:
- label: "Wait for the commissioned device to be retrieved"
cluster: "DelayCommands"
command: "WaitForCommissionee"

- label: "Read mandatory non-global attribute: StateValue"
command: "readAttribute"
attribute: "StateValue"
Expand Down
4 changes: 4 additions & 0 deletions src/app/tests/suites/certification/Test_TC_CC_1_1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ config:
endpoint: 1

tests:
- label: "Wait for the commissioned device to be retrieved"
cluster: "DelayCommands"
command: "WaitForCommissionee"

- label: "read the global attribute: ClusterRevision"
disabled: true
command: "readAttribute"
Expand Down
4 changes: 4 additions & 0 deletions src/app/tests/suites/certification/Test_TC_CC_2_1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ config:
endpoint: 1

tests:
- label: "Wait for the commissioned device to be retrieved"
cluster: "DelayCommands"
command: "WaitForCommissionee"

- label: "Reads mandatory attribute: CurrentHue"
command: "readAttribute"
attribute: "current hue"
Expand Down
4 changes: 4 additions & 0 deletions src/app/tests/suites/certification/Test_TC_CC_3_1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ config:
endpoint: 1

tests:
- label: "Wait for the commissioned device to be retrieved"
cluster: "DelayCommands"
command: "WaitForCommissionee"

- label: "Turn on light for color control tests"
cluster: "On/Off"
command: "on"
Expand Down
Loading

0 comments on commit 4179939

Please sign in to comment.