Skip to content

Commit

Permalink
Add some bits to exercise global structs/enums to Unit Testing cluster.
Browse files Browse the repository at this point in the history
* Adds things to the Unit Testing cluster XML.
* This requires those things to be enabled in all-clusters-app,
  all-clusters-minimal-app, and one of the chef contact sensors to pass CI.
* That requires an implementation in test-cluster-server
* At which point might as well add a YAML test to exercise it all.
  • Loading branch information
bzbarsky-apple committed Jul 30, 2024
1 parent 2ccd653 commit e932ec3
Show file tree
Hide file tree
Showing 63 changed files with 5,149 additions and 276 deletions.
4 changes: 2 additions & 2 deletions .restyled.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ changed_paths:
# Restylers to run, and how
restylers:
- name: whitespace
enabled: true
enabled: false
image: restyled/restyler-whitespace:v0.1.0.1
command:
- whitespace
Expand Down Expand Up @@ -132,7 +132,7 @@ restylers:
- "**/*.m"
- "**/*.mm"
- name: google-java-format
enabled: true
enabled: false
# Update https://github.com/project-chip/connectedhomeip/blob/master/scripts/tools/zap/generate.py if this version changes.
image: restyled/restyler-google-java-format:v1.6
command:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6927,6 +6927,7 @@ internal cluster UnitTesting = 4294048773 {
SimpleBitmap f = 5;
single g = 6;
double h = 7;
optional TestGlobalEnum i = 8;
}

