calabash / run_loop

The bridge between Calabash iOS and Xcode command-line tools like instruments and simctl.
Other
32 stars 41 forks source link

Simulator process is determined incorrectly during simulator relaunch #715

Closed maxim-lobanov closed 5 years ago

maxim-lobanov commented 5 years ago

Issue: Test fails in run_loop/spec/integration/core_simulator_spec.rb RunLoop::CoreSimulator#launch_simulator does not relaunch if the simulator is already running

Test fails with error message: DEBUG: Simulator relaunch required: simulator was not launched by run_loop

Root cause: running_simulator_details function searches the first process with substring MacOS/#{sim_name}. On Mojave there are two processes that matches this substr:

6055 /Library/Developer/PrivateFrameworks/CoreSimulator.framework/Versions/A/XPCServices/SimulatorTrampoline.xpc/Contents/MacOS/SimulatorTrampoline
6105 /Xcode/10.2/Xcode.app/Contents/Developer/Applications/Simulator.app/Contents/MacOS/Simulator -CurrentDeviceUDID 6DE7902E-CAD6-4949-9037-C1A0319991FF -ConnectHardwareKeyboard 0 -DeviceBootTimeout 120 -DetatchOnAppQuit 0 -DetachOnWindowClose 0 LAUNCHED_BY_RUN_LOOP

Fix: We need to use more specific searching pattern for Simulator process. Since macOS command ps x -o pid=,command= returns the full path to the simulator we can use the full path as searching pattern.

maxim-lobanov commented 5 years ago

@jmoody , Please let us know if you see any drawbacks or possible regression with this approach

maxim-lobanov commented 5 years ago

Okay, I see that some tests failed, strange I have missed it locally. Looking

jmoody commented 5 years ago

The Jenkins CI machine is unstable. Expect failures.