plu / simctl

Ruby interface to xcrun simctl
http://www.rubydoc.info/gems/simctl
MIT License
104 stars 19 forks source link

Simctl doesn't work with XCode 8.1 / iOS 10.1 #8

Closed stowy closed 7 years ago

stowy commented 7 years ago

Trying to launch a simulator with iOS10.1 in XCode 8.1 build tools fails with:

#<SimCtl::Runtime:0x007fb11027c3d8>
#<SimCtl::DeviceType:0x007fb110285118>
Creating device Test device
/Library/Ruby/Gems/2.0.0/gems/simctl-1.5.5/lib/simctl/executor.rb:11:in `read': execution expired (Timeout::Error)
    from /Library/Ruby/Gems/2.0.0/gems/simctl-1.5.5/lib/simctl/executor.rb:11:in `block in execute'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/open3.rb:217:in `popen_run'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/open3.rb:99:in `popen3'
    from /Library/Ruby/Gems/2.0.0/gems/simctl-1.5.5/lib/simctl/executor.rb:10:in `execute'
    from /Library/Ruby/Gems/2.0.0/gems/simctl-1.5.5/lib/simctl/command/list.rb:27:in `list_devices'
    from /Library/Ruby/Gems/2.0.0/gems/simctl-1.5.5/lib/simctl/command/list.rb:11:in `device'
    from /Library/Ruby/Gems/2.0.0/gems/simctl-1.5.5/lib/simctl.rb:32:in `method_missing'
    from /Library/Ruby/Gems/2.0.0/gems/simctl-1.5.5/lib/simctl/device.rb:158:in `block (2 levels) in wait!'
    from /Library/Ruby/Gems/2.0.0/gems/simctl-1.5.5/lib/simctl/device.rb:157:in `loop'
    from /Library/Ruby/Gems/2.0.0/gems/simctl-1.5.5/lib/simctl/device.rb:157:in `block in wait!'
    from /Library/Ruby/Gems/2.0.0/gems/simctl-1.5.5/lib/simctl/device.rb:156:in `wait!'
    from /Library/Ruby/Gems/2.0.0/gems/simctl-1.5.5/lib/simctl/command/create.rb:20:in `create_device'
    from /Library/Ruby/Gems/2.0.0/gems/simctl-1.5.5/lib/simctl/command/reset.rb:22:in `reset_device'
    from /Library/Ruby/Gems/2.0.0/gems/simctl-1.5.5/lib/simctl.rb:32:in `method_missing'
    from scripts/multisim_test.rb:84:in `<main>'
plu commented 7 years ago

Can you please share the code so I can try to reproduce the issue?

stowy commented 7 years ago

sure, let me just test locally after installing the update, i was using a beta version of XCode 8.1

stowy commented 7 years ago

this is the code that isn't running currently:

  require 'simctl'
  puts SimCtl::Runtime.latest(:ios).name
  puts SimCtl.devicetype(name: 'iPhone 6').name

  # Destroy and create devices for given name, type and os version
  runtime = SimCtl::Runtime.latest(:ios)

  name = $options.sim_name
  device = SimCtl.device({"name"=>name})
  created = false
  if device == nil then
    puts "Creating device #{name}"
    device = SimCtl.create_device(name, SimCtl.devicetype(name: 'iPhone 6'), runtime)
    created = true
  end

  if (device.state != :booted) then
    puts "Booting device #{name}"
    device.launch!
    device.wait!{|d| d.state == :booted }
    if !$options.boot_only && !$options.build then
      # Wait for sim to load before running tests
      if created then
        sleep 10
      end
      sleep 5
    end
  end

I think the failure we're seeing is at the wait command

stowy commented 7 years ago

Never mind, seems i was wrong, is working after the latest update. Thanks for your attention and very useful tool!

plu commented 7 years ago

Perfect! Thanks for the feedback!