Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
cmd/dist: get testcarchive working on iOS #8345
misc/cgo tests breakdown: misc/cgo/stdio, misc/cgo/life aren't important, they are just cgo examples; misc/cgo/test: the most important one, shouldn't be too hard to run; misc/cgo/testcdefs: should be covered by other systems; misc/cgo/testso: test cgo could link dynamic libraries, covered by normal android cgo usage; misc/cgo/testasan: not relevant on 32-bit systems; misc/cgo/errors: covered by other systems. In summary: we need to run misc/cgo/test and various crash tests from runtime. I don't think we need to modify test/run.go.
For iOS, this is very close to working. The sticking point is TestCthread:
This is a slightly gnarlier version of #10043. In this instance, our EXC_BAD_ACCESS handler isn't be activated because the cgo callback is being run on a foreign thread. For foreign threads we have never had an opportunity to grab the mach_task_port.
One potential solution is to steal the pthread_create symbol and register the task port then.
This CL updates a TODO on a condition excluding a lot of tests on android, clarifying what needs to be done. Several of the tests should be turned off, for example anything depending on the Go tool, others should be enabled. (See #8345, comment 3 for more details.) Also add iOS, which has the same set of restrictions. Tested manually on linux/amd64, darwin/amd64, android/arm, darwin/arm. Updates #8345 Change-Id: I147f0a915426e0e0de9a73f9aea353766156609b Reviewed-on: https://go-review.googlesource.com/7734 Reviewed-by: Burcu Dogan <email@example.com>
The cgo test is probably the most important test that should be run on iOS. (If I have to choose a subset of test on iOS, I'd choose runtime, sync, cgo, os, math, net, and net/http to always run, and happily ignore all the others.) That said, I don't like the idea of overriding pthread_create even though I'm the one that proposed the same idea to implement cgo on OpenBSD and it's how cgo works on OpenBSD despite the fact that the OS doesn't natively support TLS. The reason is that it's probably too risky to override such fundamental functions when the binary is subject to review by the App store. In fact, I think we'd better remove the task port code as well when building the release binary. (add a TODO for cmd/gomobile?) There is a way to install the task_port for foreign threads, because that test want to test that recover on foreign threads can still recover from SIGSEGV, we can do the task_port installation at cgocallback time when we detected that we're being called on a foreign thread.