From: Elias Naur Date: Wed, 23 Aug 2017 11:35:24 +0000 (+0200) Subject: misc/ios,src/iostest.bash: support GOIOS_DEVICE_ID X-Git-Tag: go1.10beta1~1331 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=627d3a0b4c153a4d5c8d53f18083e4c5c133d429;p=gostls13.git misc/ios,src/iostest.bash: support GOIOS_DEVICE_ID 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 TryBot-Result: Gobot Gobot Reviewed-by: Ian Lance Taylor --- diff --git a/misc/ios/go_darwin_arm_exec.go b/misc/ios/go_darwin_arm_exec.go index cc57adb584..b49496cc10 100644 --- a/misc/ios/go_darwin_arm_exec.go +++ b/misc/ios/go_darwin_arm_exec.go @@ -100,7 +100,7 @@ func main() { // // The lock file is never deleted, to avoid concurrent locks on distinct // files with the same path. - lockName := filepath.Join(os.TempDir(), "go_darwin_arm_exec.lock") + lockName := filepath.Join(os.TempDir(), "go_darwin_arm_exec-"+deviceID+".lock") lock, err = os.OpenFile(lockName, os.O_CREATE|os.O_RDONLY, 0666) if err != nil { log.Fatal(err) diff --git a/src/iostest.bash b/src/iostest.bash index 595b675744..00cc49ec7e 100755 --- a/src/iostest.bash +++ b/src/iostest.bash @@ -32,11 +32,15 @@ if [ "$1" = "-restart" ]; then # Reboot to make sure previous runs do not interfere with the current run. # It is reasonably easy for a bad program leave an iOS device in an # almost unusable state. - idevicediagnostics restart + IDEVARGS= + if [ -n "$GOIOS_DEVICE_ID" ]; then + IDEVARGS="-u $GOIOS_DEVICE_ID" + fi + idevicediagnostics $IDEVARGS restart # Initial sleep to make sure we are restarting before we start polling. sleep 30 # Poll until the device has restarted. - until idevicediagnostics diagnostics; do + until idevicediagnostics $IDEVARGS diagnostics; do # TODO(crawshaw): replace with a test app using go_darwin_arm_exec. echo "waiting for idevice to come online" sleep 10