]> Cypherpunks.ru repositories - gostls13.git/commitdiff
misc/ios: add support for device ids to the exec wrapper
authorElias Naur <elias.naur@gmail.com>
Sun, 20 Aug 2017 16:57:18 +0000 (18:57 +0200)
committerChris Broadfoot <cbro@golang.org>
Mon, 21 Aug 2017 21:08:17 +0000 (21:08 +0000)
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>
misc/ios/go_darwin_arm_exec.go

index e84e513f933b3532717cf16fd578418252493926..cc57adb584aa036b1b821fd6d0699064dfb32bf0 100644 (file)
@@ -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, " "))
        }