Skip to content

Commit

Permalink
[YAML] Get nodeId to be an optional parameter for tests (#15072)
Browse files Browse the repository at this point in the history
* [YAML] Get NodeId to be an optional parameter of the test run

* [YAML] Update the tests to have a nodeId optional parameters, and to use it into WaitForCommissionee

* [YAML] Update src/darwin/Framework/CHIP test template

* Update generated code
  • Loading branch information
vivien-apple authored and pull[bot] committed Oct 6, 2023
1 parent a0b6c21 commit 749c15c
Show file tree
Hide file tree
Showing 171 changed files with 1,366 additions and 294 deletions.
6 changes: 3 additions & 3 deletions examples/chip-tool/commands/tests/TestCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ CHIP_ERROR TestCommand::RunCommand()
return CHIP_NO_ERROR;
}

CHIP_ERROR TestCommand::WaitForCommissionee()
CHIP_ERROR TestCommand::WaitForCommissionee(chip::NodeId nodeId)
{
CurrentCommissioner().ReleaseOperationalDevice(mNodeId);
return CurrentCommissioner().GetConnectedDevice(mNodeId, &mOnDeviceConnectedCallback, &mOnDeviceConnectionFailureCallback);
CurrentCommissioner().ReleaseOperationalDevice(nodeId);
return CurrentCommissioner().GetConnectedDevice(nodeId, &mOnDeviceConnectedCallback, &mOnDeviceConnectionFailureCallback);
}

void TestCommand::OnDeviceConnectedFn(void * context, chip::OperationalDeviceProxy * device)
Expand Down
5 changes: 1 addition & 4 deletions examples/chip-tool/commands/tests/TestCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ class TestCommand : public CHIPCommand,
CHIPCommand(commandName, credsIssuerConfig), mOnDeviceConnectedCallback(OnDeviceConnectedFn, this),
mOnDeviceConnectionFailureCallback(OnDeviceConnectionFailureFn, this)
{
AddArgument("node-id", 0, UINT64_MAX, &mNodeId);
AddArgument("delayInMs", 0, UINT64_MAX, &mDelayInMs);
AddArgument("PICS", &mPICSFilePath);
}
Expand All @@ -60,11 +59,10 @@ class TestCommand : public CHIPCommand,

protected:
/////////// DelayCommands Interface /////////
CHIP_ERROR WaitForCommissionee() override;
CHIP_ERROR WaitForCommissionee(chip::NodeId nodeId) override;
void OnWaitForMs() override { NextTest(); };

std::map<std::string, ChipDevice *> mDevices;
chip::NodeId mNodeId;

static void OnDeviceConnectedFn(void * context, chip::OperationalDeviceProxy * device);
static void OnDeviceConnectionFailureFn(void * context, PeerId peerId, CHIP_ERROR error);
Expand All @@ -87,6 +85,5 @@ class TestCommand : public CHIPCommand,
};
chip::Optional<uint64_t> mDelayInMs;
chip::Optional<char *> mPICSFilePath;
chip::Optional<chip::EndpointId> mEndpointId;
chip::Optional<uint16_t> mTimeout;
};
2 changes: 1 addition & 1 deletion scripts/tests/chiptest/test_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ def Run(self, runner, apps_register, paths: ApplicationPaths):
runner.RunSubprocess(tool_cmd + ['pairing', 'qrcode', TEST_NODE_ID, app.setupCode],
name='PAIR', dependencies=[apps_register])

