Skip to content

Commit

Permalink
[YAML] Update templates to get DL_UsersAndCredentials and DL_Schedule…
Browse files Browse the repository at this point in the history
…s to work under chip-tool-darwin (#17949)
  • Loading branch information
vivien-apple authored and pull[bot] committed Jan 2, 2024
1 parent 0d1beb0 commit 57d9848
Show file tree
Hide file tree
Showing 12 changed files with 9,137 additions and 379 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/darwin-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ jobs:
"./scripts/build/build_examples.py \
--target darwin-x64-chip-tool-darwin-${BUILD_VARIANT} \
--target darwin-x64-all-clusters-${BUILD_VARIANT} \
--target darwin-x64-lock-${BUILD_VARIANT} \
build \
--copy-artifacts-to objdir-clone \
"
Expand All @@ -97,10 +98,11 @@ jobs:
./scripts/run_in_build_env.sh \
"./scripts/tests/run_test_suite.py \
--chip-tool ./out/darwin-x64-chip-tool-darwin-${BUILD_VARIANT}/chip-tool-darwin \
--target-skip-glob '{TestGroupMessaging,TV_*,DL_*}' \
--target-skip-glob '{TestGroupMessaging,TV_*}' \
run \
--iterations 1 \
--all-clusters-app ./out/darwin-x64-all-clusters-${BUILD_VARIANT}/chip-all-clusters-app \
--lock-app ./out/darwin-x64-lock-${BUILD_VARIANT}/chip-lock-app \
"
- name: Uploading core files
uses: actions/upload-artifact@v2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
{{~#if (chip_tests_variables_has expected)}}{{expected}}
{{~else if (isOctetString type)}}[[NSData alloc] initWithBytes:"{{octetStringEscapedForCLiteral expected}}" length:{{expected.length}}]
{{~else if (isCharString type)}}@"{{expected}}"
{{~else}}{{asTypedLiteral expected type}}
{{~else}}{{asTypedExpressionFromObjectiveC expected type}}
{{~/if}}));
{{/if_is_struct}}
{{/if}}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@
{{else if (isOctetString type)}}
{{target}} = [[NSData alloc] initWithBytes:"{{octetStringEscapedForCLiteral definedValue}}" length:{{definedValue.length}}];
{{else}}
{{target}} = [NSNumber numberWith{{asObjectiveCNumberType definedValue type false}}:{{asTypedLiteral definedValue type}}];
{{target}} = [NSNumber numberWith{{asObjectiveCNumberType definedValue type false}}:{{asTypedExpressionFromObjectiveC definedValue type}}];
{{/if_is_struct}}
{{/if}}
6 changes: 0 additions & 6 deletions examples/chip-tool-darwin/templates/tests/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,6 @@ function getTests() {
// command implementation.
tests.disable('TestSystemCommands');

// TODO: DL_UsersAndCredentials needs some sort of codegen fixes to produce compiling code.
tests.disable('DL_UsersAndCredentials');

// TODO: DL_Schedules needs some sort of codegen fixes to produce compiling code.
tests.disable('DL_Schedules');

// TODO: TestGroupMessaging does not work on Darwin for now.
tests.disable('TestGroupMessaging');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
{{else if (chip_tests_config_has definedValue)}}
m{{asUpperCamelCase definedValue}}.HasValue() ? m{{asUpperCamelCase definedValue}}.Value() : {{asTypedLiteral (chip_tests_config_get_default_value definedValue) (chip_tests_config_get_type definedValue)}};
{{else}}
{{asTypedLiteral definedValue type}};
{{asTypedExpression definedValue type}};
{{/if_is_bitmap}}
{{/if_chip_enum~}}
{{~/if~}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
{{else if (isOctetString type)}}chip::ByteSpan(chip::Uint8::from_const_char("{{octetStringEscapedForCLiteral expected}}"), {{expected.length}})
{{else if (isCharString type)}}chip::CharSpan("{{expected}}", {{utf8StringLength expected}})
{{else if (chip_tests_config_has expected)}}m{{asUpperCamelCase expected}}.HasValue() ? m{{asUpperCamelCase expected}}.Value() : {{asTypedLiteral (chip_tests_config_get_default_value expected) (chip_tests_config_get_type expected)}}
{{else}}{{asTypedLiteral expected type}}
{{else}}{{asTypedExpression expected type}}
{{/if}}
));
{{/if_is_struct}}
Expand Down
48 changes: 16 additions & 32 deletions src/app/tests/suites/DL_Schedules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,7 @@ tests:
arguments:
values:
- name: "weekDayIndex"
value:
static_cast<uint8_t>(NumberOfWeekDaySchedulesSupportedPerUser
+ 1)
value: NumberOfWeekDaySchedulesSupportedPerUser + 1
- name: "userIndex"
value: 1
- name: "daysMask"
Expand Down Expand Up @@ -154,7 +152,7 @@ tests:
- name: "weekDayIndex"
value: 1
- name: "userIndex"
value: static_cast<uint8_t>(NumberOfTotalUsersSupported + 1)
value: NumberOfTotalUsersSupported + 1
- name: "daysMask"
value: 0x01
- name: "startHour"
Expand Down Expand Up @@ -422,17 +420,13 @@ tests:
arguments:
values:
- name: "weekDayIndex"
value:
static_cast<uint8_t>(NumberOfWeekDaySchedulesSupportedPerUser
+ 1)
value: NumberOfWeekDaySchedulesSupportedPerUser + 1
- name: "userIndex"
value: 1
response:
values:
- name: "weekDayIndex"
value:
static_cast<uint8_t>(NumberOfWeekDaySchedulesSupportedPerUser
+ 1)
value: NumberOfWeekDaySchedulesSupportedPerUser + 1
- name: "userIndex"
value: 1
- name: "status"
Expand Down Expand Up @@ -462,13 +456,13 @@ tests:
- name: "weekDayIndex"
value: 1
- name: "userIndex"
value: static_cast<uint8_t>(NumberOfTotalUsersSupported + 1)
value: NumberOfTotalUsersSupported + 1
response:
values:
- name: "weekDayIndex"
value: 1
- name: "userIndex"
value: static_cast<uint8_t>(NumberOfTotalUsersSupported + 1)
value: NumberOfTotalUsersSupported + 1
- name: "status"
value: 0x85

Expand Down Expand Up @@ -512,9 +506,7 @@ tests:
arguments:
values:
- name: "yearDayIndex"
value:
static_cast<uint8_t>(NumberOfYearDaySchedulesSupportedPerUser
+ 1)
value: NumberOfYearDaySchedulesSupportedPerUser + 1
- name: "userIndex"
value: 1
- name: "localStartTime"
Expand Down Expand Up @@ -546,7 +538,7 @@ tests:
- name: "yearDayIndex"
value: 1
- name: "userIndex"
value: static_cast<uint8_t>(NumberOfTotalUsersSupported + 1)
value: NumberOfTotalUsersSupported + 1
- name: "localStartTime"
value: 12345
- name: "localEndTime"
Expand Down Expand Up @@ -625,17 +617,13 @@ tests:
arguments:
values:
- name: "yearDayIndex"
value:
static_cast<uint8_t>(NumberOfYearDaySchedulesSupportedPerUser
+ 1)
value: NumberOfYearDaySchedulesSupportedPerUser + 1
- name: "userIndex"
value: 1
response:
values:
- name: "yearDayIndex"
value:
static_cast<uint8_t>(NumberOfYearDaySchedulesSupportedPerUser
+ 1)
value: NumberOfYearDaySchedulesSupportedPerUser + 1
- name: "userIndex"
value: 1
- name: "status"
Expand Down Expand Up @@ -665,13 +653,13 @@ tests:
- name: "yearDayIndex"
value: 1
- name: "userIndex"
value: static_cast<uint8_t>(NumberOfTotalUsersSupported + 1)
value: NumberOfTotalUsersSupported + 1
response:
values:
- name: "yearDayIndex"
value: 1
- name: "userIndex"
value: static_cast<uint8_t>(NumberOfTotalUsersSupported + 1)
value: NumberOfTotalUsersSupported + 1
- name: "status"
value: 0x85

Expand Down Expand Up @@ -791,9 +779,7 @@ tests:
arguments:
values:
- name: "weekDayIndex"
value:
static_cast<uint8_t>(NumberOfWeekDaySchedulesSupportedPerUser
+ 1)
value: NumberOfWeekDaySchedulesSupportedPerUser + 1
- name: "userIndex"
value: 1
response:
Expand All @@ -817,7 +803,7 @@ tests:
- name: "weekDayIndex"
value: 1
- name: "userIndex"
value: static_cast<uint8_t>(NumberOfTotalUsersSupported + 1)
value: NumberOfTotalUsersSupported + 1
response:
error: INVALID_FIELD

Expand Down Expand Up @@ -851,9 +837,7 @@ tests:
arguments:
values:
- name: "yearDayIndex"
value:
static_cast<uint8_t>(NumberOfYearDaySchedulesSupportedPerUser
+ 1)
value: NumberOfYearDaySchedulesSupportedPerUser + 1
- name: "userIndex"
value: 1
response:
Expand All @@ -877,7 +861,7 @@ tests:
- name: "yearDayIndex"
value: 1
- name: "userIndex"
value: static_cast<uint8_t>(NumberOfTotalUsersSupported + 1)
value: NumberOfTotalUsersSupported + 1
response:
error: INVALID_FIELD

Expand Down
57 changes: 22 additions & 35 deletions src/app/tests/suites/DL_UsersAndCredentials.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ tests:
arguments:
values:
- name: "userIndex"
# This ugly hack is required to silence compiler warnings about type promotions
value: static_cast<uint16_t>(NumberOfTotalUsersSupported + 1)
value: NumberOfTotalUsersSupported + 1
response:
error: INVALID_COMMAND

Expand Down Expand Up @@ -578,8 +577,7 @@ tests:
- name: "operationType"
value: 0
- name: "userIndex"
# This ugly hack is required to silence compiler warnings about type promotions
value: static_cast<uint16_t>(NumberOfTotalUsersSupported + 1)
value: NumberOfTotalUsersSupported + 1
- name: "userName"
value: null
- name: "userUniqueId"
Expand Down Expand Up @@ -696,8 +694,7 @@ tests:
arguments:
values:
- name: "userIndex"
# This ugly hack is required to silence compiler warnings about type promotions
value: static_cast<uint16_t>(NumberOfTotalUsersSupported + 1)
value: NumberOfTotalUsersSupported + 1
response:
error: INVALID_COMMAND

Expand Down Expand Up @@ -807,11 +804,10 @@ tests:
arguments:
values:
- name: "credential"
value: {
value:
{
CredentialType: 1,
# This ugly hack is required to silence compiler warnings about type promotions
CredentialIndex:
static_cast<uint16_t>(NumberOfPINUsersSupported + 1),
CredentialIndex: NumberOfPINUsersSupported + 1,
}
response:
error: INVALID_COMMAND
Expand Down Expand Up @@ -920,11 +916,10 @@ tests:
- name: "operationType"
value: 0
- name: "credential"
value: {
value:
{
CredentialType: 1,
# This ugly hack is required to silence compiler warnings about type promotions
CredentialIndex:
static_cast<uint16_t>(NumberOfPINUsersSupported + 1),
CredentialIndex: NumberOfPINUsersSupported + 1,
}
- name: "credentialData"
value: "123456"
Expand Down Expand Up @@ -964,12 +959,10 @@ tests:
arguments:
values:
- name: "credential"
value: {
value:
{
CredentialType: 2,
# This ugly hack is required to silence compiler warnings about type promotions
CredentialIndex:
static_cast<uint16_t>(NumberOfRFIDUsersSupported +
1),
CredentialIndex: NumberOfRFIDUsersSupported + 1,
}
response:
error: INVALID_COMMAND
Expand Down Expand Up @@ -1098,12 +1091,10 @@ tests:
- name: "operationType"
value: 0
- name: "credential"
value: {
value:
{
CredentialType: 2,
# This ugly hack is required to silence compiler warnings about type promotions
CredentialIndex:
static_cast<uint16_t>(NumberOfRFIDUsersSupported +
1),
CredentialIndex: NumberOfRFIDUsersSupported + 1,
}
- name: "credentialData"
value: "new_rfid_data_field"
Expand Down Expand Up @@ -1186,8 +1177,7 @@ tests:
- name: "credentialData"
value: "123465"
- name: "userIndex"
# This ugly hack is required to silence compiler warnings about type promotions
value: static_cast<uint16_t>(NumberOfTotalUsersSupported + 1)
value: NumberOfTotalUsersSupported + 1
- name: "userStatus"
value: null
- name: "userType"
Expand Down Expand Up @@ -2082,11 +2072,10 @@ tests:
arguments:
values:
- name: "credential"
value: {
value:
{
CredentialType: 1,
# This ugly hack is required to silence compiler warnings about type promotions
CredentialIndex:
static_cast<uint16_t>(NumberOfPINUsersSupported + 1),
CredentialIndex: NumberOfPINUsersSupported + 1,
}
response:
error: INVALID_COMMAND
Expand All @@ -2107,12 +2096,10 @@ tests:
arguments:
values:
- name: "credential"
value: {
value:
{
CredentialType: 2,
# This ugly hack is required to silence compiler warnings about type promotions
CredentialIndex:
static_cast<uint16_t>(NumberOfRFIDUsersSupported +
1),
CredentialIndex: NumberOfRFIDUsersSupported + 1,
}
response:
error: INVALID_COMMAND
Expand Down
Loading

0 comments on commit 57d9848

Please sign in to comment.