Skip to content

Commit

Permalink
Fix handling of list-typed attributes in Darwin tests. (#12538)
Browse files Browse the repository at this point in the history
Two issues here:

1) asTestValue did not handle list attributes properly: it assigned
   @(0) to the NSArray*.

2) This compiled, because we were not enabling -Werror for the build
   of the test harness.

This fixes both issues.  No codegen changes, because we don't actually
have any non-excluded writable list-typed attributes yet.  Which is
good, because they would not have passed CI due to crashing when we
try to treat an NSNumber* as NSArray*.
  • Loading branch information
bzbarsky-apple authored and pull[bot] committed Aug 9, 2022
1 parent 2becb65 commit a6f20a8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/darwin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ jobs:
run: |
mkdir -p /tmp/darwin/framework-tests
../../../out/debug/chip-all-clusters-app > >(tee /tmp/darwin/framework-tests/all-cluster-app.log) 2> >(tee /tmp/darwin/framework-tests/all-cluster-app-err.log >&2) &
xcodebuild test -target "CHIP" -scheme "CHIP Framework Tests" -sdk macosx > >(tee /tmp/darwin/framework-tests/darwin-tests.log) 2> >(tee /tmp/darwin/framework-tests/darwin-tests-err.log >&2)
xcodebuild test -target "CHIP" -scheme "CHIP Framework Tests" -sdk macosx OTHER_CFLAGS='${inherited} -Werror -Wno-documentation -Wno-conditional-uninitialized -Wno-incomplete-umbrella' > >(tee /tmp/darwin/framework-tests/darwin-tests.log) 2> >(tee /tmp/darwin/framework-tests/darwin-tests-err.log >&2)
working-directory: src/darwin/Framework
- name: Uploading log files
uses: actions/upload-artifact@v2
Expand Down
2 changes: 2 additions & 0 deletions src/darwin/Framework/CHIP/templates/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ function asTestValue()
return '[@"Test" dataUsingEncoding:NSUTF8StringEncoding]';
} else if (StringHelper.isCharString(this.type)) {
return '@"Test"';
} else if (this.isArray) {
return '[NSArray array]';
} else {
return `@(${this.min || this.max || 0})`;
}
Expand Down

0 comments on commit a6f20a8

Please sign in to comment.