runner.RunSubprocess(tool_cmd + ['tests', self.run_name, TEST_NODE_ID],
runner.RunSubprocess(tool_cmd + ['tests', self.run_name],
name='TEST', dependencies=[apps_register])
except:
logging.error("!!!!!!!!!!!!!!!!!!!! ERROR !!!!!!!!!!!!!!!!!!!!!!")
Expand Down
5 changes: 5 additions & 0 deletions src/app/tests/suites/DL_LockUnlock.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,18 @@
name: Door Lock Cluster Lock/Unlock tests

config:
nodeId: 0x12344321
cluster: "Door Lock"
endpoint: 1

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

- label: "Create new PIN credential and lock/unlock user"
command: "SetCredential"
Expand Down
5 changes: 5 additions & 0 deletions src/app/tests/suites/DL_Schedules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,18 @@
name: Door Lock Cluster Schedules tests

config:
nodeId: 0x12344321
cluster: "Door Lock"
endpoint: 1

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

- label: "Create new PIN credential and schedule user"
command: "SetCredential"
Expand Down
5 changes: 5 additions & 0 deletions src/app/tests/suites/DL_UsersAndCredentials.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,18 @@
name: Door Lock Cluster Users and Credentials tests

config:
nodeId: 0x12344321
cluster: "Door Lock"
endpoint: 1

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

- label: "Read available user slot and verify response fields"
command: "GetUser"
Expand Down
5 changes: 5 additions & 0 deletions src/app/tests/suites/TV_AccountLoginCluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,18 @@
name: Account Login Cluster Tests

config:
nodeId: 0x12344321
cluster: "Account Login"
endpoint: 3

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

- label: "Get Setup PIN Command"
command: "getSetupPINRequest"
Expand Down
5 changes: 5 additions & 0 deletions src/app/tests/suites/TV_ApplicationBasicCluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,18 @@
name: Application Basic Cluster Tests

config:
nodeId: 0x12344321
cluster: "Application Basic"
endpoint: 3

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

# TODO(#14054): Support chars validation
- label: "Read attribute vendor name"
Expand Down
5 changes: 5 additions & 0 deletions src/app/tests/suites/TV_ApplicationLauncherCluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,18 @@
name: Application Launcher Cluster Tests

config:
nodeId: 0x12344321
cluster: "Application Launcher"
endpoint: 1

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

- label: "Read attribute Application Launcher list"
command: "readAttribute"
Expand Down
5 changes: 5 additions & 0 deletions src/app/tests/suites/TV_AudioOutputCluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,18 @@
name: Audio Output Cluster Tests

config:
nodeId: 0x12344321
cluster: "Audio Output"
endpoint: 2

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

- label: "Read attribute Audio Output list"
command: "readAttribute"
Expand Down
5 changes: 5 additions & 0 deletions src/app/tests/suites/TV_ChannelCluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,18 @@
name: Channel Cluster Tests

config:
nodeId: 0x12344321
cluster: "Channel"
endpoint: 1

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

- label: "Read attribute Channel list"
command: "readAttribute"
Expand Down
5 changes: 5 additions & 0 deletions src/app/tests/suites/TV_ContentLauncherCluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,18 @@
name: Content Launcher Cluster Tests

config:
nodeId: 0x12344321
cluster: "Content Launcher"
endpoint: 1

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

- label: "Read attribute accept header list"
command: "readAttribute"
Expand Down
5 changes: 5 additions & 0 deletions src/app/tests/suites/TV_KeypadInputCluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,18 @@
name: Keypad Input Cluster Tests

config:
nodeId: 0x12344321
cluster: "Keypad Input"
endpoint: 1

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

- label: "Send Key Command"
command: "sendKeyRequest"
Expand Down
5 changes: 5 additions & 0 deletions src/app/tests/suites/TV_LowPowerCluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,18 @@
name: Low Power Cluster Tests

config:
nodeId: 0x12344321
cluster: "Low Power"
endpoint: 1

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

- label: "Sleep Input Status Command"
command: "sleep"
5 changes: 5 additions & 0 deletions src/app/tests/suites/TV_MediaInputCluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,18 @@
name: Media Input Cluster Tests

config:
nodeId: 0x12344321
cluster: "Media Input"
endpoint: 1

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

- label: "Read attribute media input list"
command: "readAttribute"
Expand Down
5 changes: 5 additions & 0 deletions src/app/tests/suites/TV_MediaPlaybackCluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,18 @@
name: Media Playback Cluster Tests

config:
nodeId: 0x12344321
cluster: "Media Playback"
endpoint: 3

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

- label: "Read attribute playback state"
command: "readAttribute"
Expand Down
5 changes: 5 additions & 0 deletions src/app/tests/suites/TV_TargetNavigatorCluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,18 @@
name: Target Navigator Cluster Tests

config:
nodeId: 0x12344321
cluster: "Target Navigator"
endpoint: 1

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

- label: "Read attribute Target Navigator list"
command: "readAttribute"
Expand Down
5 changes: 5 additions & 0 deletions src/app/tests/suites/TV_WakeOnLanCluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,18 @@
name: Wake on LAN Cluster Tests

config:
nodeId: 0x12344321
cluster: "Wake on LAN"
endpoint: 1

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

- label: "Read mac address"
command: "readAttribute"
Expand Down
5 changes: 5 additions & 0 deletions src/app/tests/suites/TestBasicInformation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,18 @@
name: Basic Information Cluster Tests

config:
nodeId: 0x12344321
cluster: "Basic"
endpoint: 0

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

- label: "Read location"
command: "readAttribute"
Expand Down
5 changes: 5 additions & 0 deletions src/app/tests/suites/TestCluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,18 @@
name: Test Cluster Tests

config:
nodeId: 0x12344321
cluster: "Test Cluster"
endpoint: 1

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

- label: "Send Test Command"
command: "test"
Expand Down
5 changes: 5 additions & 0 deletions src/app/tests/suites/TestClusterComplexTypes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,18 @@
name: Test Cluster Complex Types Tests

config:
nodeId: 0x12344321
cluster: "Test Cluster"
endpoint: 1

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

- label: "Send Test Command with optional arg set to null."
# Not in TestCluster.yaml for now because this test depends on
Expand Down
Loading

0 comments on commit 749c15c

Please sign in to comment.