Skip to content

Commit

Permalink
Merge branch 'main' into vk-accessibility
Browse files Browse the repository at this point in the history
  • Loading branch information
kvs-coder authored Jan 14, 2025
2 parents a560c85 + 0c06384 commit 70633d8
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 7 deletions.
26 changes: 26 additions & 0 deletions ios/testmanagerd/proxydispatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,32 @@ func (p proxyDispatcher) Dispatch(m dtx.Message) {
}

p.testListener.testCaseDidStartForClass(testClass, testMethod)
case "_XCT_testCaseDidStartWithIdentifier:iteration:":
argumentLengthErr := assertArgumentsLengthEqual(m, 2)
if argumentLengthErr != nil {
decoderErr = argumentLengthErr
break
}

testIdentifier, decoderErr := extractTestIdentifierArg(m, 0)
if decoderErr != nil {
break
}

p.testListener.testCaseDidStartForClass(testIdentifier.C[0], testIdentifier.C[1])
case "_XCT_testCaseDidStartWithIdentifier:":
argumentLengthErr := assertArgumentsLengthEqual(m, 1)
if argumentLengthErr != nil {
decoderErr = argumentLengthErr
break
}

testIdentifier, decoderErr := extractTestIdentifierArg(m, 0)
if decoderErr != nil {
break
}

p.testListener.testCaseDidStartForClass(testIdentifier.C[0], testIdentifier.C[1])
case "_XCT_testCaseDidStartWithIdentifier:testCaseRunConfiguration:":
argumentLengthErr := assertArgumentsLengthEqual(m, 2)
if argumentLengthErr != nil {
Expand Down
5 changes: 3 additions & 2 deletions ios/testmanagerd/xcuitestrunner.go
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,8 @@ func createTestConfigOnDevice(testSessionID uuid.UUID, info testInfo, houseArres

testBundleURL := path.Join(info.testApp.path, "PlugIns", xctestConfigFileName)

config := nskeyedarchiver.NewXCTestConfiguration(info.targetApp.bundleName, testSessionID, info.targetApp.bundleID, info.targetApp.path, testBundleURL, testsToRun, testsToSkip, isXCTest, version)
productModuleName := strings.ReplaceAll(xctestConfigFileName, ".xctest", "")
config := nskeyedarchiver.NewXCTestConfiguration(productModuleName, testSessionID, info.targetApp.bundleID, info.targetApp.path, testBundleURL, testsToRun, testsToSkip, isXCTest, version)
result, err := nskeyedarchiver.ArchiveXML(config)
if err != nil {
return "", nskeyedarchiver.XCTestConfiguration{}, err
Expand All @@ -564,7 +565,7 @@ func createTestConfigOnDevice(testSessionID uuid.UUID, info testInfo, houseArres
if err != nil {
return "", nskeyedarchiver.XCTestConfiguration{}, err
}
return xctestConfigPath, nskeyedarchiver.NewXCTestConfiguration(info.targetApp.bundleName, testSessionID, info.targetApp.bundleID, info.targetApp.path, testBundleURL, testsToRun, testsToSkip, isXCTest, version), nil
return xctestConfigPath, nskeyedarchiver.NewXCTestConfiguration(productModuleName, testSessionID, info.targetApp.bundleID, info.targetApp.path, testBundleURL, testsToRun, testsToSkip, isXCTest, version), nil
}

func createTestConfig(info testInfo, testSessionID uuid.UUID, xctestConfigFileName string, testsToRun []string, testsToSkip []string, isXCTest bool, version *semver.Version) nskeyedarchiver.XCTestConfiguration {
Expand Down
14 changes: 12 additions & 2 deletions ios/tunnel/tunnel_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func WaitUntilAgentReady() bool {
}
}

func RunAgent(args ...string) error {
func RunAgent(mode string, args ...string) error {
if IsAgentRunning() {
return nil
}
Expand All @@ -64,8 +64,18 @@ func RunAgent(args ...string) error {
return fmt.Errorf("RunAgent: failed to get executable path: %w", err)
}

cmd := exec.Command(ex, append([]string{"tunnel", "start"}, args...)...)
var cmd *exec.Cmd
switch mode {
case "kernel":
cmd = exec.Command(ex, append([]string{"tunnel", "start"}, args...)...)
case "user":
cmd = exec.Command(ex, append([]string{"tunnel", "start", "--userspace"}, args...)...)
default:
return fmt.Errorf("RunAgent: unknown mode: %s. Only 'kernel' and 'user' are supported", mode)
}

err = cmd.Start()

if err != nil {
return fmt.Errorf("RunAgent: failed to start agent: %w", err)
}
Expand Down
7 changes: 4 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,11 +297,12 @@ The commands work as following:
log.Debug(arguments)

skipAgent, _ := os.LookupEnv("ENABLE_GO_IOS_AGENT")
if skipAgent == "yes" {
tunnel.RunAgent()
if skipAgent == "user" || skipAgent == "kernel" {
tunnel.RunAgent(skipAgent)
}

if !tunnel.IsAgentRunning() {
log.Warn("go-ios agent is not running. You might need to start it with 'ios tunnel start' for ios17+. Use ENABLE_GO_IOS_AGENT=yes for experimental daemon mode.")
log.Warn("go-ios agent is not running. You might need to start it with 'ios tunnel start' for ios17+. Use ENABLE_GO_IOS_AGENT=user for userspace tunnel or ENABLE_GO_IOS_AGENT=kernel for kernel tunnel for the experimental daemon mode.")
}
shouldPrintVersionNoDashes, _ := arguments.Bool("version")
shouldPrintVersion, _ := arguments.Bool("--version")
Expand Down

0 comments on commit 70633d8

Please sign in to comment.