diff --git a/internal/driver/ioscompanion/device_test.go b/internal/driver/ioscompanion/device_test.go index 6865181..5cacfc0 100644 --- a/internal/driver/ioscompanion/device_test.go +++ b/internal/driver/ioscompanion/device_test.go @@ -195,15 +195,3 @@ func TestDeviceCloseStopsRunnerAndTunnel(t *testing.T) { t.Fatal("Close must close the usbmux tunnel") } } - -func equalArgs(got, want []string) bool { - if len(got) != len(want) { - return false - } - for i := range got { - if got[i] != want[i] { - return false - } - } - return true -} diff --git a/internal/driver/ioscompanion/devicerunner.go b/internal/driver/ioscompanion/devicerunner.go index cfea3d6..a26fc5b 100644 --- a/internal/driver/ioscompanion/devicerunner.go +++ b/internal/driver/ioscompanion/devicerunner.go @@ -176,7 +176,7 @@ func (d *Driver) buildDeviceRunnerIfNeeded(ctx context.Context, companionDir, de return nil } - if out, genErr := runQuiet(ctx, companionDir, xcodegenArgs(filepath.Join(companionDir, "project.yml"))...); genErr != nil { + if out, genErr := runQuiet(ctx, companionDir, "xcodegen", "--spec", filepath.Join(companionDir, "project.yml")); genErr != nil { return fmt.Errorf("xcodegen: %w: %s", genErr, strings.TrimSpace(string(out))) } @@ -204,11 +204,6 @@ func buildCacheKey(companionDir string, creds signingCredentials) (string, error return hex.EncodeToString(sum[:]), nil } -// xcodegenArgs regenerates the runner project from its spec. -func xcodegenArgs(specPath string) []string { - return []string{"xcodegen", "--spec", specPath} -} - // buildForTestingArgs builds the runner for a generic device destination, signed // through the App Store Connect API key with automatic provisioning. A generic // destination keeps the build off any specific booted device; the wildcard dev diff --git a/internal/driver/ioscompanion/devicerunner_test.go b/internal/driver/ioscompanion/devicerunner_test.go index 3777929..f0e3486 100644 --- a/internal/driver/ioscompanion/devicerunner_test.go +++ b/internal/driver/ioscompanion/devicerunner_test.go @@ -7,59 +7,6 @@ import ( "testing" ) -func TestBuildForTestingArgs(t *testing.T) { - creds := signingCredentials{team: "TEAM1", authKeyPath: "/k/AuthKey.p8", authKeyID: "KID", authIssuerID: "ISS"} - args := buildForTestingArgs("/p/CompanionRunner.xcodeproj", "/d/derived", creds) - joined := strings.Join(args, " ") - for _, want := range []string{ - "xcodebuild build-for-testing", - "-project /p/CompanionRunner.xcodeproj", - "-scheme CompanionRunner", - "-destination generic/platform=iOS", - "-derivedDataPath /d/derived", - "-allowProvisioningUpdates", - "-authenticationKeyPath /k/AuthKey.p8", - "-authenticationKeyID KID", - "-authenticationKeyIssuerID ISS", - "CODE_SIGNING_ALLOWED=YES", - "CODE_SIGNING_REQUIRED=YES", - "CODE_SIGN_STYLE=Automatic", - "DEVELOPMENT_TEAM=TEAM1", - "GENERATE_INFOPLIST_FILE=YES", - } { - if !strings.Contains(joined, want) { - t.Errorf("build args missing %q in %q", want, joined) - } - } -} - -func TestTestWithoutBuildingArgs(t *testing.T) { - creds := signingCredentials{team: "TEAM1", authKeyPath: "/k/AuthKey.p8", authKeyID: "KID", authIssuerID: "ISS"} - args := testWithoutBuildingArgs("/x/run.xctestrun", "00008140-HW", creds) - joined := strings.Join(args, " ") - for _, want := range []string{ - "xcodebuild test-without-building", - "-xctestrun /x/run.xctestrun", - "-destination platform=iOS,id=00008140-HW", - "-allowProvisioningUpdates", - "-authenticationKeyPath /k/AuthKey.p8", - "-authenticationKeyID KID", - "-authenticationKeyIssuerID ISS", - } { - if !strings.Contains(joined, want) { - t.Errorf("test args missing %q in %q", want, joined) - } - } -} - -func TestXcodegenArgs(t *testing.T) { - args := xcodegenArgs("/c/project.yml") - want := []string{"xcodegen", "--spec", "/c/project.yml"} - if !equalArgs(args, want) { - t.Fatalf("xcodegen args = %v, want %v", args, want) - } -} - func TestTestTargetNameFromJSON(t *testing.T) { // A device xctestrun-as-json: one test-target dict plus the metadata entry. data := []byte(`{