aboutsummaryrefslogtreecommitdiff
path: root/misc/ios
AgeCommit message (Collapse)Author
2025-09-15all: replace strings.Split with strings.SplitSeq1911860538
In Go 1.25+, strings.SplitSeq offers better performance. Here are the benchmark results comparing strings.Split and strings.SplitSeq in a for-loop, with the benchmark code located in src/strings/iter_test.go: goos: darwin goarch: amd64 pkg: cmd/go/internal/auth cpu: Intel(R) Core(TM) i7-8569U CPU @ 2.80GHz │ old.txt │ new.txt │ │ sec/op │ sec/op vs base │ ParseGitAuth/standard-8 281.4n ± 1% 218.0n ± 11% -22.54% (p=0.000 n=10) ParseGitAuth/with_url-8 549.1n ± 1% 480.5n ± 13% -12.48% (p=0.002 n=10) ParseGitAuth/minimal-8 235.4n ± 1% 197.3n ± 7% -16.20% (p=0.000 n=10) ParseGitAuth/complex-8 797.6n ± 2% 805.2n ± 4% ~ (p=0.481 n=10) ParseGitAuth/empty-8 87.48n ± 3% 63.25n ± 6% -27.71% (p=0.000 n=10) ParseGitAuth/malformed-8 228.8n ± 1% 171.2n ± 3% -25.17% (p=0.000 n=10) geomean 288.9n 237.7n -17.72% │ old.txt │ new.txt │ │ B/op │ B/op vs base │ ParseGitAuth/standard-8 192.00 ± 0% 96.00 ± 0% -50.00% (p=0.000 n=10) ParseGitAuth/with_url-8 400.0 ± 0% 288.0 ± 0% -28.00% (p=0.000 n=10) ParseGitAuth/minimal-8 144.00 ± 0% 80.00 ± 0% -44.44% (p=0.000 n=10) ParseGitAuth/complex-8 528.0 ± 0% 400.0 ± 0% -24.24% (p=0.000 n=10) ParseGitAuth/empty-8 32.00 ± 0% 16.00 ± 0% -50.00% (p=0.000 n=10) ParseGitAuth/malformed-8 176.00 ± 0% 80.00 ± 0% -54.55% (p=0.000 n=10) geomean 179.0 102.1 -42.96% │ old.txt │ new.txt │ │ allocs/op │ allocs/op vs base │ ParseGitAuth/standard-8 3.000 ± 0% 2.000 ± 0% -33.33% (p=0.000 n=10) ParseGitAuth/with_url-8 4.000 ± 0% 3.000 ± 0% -25.00% (p=0.000 n=10) ParseGitAuth/minimal-8 3.000 ± 0% 2.000 ± 0% -33.33% (p=0.000 n=10) ParseGitAuth/complex-8 4.000 ± 0% 3.000 ± 0% -25.00% (p=0.000 n=10) ParseGitAuth/empty-8 2.000 ± 0% 1.000 ± 0% -50.00% (p=0.000 n=10) ParseGitAuth/malformed-8 3.000 ± 0% 2.000 ± 0% -33.33% (p=0.000 n=10) geomean 3.086 2.040 -33.91% Updates #69315. Change-Id: Id0219edea45d9658d527b863162ebe917e7821d9 GitHub-Last-Rev: 392b315e122f2c9ef8703ca2dbce8f82ec198556 GitHub-Pull-Request: golang/go#75259 Reviewed-on: https://go-review.googlesource.com/c/go/+/701015 Reviewed-by: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com> Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Emmanuel Odeke <emmanuel@orijtech.com>
2024-06-18misc/ios: rework exec wrapper to only support simulatorRoland Shoemaker
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>
2023-10-19misc: drop old +build linesDmitri Shuralyov
This is all there was outside of the src and test top-level directories. Change-Id: Id29b1c92cab7087681f89504e861a47dc30ba834 Reviewed-on: https://go-review.googlesource.com/c/go/+/536238 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2022-04-11all: gofmt main repoRuss Cox
[This CL is part of a sequence implementing the proposal #51082. The design doc is at https://go.dev/s/godocfmt-design.] Run the updated gofmt, which reformats doc comments, on the main repository. Vendored files are excluded. For #51082. Change-Id: I7332f099b60f716295fb34719c98c04eb1a85407 Reviewed-on: https://go-review.googlesource.com/c/go/+/384268 Reviewed-by: Jonathan Amsterdam <jba@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-12-02misc/ios: bump min versionChangkun Ou
For #48076 Change-Id: I5edaa43af82c3478555c309a001a3d1b16de3d64 Reviewed-on: https://go-review.googlesource.com/c/go/+/368615 Run-TryBot: Cherry Mui <cherryyz@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Roland Shoemaker <roland@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
2021-10-06all: use bytes.Cut, strings.CutRuss Cox
Many uses of Index/IndexByte/IndexRune/Split/SplitN can be written more clearly using the new Cut functions. Do that. Also rewrite to other functions if that's clearer. For #46336. Change-Id: I68d024716ace41a57a8bf74455c62279bde0f448 Reviewed-on: https://go-review.googlesource.com/c/go/+/351711 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-08-13all: gofmt more (but vendor, testdata, and top-level test directories)Dmitri Shuralyov
CL 294430 made packages in std and cmd modules use Go 1.17 gofmt format, adding //go:build lines. This change applies the same formatting to some more packages that 'go fmt' missed (e.g., syscall/js, runtime/msan), and everything else that is easy and safe to modify in bulk. Consider the top-level test directory, testdata, and vendor directories out of scope, since there are many files that don't follow strict gofmt formatting, often for intentional and legitimate reasons (testing gofmt itself, invalid Go programs that shouldn't crash the compiler, etc.). That makes it easy and safe to gofmt -w the .go files that are found with gofmt -l with aforementioned directories filtered out: $ gofmt -l . 2>/dev/null | \ grep -v '^test/' | \ grep -v '/testdata/' | \ grep -v '/vendor/' | wc -l 51 None of the 51 files are generated. After this change, the same command prints 0. For #41184. Change-Id: Ia96ee2a0f998d6a167d4473bcad17ad09bc1d86e Reviewed-on: https://go-review.googlesource.com/c/go/+/341009 Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Trust: Dmitri Shuralyov <dmitshur@golang.org>
2021-04-05all: update references to symbols moved from io/ioutil to ioKimMachineGun
Update references missed in CL 263142. For #41190 Change-Id: I778760a6a69bd0440fec0848bdef539c9ccb4ee1 GitHub-Last-Rev: dda42b09fff36dc08ec1cdec50cc19e3da5058e5 GitHub-Pull-Request: golang/go#42874 Reviewed-on: https://go-review.googlesource.com/c/go/+/273946 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Trust: Cherry Zhang <cherryyz@google.com>
2020-12-29misc/ios: fix wording for command line instructionsDaniel Martí
A typo was made, which I noticed while looking through the recent master commits. Change-Id: Ieed5d6664a1f3ff5892d59abf194963b44ef0e55 Reviewed-on: https://go-review.googlesource.com/c/go/+/280454 Trust: Daniel Martí <mvdan@mvdan.cc> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-12-29misc/ios: add to README how to build ios executablesCherry Zhang
Updates #43371, #43343. Change-Id: I19386269245f2c20345c6cac7560089b8223e9f9 Reviewed-on: https://go-review.googlesource.com/c/go/+/280153 Trust: Cherry Zhang <cherryyz@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-10-05misc/ios: fixup review comments from CL 255257Elias Naur
Change-Id: I247fc9e0e26e706e6af07367f953eaa1b7e544c1 Reviewed-on: https://go-review.googlesource.com/c/go/+/259577 Trust: Elias Naur <mail@eliasnaur.com> Run-TryBot: Elias Naur <mail@eliasnaur.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Go Bot <gobot@golang.org>
2020-10-03misc/ios: add support for running programs on the iOS simulatorElias Naur
Update the README to mention the emulator. Remove reference to gomobile while here; there are multiple ways to develop for iOS today, including using the c-archive buildmode directly. Updates #38485 Change-Id: Iccef75e646ea8e1b9bc3fc37419cc2d6bf3dfdf4 Reviewed-on: https://go-review.googlesource.com/c/go/+/255257 Run-TryBot: Elias Naur <mail@eliasnaur.com> TryBot-Result: Go Bot <gobot@golang.org> Trust: Elias Naur <mail@eliasnaur.com> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-09-14misc/ios: quote pathsCherry Zhang
The paths may contain spaces. Quote them. Change-Id: I1f67085a1e7c40f60282c2fea7104fb44a01e310 Reviewed-on: https://go-review.googlesource.com/c/go/+/254739 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Trust: Dmitri Shuralyov <dmitshur@golang.org>
2020-04-08all: remove scattered remnants of darwin/armAustin Clements
This removes all conditions and conditional code (that I could find) that depended on darwin/arm. Fixes #35439 (since that only happened on darwin/arm) Fixes #37611. Change-Id: Ia4c32a5a4368ed75231075832b0b5bfb1ad11986 Reviewed-on: https://go-review.googlesource.com/c/go/+/227198 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-11-05misc/ios: bump -mios-version-minElias Naur
Recent Xcode versions started to complain about the current min version: ld: warning: OS version (6.0.0) too small, changing to 7.0.0 Change-Id: Ieb525dd3e57429fe226b9d30d584b073c5e4768c Reviewed-on: https://go-review.googlesource.com/c/go/+/204663 Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com> Run-TryBot: Elias Naur <mail@eliasnaur.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-06-15misc/ios: add missing CGO_ENABLED=1 for running standalone testsElias Naur
Change-Id: Icfd5b9d1ca757081af7885189ae7094fa1b3d8f1 Reviewed-on: https://go-review.googlesource.com/c/go/+/182377 Run-TryBot: Elias Naur <mail@eliasnaur.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-05-03misc/ios: don't refer to iostest.bashElias Naur
iostest.bash might not live much longer, and all.bash is much less confusing and more explicit. Change-Id: If42e8716bbbb02aa3f817dceaabb1aa8076aae1a Reviewed-on: https://go-review.googlesource.com/c/go/+/175178 Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-03-21misc/ios: don't override GOCACHE on the deviceElias Naur
The iOS exec wrapper copies the environment variables to the binary running on the device. However, some variables such as HOME, TMPDIR and GOCACHE refer to directories that might not be valid on the device. The wrapper already ignores HOME and TMPDIR, but after GO111MODULE was flipped to on for the standard library, cmd/go tests started failing without a valid and writable GOCACHE. It took a while to reproduce because go test does not set an explicit GOCACHE but cmd/dist test does. Fixes #30914 Change-Id: If186cddc5cfd7ad39a0b3eb95f9c64a7d53a27e3 Reviewed-on: https://go-review.googlesource.com/c/go/+/168557 Run-TryBot: Elias Naur <mail@eliasnaur.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-03-17cmd/go,misc/ios: fix tests on iOSElias Naur
Now that modules are always on, cmd/go tests require a valid GOCACHE. However, on iOS where the go tool is not available, the cmd/go test driver ends up setting GOCACHE to the empty string. Fix it by falling back to the builtin default cache directory. The iOS exec wrapper passes the environment variables to the app on the device, including $HOME used for the default cache directory. Skip $HOME to let the device specific and writable $HOME be used instead. Should fix cmd/go on the iOS builders that broke when GO111MODULE defaulted to on. Change-Id: I0939f5b8aaa1d2db95e64c99f4130eee2d0b4d4d Reviewed-on: https://go-review.googlesource.com/c/go/+/167938 Run-TryBot: Elias Naur <mail@eliasnaur.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-03-01misc/android,misc/ios: evaluate current working directory symlinksElias Naur
Previous CLs added symlink evaulation to GOROOT and GOPATH. Unfortunately that only fixed tests that ran outside GOROOT. To fix the standard library tests, evaluate symlinks in the current working directory as well. Change-Id: Ia406a968235ae4321a1002567520105998582d15 Reviewed-on: https://go-review.googlesource.com/c/164699 Run-TryBot: Elias Naur <mail@eliasnaur.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-03-01misc/ios: evaluate symlinks before comparing GOROOT and GOPATHElias Naur
CL 163726 added workarounds to keep the iOS builders happy in a symlinked temporary dir. The workarounds also made the tests more realistic and improved performance. Keep them but also handle symlinks better in the exec wrapper. Change-Id: Iaa2c03a1a3fb3aa5aaf62d79d52b63d5d8f11db5 Reviewed-on: https://go-review.googlesource.com/c/164698 Reviewed-by: Bryan C. Mills <bcmills@google.com>
2018-10-24misc/ios: remove note from output of detect.goElias Naur
If no GOIOS_DEV_ID is set, iostest.bash will eval the output of detect.go. Prepend the note output by detect.go with # to make the shell ignore it. Went undetected for so long because the iOS builders usually run with GOIOS_DEV_ID set. Change-Id: I308eac94803851620ca91593f9a1aef79825187f Reviewed-on: https://go-review.googlesource.com/c/144109 Run-TryBot: Elias Naur <elias.naur@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2018-05-11misc/ios: forward SIGQUIT to the iOS programElias Naur
When running tests that fails to complete within the test timeout, the go tool sends the test program a SIGQUIT signal to print backtraces. However, for tests running with an exec wrapper, the resulting backtraces will come from the exec wrapper process and not the test program. Change the iOS exec wrapper to forward SIGQUIT signals to the lldb python driver and change the driver to forward the signals to the running test on the device. Before: $ GOARCH=arm64 go test forever_test.go lldb: running program SIGQUIT: quit PC=0x10816fe m=0 sigcode=0 goroutine 54 [syscall]: syscall.Syscall6(0x7, 0x16ab, 0xc000033dfc, 0x0, 0xc000116f30, 0x0, 0x0, 0xc000116f30, 0x0, 0x1328820) /Users/elias/go-tip/src/syscall/asm_darwin_amd64.s:41 +0x5 fp=0xc000033d48 sp=0xc000033d40 pc=0x10816d5 syscall.wait4(0x16ab, 0xc000033dfc, 0x0, 0xc000116f30, 0x90, 0x1200e00, 0x1) /Users/elias/go-tip/src/syscall/zsyscall_darwin_amd64.go:34 +0x7b fp=0xc000033dc0 sp=0xc000033d48 pc=0x107e4eb syscall.Wait4(0x16ab, 0xc000033e4c, 0x0, 0xc000116f30, 0xc0000fd518, 0x0, 0x0) /Users/elias/go-tip/src/syscall/syscall_bsd.go:129 +0x51 fp=0xc000033e10 sp=0xc000033dc0 pc=0x107b7b1 os.(*Process).wait(0xc00008d440, 0x1095e2e, 0xc0000fd518, 0x0) /Users/elias/go-tip/src/os/exec_unix.go:38 +0x7b fp=0xc000033e80 sp=0xc000033e10 pc=0x109af2b os.(*Process).Wait(0xc00008d440, 0xc000033fb0, 0x10, 0x11d1f00) /Users/elias/go-tip/src/os/exec.go:125 +0x2b fp=0xc000033eb0 sp=0xc000033e80 pc=0x109a47b os/exec.(*Cmd).Wait(0xc0000b1ce0, 0xc000033f90, 0x11394df) /Users/elias/go-tip/src/os/exec/exec.go:463 +0x5b fp=0xc000033f28 sp=0xc000033eb0 pc=0x1136f0b main.startDebugBridge.func1(0xc0000b1ce0, 0xc0000b8ae0, 0xc0000e2a80) /Users/elias/go-tip/misc/ios/go_darwin_arm_exec.go:314 +0x40 fp=0xc000033fc8 sp=0xc000033f28 pc=0x11a1980 runtime.goexit() /Users/elias/go-tip/src/runtime/asm_amd64.s:1360 +0x1 fp=0xc000033fd0 sp=0xc000033fc8 pc=0x10565a1 created by main.startDebugBridge /Users/elias/go-tip/misc/ios/go_darwin_arm_exec.go:313 +0x15f ... After: $ GOARCH=arm64 go test forever_test.go lldb: running program === RUN TestForever SIGQUIT: quit PC=0x100144e24 m=0 sigcode=0 ... goroutine 19 [select (no cases)]: command-line-arguments.TestForever(0x1300b60f0) /Users/elias/go-tip/src/forever_test.go:6 +0x18 testing.tRunner(0x1300b60f0, 0x100211aa0) /Users/elias/go-tip/src/testing/testing.go:795 +0xa8 created by testing.(*T).Run /Users/elias/go-tip/src/testing/testing.go:840 +0x22c ... Change-Id: I6b3cf1662d07a43ade0530842733b0944bee1ace Reviewed-on: https://go-review.googlesource.com/112676 Run-TryBot: Elias Naur <elias.naur@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2018-05-10misc/ios: update documentation for running iOS programs and testsElias Naur
Change-Id: I8e3077ab9c7dff66877ac00dc4600b53c07eb1f8 Reviewed-on: https://go-review.googlesource.com/112655 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-05-09misc/ios: inject the -u device_id option before any other argumentsElias Naur
The idevicedebugserverproxy command takes a port number without a flag, like so: idevicedebugserverproxy 3222 If the -u <device_id> flag is added afterwards, it is ignored and the command use an arbitrary device. Instead, always inject the -u flag before any other idevice command arguments. While here, also kill any leftover idevicedebugserverproxy instance previous (failed) runs might have left running. Change-Id: I0bf06ed1a20ef225abeca183f9ba8f396662d435 Reviewed-on: https://go-review.googlesource.com/112216 Run-TryBot: Elias Naur <elias.naur@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-05-08misc/ios: retry iOS launch even if no device app path was foundElias Naur
Now that the iOS exec wrapper uninstalls any existing test app before installing a new, looking up the device app path might fail. Before, the lookup always succeeded (even though the path reported might be stale). For the iOS builder. Change-Id: I5667b6fae15f88745bdee796db219a429a26e203 Reviewed-on: https://go-review.googlesource.com/112075 Run-TryBot: Elias Naur <elias.naur@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2018-05-07misc/ios: uninstall app before installing itElias Naur
Tests can fail because there is leftover data from a previous run. For example: --- FAIL: TestRemoveAll (0.00s) path_test.go:96: RemoveAll "/private/var/mobile/Containers/Data/Application/66247524-5ED7-45A4-82AA-6BF15D6078B2/tmp//_TestRemoveAll_" (first): open /private/var/mobile/Containers/Data/Application/66247524-5ED7-45A4-82AA-6BF15D6078B2/tmp//_TestRemoveAll_/dir: permission denied FAIL FAIL os 31.275s There seem to be no way to simply clear the app data for an app short of uninstalling it, so do that. This change in effect undoes CL 106676, which means that running iOS is a little slower again, and that another app from the same apple developer account must be present on the device for our app install to succeed. Change-Id: Iacc3a6f95c93568f4418db45e1098c7c7fdb88e0 Reviewed-on: https://go-review.googlesource.com/111795 TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-05-04misc/ios: improve detection of missing developer imageElias Naur
It turns out that a non-empty result from ideviceimagemounter does not mean an image is mounted. Use ideviceimagemounter's xml output mode to improve the check. Also, iOS versions are reported as major.minor or major.minor.patch. Developer images are only specific to major.minor version, so cut off the patch number in the search, if present. Change-Id: Ia182e6f4655b7e6aa6feb8005cd3b533535b73cd Reviewed-on: https://go-review.googlesource.com/111235 Run-TryBot: Elias Naur <elias.naur@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2018-05-03misc/ios: retry lldb launch if the iOS app is busyElias Naur
Sometimes, a newly installed the test app is not ready to launch or the reported app path is stale. Pause and retry the launch if the lldb script did not run the program. Change-Id: Ic7745d4b5a02f2e3cb8134341859039812f65a65 Reviewed-on: https://go-review.googlesource.com/111216 Run-TryBot: Elias Naur <elias.naur@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-05-03misc/ios: clean up debugger instance on failureElias Naur
Also replace repeated `or` clauses with the Python idiomatic list operator `in`. Change-Id: I4b178f93eb92996d8b5449ee5d252543624aed9e Reviewed-on: https://go-review.googlesource.com/111215 Run-TryBot: Elias Naur <elias.naur@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-05-03misc/ios: ensure deferred cleanup functions are run even on errorElias Naur
log.Fatal exits the process and doesn't allow deferred functions to run. Extract log.Fatal calls to main where all deferred functions have completed. For the iOS builder. Change-Id: Id1ef9955bed19944a819d6137a611d6ecbe624a6 Reviewed-on: https://go-review.googlesource.com/110955 Run-TryBot: Elias Naur <elias.naur@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-05-03misc/ios: retry app installElias Naur
Sometimes ideviceinstaller fails to install the app. Retry a few times before giving up. For the iOS builder. Change-Id: Ib066ffd4f97ae8d22c0fa9a78ea4d04f67c17410 Reviewed-on: https://go-review.googlesource.com/111055 Run-TryBot: Elias Naur <elias.naur@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-05-02misc/ios: don't override TMPDIR on ideviceElias Naur
If TMPDIR is not set, the iOS runtime will automatically set TMPDIR to a valid app temporary path. For the iOS builders. Change-Id: Ia82404059dcb10678f0a6e0c96d5efc79a5485fd Reviewed-on: https://go-review.googlesource.com/110956 Run-TryBot: Elias Naur <elias.naur@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-04-30misc/ios: script lldb directly with PythonElias Naur
The iOS exec wrapper uses ios-deploy to set up a device, install the wrapped app, and start a lldb session to run it. ios-deploy is not built to be scripted, as can be seen from the brittle way it is driven by the Go wrapper. There are many timeouts and comments such as " // lldb tries to be clever with terminals. // So we wrap it in script(1) and be clever // right back at it. " This CL replaces the use of ios-deploy with a lldb driver script in Python. lldb is designed to be scripted, so apart from getting rid of the ios-deploy dependency, we gain: - No timouts and scripting ios-deploy through stdin and parsing stdout for responses. - Accurate exit codes. - Prompt exits when the wrapped binary fails for some reason. Before, the go test timeout would kick in to fail the test. - Support for environment variables. - No noise in the test output. Only the test binary output is output from the wrapper. We have to do more work with the lldb driver: mounting the developer image on the device, running idevicedebugserverproxy and installing the app. Even so, the CL removes almost as many lines as it adds. Furthermore, having the steps split up helps to tell setup errors from runtime errors. Change-Id: I48cccc32f475d17987283b2c93aacc3da18fe339 Reviewed-on: https://go-review.googlesource.com/107337 TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-04-12misc/ios: speed up the iOS exec wrapperElias Naur
First, take the exclusive lock that ensures only one running binary later: after assembling the gotest.app directory and signing it. Second, don't pass -r to ios-deploy. The -r flag uninstalls the app before installing it. It seems unnecessary, takes extra time and if there was only the one developer app on the phone, it will drop the developer permission on uninstall. Change-Id: Ia222d3e5c2e1e2285f53074eb952941fd45fadd9 Reviewed-on: https://go-review.googlesource.com/106676 Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2018-04-11misc/ios: don't wait for response to lldb run in the exec wrapperElias Naur
CL 106096 changed the iOS exec wrapper to directly run the binary without waiting for a SIGINT signal, but did so in a way that expects a "(lldb)" response from lldb in 2 seconds. Lldb might not out output anything until the program finishes, so change the exec wrapper to just fire and forget the the run command and go straight to waiting for exit, successfully or otherwise. Change-Id: I6a2dc63f9b29fe44edb3591afb048b9a8e2e0822 Reviewed-on: https://go-review.googlesource.com/106176 Run-TryBot: Elias Naur <elias.naur@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-04-10misc/ios: make detect.go more robustElias Naur
To enable the exec wrapper go_darwin_arm_exec.go to run binaries on iOS devices, the GOIOS_DEV_ID variable needs to be set to a code signing identity. The program detect.go attempts to detect suitable values for GOIOS_DEV_ID (along with GOIOS_APP_ID and GOIOS_TEAM_ID). Before this change, detect.go would use "security find-identity -p codesigning -v" to list all available identities for code signing and pick the first one with "iPhone Developer" in its name. However, that pick might be invalid since if it was replaced by an identity issued later. For example, on the mobile builder: $ security find-identity -p codesigning -v 1) 0E251DE41FE4490574E475AC320B47F58D6D3635 "lldb_codesign" 2) 0358588D07AA6A19478981BA405F40A97F95F187 "iPhone Developer: xxx@xxx (2754T98W8E)" 3) FC6D96F24A3223C98BF7A2C2C5194D82E04CD23E "iPhone Developer: xxx@xxx (2754T98W8E)" 3 valid identities found In this case, the identity 0358588D07AA6A19478981BA405F40A97F95F187 is picked by detect.go even though it has been invalidated by FC6D96F24A3223C98BF7A2C2C5194D82E04CD23E. Instead of attempting to find an identity from the "security find-identity" list, use the identity from the CommonName in the embedded certificate in the provisioning file. The CommonName only lists the identity name (iPhone Developer: xxx@xxx (2754T98W8E)), not the fingerprint (FC6D96F24A3223C98BF7A2C2C5194D82E04CD23E), but fortunately the codesign tool accepts both. Identity names may not be unique, as demonstrated by the example, but that will result in an ambiguity error at codesigning instead of a more obscure error about an invalid identity when go_darwin_arm_exec.go runs a binary. The fix is then to delete the invalid identity from the system keychain. While here, find all connected devices instead of the first connected and only consider provision files that covers them all. This matters for the mobile builder where two devices are connected. Change-Id: I6beb59ace3fc5e071ba76222a20a607765943989 Reviewed-on: https://go-review.googlesource.com/105436 Run-TryBot: Elias Naur <elias.naur@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2018-04-10misc/ios,runtime/cgo: remove SIGINT handshake for the iOS exec wrapperElias Naur
Once upon a time, the iOS exec wrapper needed to change the current working directory for the binary being tested. To allow that, the runtime raised a SIGINT signal that the wrapper caught, changed the working directory and resumed the process. These days, the current working directory is passed from the wrapper to the runtime through a special entry in the app metadata and the SIGINT handshake is not necessary anymore. Remove the signaling from the runtime and the exec harness. Change-Id: Ia53bcc9e4724d2ca00207e22b91ce80a05271b55 Reviewed-on: https://go-review.googlesource.com/106096 Run-TryBot: Elias Naur <elias.naur@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2017-12-04misc/ios: dump logs for failing lldb sessions to stdoutElias Naur
The iOS test harness dumps the output of its lldb session to stdout, but only if the lldb session was successfully started. Make sure the log is always dumpede, so that lldb startup failures such as lldb setup error: exited (lldb start: exit status 253) can be diagnosed. For the iOS builders. Change-Id: Ie0e3341dd8f84a88d26509c34816668d3ebbfaa0 Reviewed-on: https://go-review.googlesource.com/76195 Run-TryBot: Elias Naur <elias.naur@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2017-10-03misc/ios: always kill lldb process when it hangsElias Naur
The lldb child process is killed if a test runs too long. Also kill it when the setup times out (and is retried). Might help with builder flakes where all 5 attempts to start up lldb fail even though the tests before and after the timeouts succeed. For example: ... ok vendor/golang_org/x/net/route 37.797s lldb setup error: command timeout (lldb start for 17s) start timeout, trying again lldb setup error: command timeout (lldb start for 17s) start timeout, trying again lldb setup error: command timeout (lldb start for 17s) start timeout, trying again lldb setup error: command timeout (lldb start for 17s) start timeout, trying again lldb setup error: command timeout (lldb start for 17s) go_darwin_arm_exec: failed to start test harness (retry attempted) FAIL vendor/golang_org/x/text/transform 115.185s ok vendor/golang_org/x/text/unicode/norm 122.773s ... Change-Id: I6638860522896491dccfa12f1e520c0f23df6d66 Reviewed-on: https://go-review.googlesource.com/67791 Run-TryBot: Elias Naur <elias.naur@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-08-28misc/ios,src/iostest.bash: support GOIOS_DEVICE_IDElias Naur
When running multiple iOS builds on the same host, GOIOS_DEVICE_ID is used to distinguish the devices. To improve support, - Only restart the particular device when invoking iostest.bash with the -restart flag. - Make the exec wrapper lock file per-device. For the iOS builder. Change-Id: Id6f222981f25036399a43c3202a393dba89d87cb Reviewed-on: https://go-review.googlesource.com/57970 Run-TryBot: Elias Naur <elias.naur@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-08-21misc/ios: add support for device ids to the exec wrapperElias Naur
If set, GOIOS_DEVICE_ID specifies the device id for the iOS exec wrapper. With that, a single builder can host multiple iOS devices. Change-Id: If3cc049552f5edbd7344befda7b8d7f73b4236e2 Reviewed-on: https://go-review.googlesource.com/57296 Run-TryBot: Elias Naur <elias.naur@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: JBD <jbd@google.com> Reviewed-by: Chris Broadfoot <cbro@golang.org>
2017-04-27misc/ios: increase iOS test harness timeoutElias Naur
The "lldb start" phase often times out on the iOS builder. Increase the timeout and see if that helps. Change-Id: I92fd67cbfa90659600e713198d6b2c5c78dde20f Reviewed-on: https://go-review.googlesource.com/41863 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Elias Naur <elias.naur@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-04-17misc/ios: fix the Test386EndToEnd test on iOSElias Naur
Some tests need the src/runtime/textflag.h file. Make sure it is included in iOS test runs. Change-Id: I5e0e7ebe85679686ef15a7d336f28ac9b68a587a Reviewed-on: https://go-review.googlesource.com/40915 Run-TryBot: Elias Naur <elias.naur@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-03-04misc/ios,cmd/go, runtime/cgo: fix iOS test harness (again)Elias Naur
The iOS test harness was recently changed in response to lldb bugs to replace breakpoints with the SIGUSR2 signal (CL 34926), and to pass the current directory in the test binary arguments (CL 35152). Both the signal sending and working directory setup is done from the go test driver. However, the new method doesn't work with tests where a C program is the test driver instead of go test: the current working directory will not be changed and SIGUSR2 is not raised. Instead of copying that logic into any C test program, rework the test harness (again) to move the setup logic to the early runtime cgo setup code. That way, the harness will run even in the library build modes. Then, use the app Info.plist file to pass the working directory, removing the need to alter the arguments after running. Finally, use the SIGINT signal instead of SIGUSR2 to avoid manipulating the signal masks or handlers. Fixes the testcarchive tests on iOS. With this CL, both darwin/arm and darwin/arm64 passes all.bash. This CL replaces CL 34926, CL 35152 as well as the fixup CL 35123 and CL 35255. They are reverted in CLs earlier in the relation chain. Change-Id: I8485c7db1404fbd8daa261efd1ea89e905121a3e Reviewed-on: https://go-review.googlesource.com/36090 Run-TryBot: Elias Naur <elias.naur@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: David Crawshaw <crawshaw@golang.org>
2017-03-04Revert "cmd/go, misc: switch from breakpoint to SIGUSR2"Elias Naur
This reverts commit 333f764df3d78930a5a3097fc34ac1374b7c3187. Replaced by a improved strategy later in the CL relation chain. Change-Id: I70a1d2f0aa5aa0d3d0ec85b5a956c6fb60d88908 Reviewed-on: https://go-review.googlesource.com/36069 Run-TryBot: Elias Naur <elias.naur@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: David Crawshaw <crawshaw@golang.org>
2017-03-04Revert "cmd/go, misc: rework cwd handling for iOS tests"Elias Naur
This reverts commit 593ea3b3606a16da39e38406e22e373eeb944287. Replaced by a improved strategy later in the CL relation chain. Change-Id: I6963e4d1bf38e7028cf545a953e28054d83548 Change-Id: I6963e4d1bf38e7028cf545a953e28054d8354870 Reviewed-on: https://go-review.googlesource.com/36067 Reviewed-by: David Crawshaw <crawshaw@golang.org>
2017-03-04Revert "all: test adjustments for the iOS builder"Elias Naur
This reverts commit 467109bf56fb560d1fd8a27c6184dbfe4f64ffef. Replaced by a improved strategy later in the CL relation chain. Change-Id: Ib90813b5a6c4716b563c8496013d2d57f9c022b8 Reviewed-on: https://go-review.googlesource.com/36066 Reviewed-by: David Crawshaw <crawshaw@golang.org> Run-TryBot: Elias Naur <elias.naur@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-02-02misc/ios: allow exit code 0 to mean test successElias Naur
Tests that use TestMain might never call m.Run(), and simply return from TestMain. In that case, the iOS test harness never sees the PASS from the testing framework and assumes the test failed. Allow an exit with exit code 0 to also mean test success, thereby fixing the objdump test on iOS. Change-Id: I1fe9077b05931aa0905e41b88945cd153c5b35b6 Reviewed-on: https://go-review.googlesource.com/36065 Reviewed-by: David Crawshaw <crawshaw@golang.org> Run-TryBot: Elias Naur <elias.naur@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-02-01misc/ios: use the default go test timeoutElias Naur
If -test.timeout is not specified to go test, it will time out after a default 10 minutes. The iOS exec wrapper also contains a fail safe timeout mechanism for a stuck device. However, if no explicit -test.timeout is specified, it will use a timeout of 0, plus some constant amount. Use the same default timeout in the exec wrapper as for go test, 10 minutes. Change-Id: I6465ccd9f7b9ce08fa302e6697f7938a0ea9af34 Reviewed-on: https://go-review.googlesource.com/36062 Reviewed-by: David Crawshaw <crawshaw@golang.org> Run-TryBot: Elias Naur <elias.naur@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>