Skip to content
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

x/build: consider transitioning from Corellium based iOS builders to Apple Simulator based builders #66360

Open
rolandshoemaker opened this issue Mar 17, 2024 · 2 comments
Labels
Builders x/build issues (builders, bots, dashboards) NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. new-builder OS-iOS GOOS=ios
Milestone

Comments

@rolandshoemaker
Copy link
Member

The iOS builders are currently broken, and have been for quite a while (see https://ci.chromium.org/ui/p/golang/builders?q=ios and https://farmer.golang.org/#active). It's unclear what work is necessary to fix them.

Corellium is a somewhat strange platform to be testing on, as it is (a) emulating jailbroken iOS, which is likely to be representative of a minority of Go code run on iOS, and (b) unclear what version of iOS is being emulated. It is also a commercial product, so spinning up more builders, or better builders etc, is likely to incur some financial burden.

This issue proposes moving away from the Corellium based builders, and instead using the official Apple iOS Simulator, for which we already have most of the required machinery to do. This would allow us to use existing darwin builders (or new darwin builders that come from the same source) to run iOS tests, instead of relying on the current third-party maintained builders.

misc/ios contains slightly out of date tools that allow executing Go binaries on the iOS simulator by wrapping them in an app bundle and using the xcrun simctl tools to run them. These tools predate the arm Apple silicon, so need a little updating to work on newer machines, but I was able to quickly update them to reliably work on arm64 macos.

Most of the complexity of these tools is because they are written to work on both the iOS simulator and real devices, but could be reasonably updated to be somewhat more streamlined and efficient (i.e. only supporting the simulator, or split into tools specifically for the simulator and real devices, and removing the reliance on the debugger which doesn't seem strictly necessary. There is probably also some work to be done to reduce the need to move large parts of the source tree back and forth from the simulator when testing the entire tree).

The only delta between the existing darwin builders and iOS specific builders would be additionally installing the xcode simulator runtime, and setting GOOS=ios.

cc @golang/release @changkun

@gopherbot gopherbot added the Builders x/build issues (builders, bots, dashboards) label Mar 17, 2024
@gopherbot gopherbot added this to the Unreleased milestone Mar 17, 2024
@rolandshoemaker
Copy link
Member Author

rolandshoemaker commented Mar 19, 2024

It looks like the darwin-arm64_12 builders don't have simulator runtimes installed (and uses a version of xcode that predates xcodebuild -downloadPlatform iOS so installing them is a bit of a pain). The _13 ones appear to already have the 15.5 and 16.2 runtimes (and I was able to manually install the 17.4 runtime).

Notes for posterity, after booting a gotip-darwin-arm64_13 builder, these are the steps I needed to complete (with a modified clangwrap.sh and go_ios_exec.go):

  • xcrun simctl boot <uuid for a device> --arch=arm64 (last bit may not be strictly necessary)
  • xcrun simctl keychain booted add-root-cert crypto/x509/platform_root_cert.pem

After this CGO_ENABLED=1 GOOS=ios GOARCH=arm64 CC_FOR_TARGET=$(pwd)/../misc/ios/clangwrap.sh all.bash worked as expected, running all of the tests on the simulator.

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/573175 mentions this issue: misc/ios: rework exec wrapper to only support simulator

@thanm thanm added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Mar 26, 2024
gopherbot pushed a commit that referenced this issue Jun 18, 2024
This updates the tools used to execute Go binaries on the Apple iOS
Simulator to (a) work with newer arm64 macOS, (b) remove support
for running binaries on physical devices, and (c) remove the reliance on
LLDB and third-party Python packages. This makes the wrapper somewhat
simpler, and easier to understand and maintain. Additionally
clangwrap.sh is updated to reflect dropping support for targeting
physical devices.

This smoothes out the path for #66360.

Change-Id: I769127e65f5e8c6c727841168890fd8557fb0e1d
Reviewed-on: https://go-review.googlesource.com/c/go/+/573175
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Builders x/build issues (builders, bots, dashboards) NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. new-builder OS-iOS GOOS=ios
Projects
None yet
Development

No branches or pull requests

4 participants