Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[YAML] Remove chip_tests_item_has_list helper since it is too slow and was here mostly to make the test cleaner #18627

Merged
merged 2 commits into from
May 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ class {{filename}}: public TestCommandBridge
CHIP_ERROR {{>testCommand}}()
{
{{#if (isTestOnlyCluster cluster)}}
{{#if (chip_tests_item_has_list)}}ListFreer listFreer;{{/if~}}
{{asEncodableType}} value;
{{#chip_tests_item_parameters}}
{{>commandValue ns=parent.cluster container=(asPropertyValue dontUnwrapValue=true) definedValue=definedValue depth=0}}
Expand Down
2 changes: 1 addition & 1 deletion examples/chip-tool/templates/tests/partials/test_step.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
{{~#*inline "maybePrepareArguments"}}
{{#unless isWait}}
{{#if hasSpecificArguments}}
{{#if (chip_tests_item_has_list)}}ListFreer listFreer;{{/if~}}
ListFreer listFreer;
{{asEncodableType}} value;
{{#chip_tests_item_parameters}}
{{>commandValue ns=parent.cluster container=(asPropertyValue dontUnwrapValue=true) definedValue=definedValue depth=0}}
Expand Down
2 changes: 2 additions & 0 deletions examples/placeholder/templates/tests-commands.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

#include "TestCommand.h"

#include <lib/support/CHIPListUtils.h>

{{#if (getTests)}}
{{>test_cluster tests=(getTests) credsIssuerConfigArg=false needsWaitDuration=false}}
{{/if}}
Expand Down
27 changes: 0 additions & 27 deletions src/app/zap-templates/common/ClusterTestGeneration.js
Original file line number Diff line number Diff line change
Expand Up @@ -861,32 +861,6 @@ function ensureIsArray(value, options)
}
}

function chip_tests_item_has_list(options)
{
function hasList(args)
{
for (let i = 0; i < args.length; i++) {
if (args[i].isArray) {
return true;
}

if (args[i].isStruct && hasList(args[i].items)) {
return true;
}
}

return false;
}

return assertCommandOrAttributeOrEvent(this).then(item => {
if (this.isWriteAttribute || this.isCommand) {
return hasList(item.arguments);
}

return false;
});
}

function checkIsInsideTestOnlyClusterBlock(conditions, name)
{
conditions.forEach(condition => {
Expand Down Expand Up @@ -1000,7 +974,6 @@ async function chip_tests_only_cluster_response_parameters(options)
//
exports.chip_tests = chip_tests;
exports.chip_tests_items = chip_tests_items;
exports.chip_tests_item_has_list = chip_tests_item_has_list;
exports.chip_tests_item_parameters = chip_tests_item_parameters;
exports.chip_tests_item_responses = chip_tests_item_responses;
exports.chip_tests_item_response_parameters = chip_tests_item_response_parameters;
Expand Down
1,762 changes: 1,762 additions & 0 deletions zzz_generated/chip-tool/zap-generated/test/Commands.h

Large diffs are not rendered by default.

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.