From: Elias Naur Date: Sun, 20 Aug 2017 16:57:18 +0000 (+0200) Subject: misc/ios: add support for device ids to the exec wrapper X-Git-Tag: go1.10beta1~1428 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=1a2ac46edd162366e685a5fb782cd20adc1e36fa;p=gostls13.git misc/ios: add support for device ids to the exec wrapper 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 TryBot-Result: Gobot Gobot Reviewed-by: JBD Reviewed-by: Chris Broadfoot --- diff --git a/misc/ios/go_darwin_arm_exec.go b/misc/ios/go_darwin_arm_exec.go index e84e513f93..cc57adb584 100644 --- a/misc/ios/go_darwin_arm_exec.go +++ b/misc/ios/go_darwin_arm_exec.go @@ -49,6 +49,7 @@ var ( appID string teamID string bundleID string + deviceID string ) // lock is a file lock to serialize iOS runs. It is global to avoid the @@ -77,6 +78,9 @@ func main() { // https://developer.apple.com/membercenter/index.action#accountSummary as Team ID. teamID = getenv("GOIOS_TEAM_ID") + // Device IDs as listed with ios-deploy -c. + deviceID = os.Getenv("GOIOS_DEVICE_ID") + parts := strings.SplitN(appID, ".", 2) // For compatibility with the old builders, use a fallback bundle ID bundleID = "golang.gotest" @@ -294,7 +298,7 @@ func newSession(appdir string, args []string, opts options) (*lldbSession, error if err != nil { return nil, err } - s.cmd = exec.Command( + cmdArgs := []string{ // lldb tries to be clever with terminals. // So we wrap it in script(1) and be clever // right back at it. @@ -307,9 +311,13 @@ func newSession(appdir string, args []string, opts options) (*lldbSession, error "-u", "-r", "-n", - `--args=`+strings.Join(args, " ")+``, + `--args=` + strings.Join(args, " ") + ``, "--bundle", appdir, - ) + } + if deviceID != "" { + cmdArgs = append(cmdArgs, "--id", deviceID) + } + s.cmd = exec.Command(cmdArgs[0], cmdArgs[1:]...) if debug { log.Println(strings.Join(s.cmd.Args, " ")) }