Skip to content

Commit

Permalink
Matter zap cleanup (project-chip#21713)
Browse files Browse the repository at this point in the history
* Add the sdk.json for zap regeneration.

* Rework the helper infrastructure to support aliases and categories.

0. Use the common helper aliases in the template json files.
1. Update templates.json with correct reference.
2. Update another template.
3. Add resources to the templates files, so that helpers can access the yaml stuff.
4. Fix wrong paths in templates.json

* Use ZAP_PATH to run zap from other location than third_party/zap.

* Convert the tests to JSON files.

* Remove all the duplicated and unneeded js code.

* Keep tests in sync with the changes on master.

* Update zap submodule.

* Add the updates from the mainline.

* Restyled by whitespace

* Restyled by prettier-json

* Remove a manual test.

Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
2 people authored and isiu-apple committed Sep 16, 2022
1 parent c5b66a1 commit 172d025
Show file tree
Hide file tree
Showing 55 changed files with 1,132 additions and 6,831 deletions.
153 changes: 0 additions & 153 deletions examples/chip-tool/templates/helper.js

This file was deleted.

10 changes: 5 additions & 5 deletions examples/chip-tool/templates/templates.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"name": "CHIP Tool templates",
"version": "chip-v1",
"helpers": [
"../../../src/app/zap-templates/partials/helper.js",
"../../../src/app/zap-templates/common/StringHelper.js",
"../../../src/app/zap-templates/templates/app/helper.js",
"../../../src/app/zap-templates/templates/chip/helper.js",
"helper.js"
"partials/helper.js",
"common/StringHelper.js",
"templates/app/helper.js",
"templates/chip/helper.js",
"chip-tool/templates/helper.js"
],
"override": "../../../src/app/zap-templates/common/override.js",
"partials": [
Expand Down
12 changes: 6 additions & 6 deletions examples/chip-tool/templates/tests/commands.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public:
TestList() : Command("list") {};
CHIP_ERROR Run() override
{
{{#chip_tests (getTests)}}printf("{{filename}}\n");{{/chip_tests}}
{{#chip_tests "../../../../src/app/tests/suites/ciTests.json"}}printf("{{filename}}\n");{{/chip_tests}}

return CHIP_NO_ERROR;
}
Expand All @@ -29,14 +29,14 @@ public:
ManualTestList() : Command("list-manual") {};
CHIP_ERROR Run() override
{
{{#chip_tests (getManualTests)}}printf("{{filename}}\n");{{/chip_tests}}
{{#chip_tests "../../../../src/app/tests/suites/manualTests.json"}}printf("{{filename}}\n");{{/chip_tests}}

return CHIP_NO_ERROR;
}
};

{{>test_cluster tests=(getTests) credsIssuerConfigArg=true needsWaitDuration=true}}
{{>test_cluster tests=(getManualTests) credsIssuerConfigArg=true needsWaitDuration=true}}
{{>test_cluster tests="../../../../src/app/tests/suites/ciTests.json" credsIssuerConfigArg=true needsWaitDuration=true}}
{{>test_cluster tests="../../../../src/app/tests/suites/manualTests.json" credsIssuerConfigArg=true needsWaitDuration=true}}

#endif // CONFIG_ENABLE_YAML_TESTS

Expand All @@ -48,10 +48,10 @@ void registerCommandsTests(Commands & commands, CredentialIssuerCommands * creds
#if CONFIG_ENABLE_YAML_TESTS
make_unique<TestList>(),
make_unique<ManualTestList>(),
{{#chip_tests (getTests)}}
{{#chip_tests "../../../../src/app/tests/suites/ciTests.json"}}
make_unique<{{filename}}Suite>(credsIssuerConfig),
{{/chip_tests}}
{{#chip_tests (getManualTests)}}
{{#chip_tests "../../../../src/app/tests/suites/manualTests.json"}}
make_unique<{{filename}}Suite>(credsIssuerConfig),
{{/chip_tests}}
#endif // CONFIG_ENABLE_YAML_TESTS
Expand Down
109 changes: 0 additions & 109 deletions examples/chip-tool/templates/tests/helper.js

This file was deleted.

20 changes: 12 additions & 8 deletions examples/chip-tool/templates/tests/templates.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,19 @@
"name": "CHIP Tool Tests templates",
"version": "chip-v1",
"helpers": [
"../../../../src/app/zap-templates/partials/helper.js",
"../../../../src/app/zap-templates/common/StringHelper.js",
"../../../../src/app/zap-templates/templates/app/helper.js",
"../../../../src/app/zap-templates/templates/chip/helper.js",
"../../../../src/app/zap-templates/common/ClusterTestGeneration.js",
"../helper.js",
"helper.js",
"tests.js"
"partials/helper.js",
"common/StringHelper.js",
"templates/app/helper.js",
"templates/chip/helper.js",
"common/ClusterTestGeneration.js",
"chip-tool/templates/helper.js",
"chip-tool/templates/tests/helper.js"
],
"resources": {
"pics-metafile": "../../../../src/app/tests/suites/certification/PICS.yaml",
"certification-metadir": "../../../../src/app/tests/suites/certification",
"test-metadir": "../../../../src/app/tests/suites"
},
"override": "../../../../src/app/zap-templates/common/override.js",
"partials": [
{
Expand Down
35 changes: 0 additions & 35 deletions examples/chip-tool/templates/tests/tests.js

This file was deleted.

Loading

0 comments on commit 172d025

Please sign in to comment.