fix(testrun): delete a java check that was dead and wrong

preflightDevice was called only after web and both iOS branches had already
returned, so it never saw a platform other than android, and it returns nil for
anything but ios. The comment above the call said it was Android's java check;
Android's java check is in runPreflight. Its premise was wrong too: a physical
iOS device is runner-only over usbmux and needs no JVM. The replacement test
asserts an iOS host with no java passes preflight.

Also corrects two comments in the same file that still described iOS as routing
through the JVM sidecar, one of them naming an IosDriverBackend type that exists
nowhere in the tree.
This commit is contained in:
pj committed 2026-08-22 21:37:58 +05:30
1 parent 658574b568
commit a2dbcd1579
3 files changed
+12 -47

No files matched your search

+5 -11
View File
@@ -138,11 +138,6 @@ func buildDriver(ctx context.Context, options Options, stdout io.Writer) (driver
return d, cleanup, nil
}
// Android uses the JVM sidecar, which requires java.
if err := preflightDevice(options.Platform); err != nil {
return nil, nil, err
}
sidecarDirectory := os.TempDir() + "/sanderling-sidecar"
jarPath, err := sidecarassets.Extract(sidecarDirectory)
if err != nil {
@@ -169,9 +164,8 @@ func buildDriver(ctx context.Context, options Options, stdout io.Writer) (driver
sidecarCommand.Stdout = stdout
sidecarCommand.Stderr = stdout
sidecarCommand.Env = android.EnvWithAndroidPlatformTools(os.Environ(), adbPath)
// SIGTERM lets the sidecar's shutdown hook stop the iOS XCTest runner.
// SIGKILL skips the hook and orphans an xcodebuild session that later
// restarts its runner and hijacks the simulator mid-run.
// SIGTERM lets the sidecar run its shutdown hook. SIGKILL skips it and
// leaves the adb connection and the device-side instrumentation behind.
sidecarCommand.Cancel = func() error {
return sidecarCommand.Process.Signal(syscall.SIGTERM)
}
@@ -190,9 +184,9 @@ func buildDriver(ctx context.Context, options Options, stdout io.Writer) (driver
}
driverClient.SetPlatform(options.Platform)
driverClient.SetClearStateReinstall(options.Device, options.AndroidAppPath, stdout)
// WaitForHealth confirms the gRPC sidecar is up. For iOS, the WDA warmup
// (absorbing the XCUITest startup race) runs inside IosDriverBackend.init
// in the sidecar - no additional sleep needed here.
// WaitForHealth confirms the gRPC sidecar is up. This path is Android
// only: iOS has not routed through the sidecar since the native companion
// replaced it, and buildDriver returns before reaching here.
healthCtx, healthCancel := context.WithTimeout(ctx, sidecarStartupTimeout)
healthErr := awaitSidecar(healthCtx, address, sidecarStartupTimeout, func(pollCtx context.Context) error {
return driverClient.WaitForHealth(pollCtx, 250e6)