-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Make attribute-write yaml tests play nicer with complex types. #11457
Merged
bzbarsky-apple
merged 1 commit into
project-chip:master
from
bzbarsky-apple:yaml-test-attr-write-types
Nov 5, 2021
Merged
Make attribute-write yaml tests play nicer with complex types. #11457
bzbarsky-apple
merged 1 commit into
project-chip:master
from
bzbarsky-apple:yaml-test-attr-write-types
Nov 5, 2021
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pullapprove
bot
requested review from
anush-apple,
austinh0,
balducci-apple,
carol-apple,
cecille,
chrisdecenzo,
chulspro,
Damian-Nordic,
electrocucaracha,
emargolis,
franck-apple,
harimau-qirex,
hawk248,
holbrookt,
jelderton,
jepenven-silabs,
jmartinez-silabs,
kghost,
LuDuda,
mlepage-google,
msandstedt,
pan-apple,
robszewczyk,
sagar-apple and
saurabhst
November 5, 2021 02:19
pullapprove
bot
requested review from
selissia,
tcarmelveilleux,
tecimovic,
wbschiller and
woody-apple
November 5, 2021 02:19
bzbarsky-apple
force-pushed
the
yaml-test-attr-write-types
branch
from
November 5, 2021 02:21
9985410
to
cf293e1
Compare
PR #11457: Size comparison from b18ecb9 to cf293e1 Increases (1 build for linux)
Full report (38 builds for efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
|
bzbarsky-apple
force-pushed
the
yaml-test-attr-write-types
branch
from
November 5, 2021 05:08
cf293e1
to
4291916
Compare
PR #11457: Size comparison from 39ff9bf to 4291916 Increases (1 build for linux)
Full report (38 builds for efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
|
yufengwangca
reviewed
Nov 5, 2021
yufengwangca
approved these changes
Nov 5, 2021
The key change is using zapTypeToEncodableClusterObjectType to declare the type and the "commandValue" partial to set it to the given value, which is more similar to how we handle command arguments. That makes things work for lists and nullables at the very least. The ignore="true" bit is probably not very well named, but it means "just use the 'container' value as-is, instead of treating it as a struct with member that stores the value". The fix in ClusterTestGeneration.js is just fixing a typo in the "type" values there that started to matter because we pass "type" to zapTypeToEncodableClusterObjectType. The fix in ClustersHelper.js is to give our synthetic "argument" to writeAttribute the same nullability as the actual attribute, so the types we get are right, and to set isArray for lists, because our templates key off of that (especially the "commandValue" partial). The "commandValue" partial also uses the "label" when dealing with lists, so we define that for attributes to just be the attribute name. The generated code changes are all no-ops so far, because we are not actually using any types that would be affected by this yet.
bzbarsky-apple
force-pushed
the
yaml-test-attr-write-types
branch
from
November 5, 2021 17:49
4291916
to
756ef8e
Compare
PR #11457: Size comparison from 7addec8 to 756ef8e Increases (1 build for linux)
Full report (38 builds for efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
|
jmartinez-silabs
approved these changes
Nov 5, 2021
woody-apple
approved these changes
Nov 5, 2021
PSONALl
pushed a commit
to PSONALl/connectedhomeip
that referenced
this pull request
Dec 3, 2021
…ct-chip#11457) The key change is using zapTypeToEncodableClusterObjectType to declare the type and the "commandValue" partial to set it to the given value, which is more similar to how we handle command arguments. That makes things work for lists and nullables at the very least. The ignore="true" bit is probably not very well named, but it means "just use the 'container' value as-is, instead of treating it as a struct with member that stores the value". The fix in ClusterTestGeneration.js is just fixing a typo in the "type" values there that started to matter because we pass "type" to zapTypeToEncodableClusterObjectType. The fix in ClustersHelper.js is to give our synthetic "argument" to writeAttribute the same nullability as the actual attribute, so the types we get are right, and to set isArray for lists, because our templates key off of that (especially the "commandValue" partial). The "commandValue" partial also uses the "label" when dealing with lists, so we define that for attributes to just be the attribute name. The generated code changes are all no-ops so far, because we are not actually using any types that would be affected by this yet.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The key change is using zapTypeToEncodableClusterObjectType to declare
the type and the "commandValue" partial to set it to the given value,
which is more similar to how we handle command arguments. That makes
things work for lists and nullables at the very least.
The ignore="true" bit is probably not very well named, but it means
"just use the 'container' value as-is, instead of treating it as a
struct with member that stores the value".
The fix in ClusterTestGeneration.js is just fixing a typo in the
"type" values there that started to matter because we pass "type" to
zapTypeToEncodableClusterObjectType.
The fix in ClustersHelper.js is to give out synthetic "argument" to
writeAttribute the same nullability as the actual attribute, so the
types we get are right.
The generated code changes are all no-ops so far, because we are not
actually using any types that would be affected by this yet.
Problem
Trying to write a yaml test that tryies to writeAttribute with a list or null fails to generate anything resembling the right code.
Change overview
Make at least the code generation for the test succeed.
Testing
Examined generated code changes and made sure they are all ok.