Skip to content

Commit

Permalink
[Simulated Device] Print the list of available test commands if the c…
Browse files Browse the repository at this point in the history
…ommand is unknown (project-chip#13529)

* [Simulated Device] Print the list of available test commands if the command is unknown

* Update generated simulated device code
  • Loading branch information
vivien-apple authored and step0035 committed Feb 8, 2022
1 parent bc578d0 commit 892cf8b
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions examples/placeholder/linux/include/MatterCallbacks.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ TestCommand * GetTargetTest()
if (test.get() == nullptr)
{
ChipLogError(chipTool, "Specified test command does not exist: %s", command);
PrintTestCommands();
return nullptr;
}

Expand Down
14 changes: 14 additions & 0 deletions examples/placeholder/templates/tests-commands.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,17 @@ std::unique_ptr<TestCommand>GetTestCommand(std::string testName)

return nullptr;
}

void PrintTestCommands()
{
{{#if (getTests)}}
{{#chip_tests (getTests)}}
{{#first}}
ChipLogError(chipTool, "Supported commands:");
{{/first}}
ChipLogError(chipTool, "\t* {{filename}}");
{{else}}
ChipLogError("\t No available commands.");
{{/chip_tests}}
{{/if}}
}
6 changes: 6 additions & 0 deletions zzz_generated/placeholder/app1/zap-generated/test/Commands.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions zzz_generated/placeholder/app2/zap-generated/test/Commands.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file.

0 comments on commit 892cf8b

Please sign in to comment.