fabric_scoped struct TestFabricScoped {
Expand Down Expand Up @@ -6959,6 +6960,7 @@ internal cluster UnitTesting = 4294048773 {
int8u a = 0;
boolean b = 1;
SimpleStruct c = 2;
optional TestGlobalStruct d = 3;
}

struct NestedStructList {
Expand Down Expand Up @@ -7044,6 +7046,8 @@ internal cluster UnitTesting = 4294048773 {
timedwrite attribute boolean timedWriteBoolean = 48;
attribute boolean generalErrorBoolean = 49;
attribute boolean clusterErrorBoolean = 50;
attribute TestGlobalEnum globalEnum = 51;
attribute TestGlobalStruct globalStruct = 52;
attribute optional boolean unsupported = 255;
attribute nullable boolean nullableBoolean = 16384;
attribute nullable Bitmap8MaskMap nullableBitmap8 = 16385;
Expand Down Expand Up @@ -7079,6 +7083,8 @@ internal cluster UnitTesting = 4294048773 {
attribute nullable int16u nullableRangeRestrictedInt16u = 16424;
attribute nullable int16s nullableRangeRestrictedInt16s = 16425;
attribute optional int8u writeOnlyInt8u = 16426;
attribute nullable TestGlobalEnum nullableGlobalEnum = 16435;
attribute nullable TestGlobalStruct nullableGlobalStruct = 16436;
attribute int8u meiInt8u = 4294070017;
readonly attribute command_id generatedCommandList[] = 65528;
readonly attribute command_id acceptedCommandList[] = 65529;
Expand Down Expand Up @@ -7230,6 +7236,11 @@ internal cluster UnitTesting = 4294048773 {
SimpleEnum arg2 = 1;
}

response struct GlobalEchoResponse = 14 {
TestGlobalStruct field1 = 0;
TestGlobalEnum field2 = 1;
}

request struct TestNullableOptionalRequestRequest {
optional nullable int8u arg1 = 0;
}
Expand Down Expand Up @@ -7283,6 +7294,11 @@ internal cluster UnitTesting = 4294048773 {
octet_string payload = 0;
}

request struct GlobalEchoRequestRequest {
TestGlobalStruct field1 = 0;
TestGlobalEnum field2 = 1;
}

request struct TestDifferentVendorMeiRequestRequest {
int8u arg1 = 0;
}
Expand Down Expand Up @@ -7366,6 +7382,9 @@ internal cluster UnitTesting = 4294048773 {
the string back. If the string is large then it would require a session that
supports large payloads. */
command StringEchoRequest(StringEchoRequestRequest): StringEchoResponse = 24;
/** Command that takes arguments that are global structs/enums and the
response just echoes them back. */
command GlobalEchoRequest(GlobalEchoRequestRequest): GlobalEchoResponse = 25;
/** Command having a different MEI vendor ID than the cluster. Also emits TestDifferentVendorMeiEvent. */
command TestDifferentVendorMeiRequest(TestDifferentVendorMeiRequestRequest): TestDifferentVendorMeiResponse = 4294049962;
}
Expand Down Expand Up @@ -9252,6 +9271,8 @@ endpoint 1 {
ram attribute timedWriteBoolean;
callback attribute generalErrorBoolean;
callback attribute clusterErrorBoolean;
ram attribute globalEnum;
callback attribute globalStruct;
ram attribute nullableBoolean default = false;
ram attribute nullableBitmap8 default = 0;
ram attribute nullableBitmap16 default = 0;
Expand Down Expand Up @@ -9286,6 +9307,8 @@ endpoint 1 {
ram attribute nullableRangeRestrictedInt16u default = 200;
ram attribute nullableRangeRestrictedInt16s default = -100;
callback attribute writeOnlyInt8u default = 0;
ram attribute nullableGlobalEnum;
callback attribute nullableGlobalStruct;
ram attribute featureMap default = 0;
ram attribute clusterRevision default = 1;
ram attribute meiInt8u default = 0;
Expand All @@ -9311,6 +9334,7 @@ endpoint 1 {
handle command TestListInt8UReverseRequest;
handle command StringEchoResponse;
handle command TestEnumsRequest;
handle command GlobalEchoResponse;
handle command TestNullableOptionalRequest;
handle command SimpleStructEchoRequest;
handle command TimedInvokeRequest;
Expand All @@ -9320,6 +9344,7 @@ endpoint 1 {
handle command TestBatchHelperRequest;
handle command TestSecondBatchHelperRequest;
handle command StringEchoRequest;
handle command GlobalEchoRequest;
handle command TestDifferentVendorMeiRequest;
handle command TestDifferentVendorMeiResponse;
}
Expand Down
80 changes: 80 additions & 0 deletions examples/all-clusters-app/all-clusters-common/all-clusters-app.zap
Original file line number Diff line number Diff line change
Expand Up @@ -22229,6 +22229,14 @@
"isIncoming": 1,
"isEnabled": 1
},
{
"name": "GlobalEchoResponse",
"code": 14,
"mfgCode": null,
"source": "server",
"isIncoming": 0,
"isEnabled": 1
},
{
"name": "TestNullableOptionalRequest",
"code": 15,
Expand Down Expand Up @@ -22301,6 +22309,14 @@
"isIncoming": 1,
"isEnabled": 1
},
{
"name": "GlobalEchoRequest",
"code": 25,
"mfgCode": null,
"source": "client",
"isIncoming": 1,
"isEnabled": 1
},
{
"name": "TestDifferentVendorMeiRequest",
"code": 4294049962,
Expand Down Expand Up @@ -23071,6 +23087,38 @@
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "global_enum",
"code": 51,
"mfgCode": null,
"side": "server",
"type": "TestGlobalEnum",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "global_struct",
"code": 52,
"mfgCode": null,
"side": "server",
"type": "TestGlobalStruct",
"included": 1,
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": null,
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "nullable_boolean",
"code": 16384,
Expand Down Expand Up @@ -23615,6 +23663,38 @@
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "nullable_global_enum",
"code": 16435,
"mfgCode": null,
"side": "server",
"type": "TestGlobalEnum",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "nullable_global_struct",
"code": 16436,
"mfgCode": null,
"side": "server",
"type": "TestGlobalStruct",
"included": 1,
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": null,
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "FeatureMap",
"code": 65532,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5518,6 +5518,7 @@ internal cluster UnitTesting = 4294048773 {
SimpleBitmap f = 5;
single g = 6;
double h = 7;
optional TestGlobalEnum i = 8;
}

fabric_scoped struct TestFabricScoped {
Expand Down Expand Up @@ -5550,6 +5551,7 @@ internal cluster UnitTesting = 4294048773 {
int8u a = 0;
boolean b = 1;
SimpleStruct c = 2;
optional TestGlobalStruct d = 3;
}

struct NestedStructList {
Expand Down Expand Up @@ -5635,6 +5637,8 @@ internal cluster UnitTesting = 4294048773 {
timedwrite attribute boolean timedWriteBoolean = 48;
attribute boolean generalErrorBoolean = 49;
attribute boolean clusterErrorBoolean = 50;
attribute TestGlobalEnum globalEnum = 51;
attribute TestGlobalStruct globalStruct = 52;
attribute optional boolean unsupported = 255;
attribute nullable boolean nullableBoolean = 16384;
attribute nullable Bitmap8MaskMap nullableBitmap8 = 16385;
Expand Down Expand Up @@ -5670,6 +5674,8 @@ internal cluster UnitTesting = 4294048773 {
attribute nullable int16u nullableRangeRestrictedInt16u = 16424;
attribute nullable int16s nullableRangeRestrictedInt16s = 16425;
attribute optional int8u writeOnlyInt8u = 16426;
attribute nullable TestGlobalEnum nullableGlobalEnum = 16435;
attribute nullable TestGlobalStruct nullableGlobalStruct = 16436;
attribute int8u meiInt8u = 4294070017;
readonly attribute command_id generatedCommandList[] = 65528;
readonly attribute command_id acceptedCommandList[] = 65529;
Expand Down Expand Up @@ -5821,6 +5827,11 @@ internal cluster UnitTesting = 4294048773 {
SimpleEnum arg2 = 1;
}

response struct GlobalEchoResponse = 14 {
TestGlobalStruct field1 = 0;
TestGlobalEnum field2 = 1;
}

request struct TestNullableOptionalRequestRequest {
optional nullable int8u arg1 = 0;
}
Expand Down Expand Up @@ -5874,6 +5885,11 @@ internal cluster UnitTesting = 4294048773 {
octet_string payload = 0;
}

request struct GlobalEchoRequestRequest {
TestGlobalStruct field1 = 0;
TestGlobalEnum field2 = 1;
}

request struct TestDifferentVendorMeiRequestRequest {
int8u arg1 = 0;
}
Expand Down Expand Up @@ -5957,6 +5973,9 @@ internal cluster UnitTesting = 4294048773 {
the string back. If the string is large then it would require a session that
supports large payloads. */
command StringEchoRequest(StringEchoRequestRequest): StringEchoResponse = 24;
/** Command that takes arguments that are global structs/enums and the
response just echoes them back. */
command GlobalEchoRequest(GlobalEchoRequestRequest): GlobalEchoResponse = 25;
/** Command having a different MEI vendor ID than the cluster. Also emits TestDifferentVendorMeiEvent. */
command TestDifferentVendorMeiRequest(TestDifferentVendorMeiRequestRequest): TestDifferentVendorMeiResponse = 4294049962;
}
Expand Down Expand Up @@ -6818,6 +6837,8 @@ endpoint 1 {
ram attribute timedWriteBoolean;
callback attribute generalErrorBoolean;
callback attribute clusterErrorBoolean;
ram attribute globalEnum;
callback attribute globalStruct;
ram attribute nullableBoolean default = false;
ram attribute nullableBitmap8 default = 0;
ram attribute nullableBitmap16 default = 0;
Expand Down Expand Up @@ -6852,6 +6873,8 @@ endpoint 1 {
ram attribute nullableRangeRestrictedInt16u default = 200;
ram attribute nullableRangeRestrictedInt16s default = -100;
callback attribute writeOnlyInt8u default = 0;
ram attribute nullableGlobalEnum;
callback attribute nullableGlobalStruct;
ram attribute featureMap default = 0;
ram attribute clusterRevision default = 1;
ram attribute meiInt8u default = 0;
Expand All @@ -6877,6 +6900,7 @@ endpoint 1 {
handle command TestListInt8UReverseRequest;
handle command StringEchoResponse;
handle command TestEnumsRequest;
handle command GlobalEchoResponse;
handle command TestNullableOptionalRequest;
handle command SimpleStructEchoRequest;
handle command TimedInvokeRequest;
Expand All @@ -6886,6 +6910,7 @@ endpoint 1 {
handle command TestBatchHelperRequest;
handle command TestSecondBatchHelperRequest;
handle command StringEchoRequest;
handle command GlobalEchoRequest;
handle command TestDifferentVendorMeiRequest;
handle command TestDifferentVendorMeiResponse;
}
Expand Down
Loading

0 comments on commit e932ec3

Please sign in to comment.