Skip to content

Commit

Permalink
Examples for cli instruments quit
Browse files Browse the repository at this point in the history
  • Loading branch information
jmoody committed Mar 31, 2015
1 parent 263e8a2 commit 29779be
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/run_loop/cli/instruments.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,16 @@ class Instruments < Thor


def quit

signal = options[:signal]
ENV['DEBUG'] = '1' if options[:debug]
instruments = RunLoop::Instruments.new
instruments.instruments_pids.each do |pid|
terminator = RunLoop::ProcessTerminator.new(pid, signal, 'instruments')
unless terminator.kill_process
terminator = RunLoop::ProcessTerminator.new(pid, 'KILL', 'instruments')
terminator.kill_process
end
end
end


Expand Down
34 changes: 34 additions & 0 deletions spec/integration/bin/instruments_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
require 'run_loop/cli/instruments'

describe RunLoop::CLI::Instruments do

context 'quit' do
it 'has help' do
expect(Luffa.unix_command('bundle exec run-loop instruments help quit',
{:exit_on_nonzero_status => false})).to be == 0
end

it 'can quit instruments' do
sim_control = RunLoop::SimControl.new
sim_control.reset_sim_content_and_settings

options =
{
:app => Resources.shared.cal_app_bundle_path,
:device_target => 'simulator',
:sim_control => sim_control
}

hash = nil
Retriable.retriable({:tries => Resources.shared.launch_retries}) do
hash = RunLoop.run(options)
end
expect(hash).not_to be nil

instruments = RunLoop::Instruments.new
expect(instruments.instruments_pids.count).to be == 1
expect(Luffa.unix_command('bundle exec run-loop instruments quit',
{:exit_on_nonzero_status => false})).to be == 0
end
end
end

0 comments on commit 29779be

Please sign in to comment.