Skip to content

Commit

Permalink
[YAML] Remove chip_tests_item_has_list helper since it is too slow an…
Browse files Browse the repository at this point in the history
…d was here mostly to make the test cleaner (#18627)
  • Loading branch information
vivien-apple authored May 20, 2022
1 parent a1e7fa3 commit d346617
Show file tree
Hide file tree
Showing 7 changed files with 1,777 additions and 29 deletions.
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.

0 comments on commit d346617

Please sign in to comment.