run_loop 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 26a1ab6452d63edc6a2f13dba0fab7f401fda1e3
4
- data.tar.gz: 9364026efd7089138f57c1660c4dd9d0402a9801
3
+ metadata.gz: 2de16f5cb3f91a4a5d0cf8f056a4a128d0cb906a
4
+ data.tar.gz: 58244f2475fa2ea431e18022545e02498d86dc4a
5
5
  SHA512:
6
- metadata.gz: 73312b18f522ea556a06f8dc7f7257977629ca760ea5113ebab86666dd307586b86111742e514fddc59fef8acbb2380e4e92cf5400440f144bf41bac09aad130
7
- data.tar.gz: 0d3aa340d0408d6875e6d39ed3182b4c8a22c8a3ff68108ae0c822a3214c66abe522598ed9a77204477b8ae41b653625ca60ddfa168423bf77361964451a9456
6
+ metadata.gz: 4bd98dcee58d56074c95ada808a4fe0b19a05bf8ece5f8c5fedfd9d55119bf8e5bdee8831b5f7b50471053aea2bc676af682cbabe18a653479b19677890a9f2f
7
+ data.tar.gz: da03c9b79b3435b11fc832268ddd8bb72e05e9e52f9b3a0bd3070b2470be53a32cb6ffa1fe41d32f59ab8ba48326054512f9a892475d4f9bc25fb16394b39a47
@@ -4,6 +4,7 @@ require 'timeout'
4
4
  require 'json'
5
5
  require 'open3'
6
6
  require 'erb'
7
+ require 'ap'
7
8
 
8
9
  module RunLoop
9
10
 
@@ -29,6 +30,23 @@ module RunLoop
29
30
  SCRIPTS_PATH
30
31
  end
31
32
 
33
+ def self.log_run_loop_options(options, xctools)
34
+ return unless ENV['DEBUG'] == '1'
35
+ # Ignore :sim_control b/c it is a ruby object; printing is not useful.
36
+ ignored_keys = [:sim_control]
37
+ options_to_log = {}
38
+ options.each_pair do |key, value|
39
+ next if ignored_keys.include?(key)
40
+ options_to_log[key] = value
41
+ end
42
+ # Objects that override '==' cannot be printed by awesome_print
43
+ # https://github.com/michaeldv/awesome_print/issues/154
44
+ # RunLoop::Version overrides '=='
45
+ options_to_log[:xcode] = xctools.xcode_version.to_s
46
+ options_to_log[:xcode_path] = xctools.xcode_developer_dir
47
+ ap(options_to_log, {:sort_keys => true})
48
+ end
49
+
32
50
  # @deprecated since 1.0.0
33
51
  # still used extensively in calabash-ios launcher
34
52
  def self.above_or_eql_version?(target_version, xcode_version)
@@ -127,39 +145,26 @@ module RunLoop
127
145
 
128
146
  log_file ||= File.join(results_dir, 'run_loop.out')
129
147
 
130
- if ENV['DEBUG']=='1'
131
- exclude = [:device_target, :udid, :sim_control, :args, :inject_dylib, :app]
132
- options.each_pair { |key, value|
133
- unless exclude.include? key
134
- puts "#{key} => #{value}"
135
- end
136
- }
137
- puts "device_target=#{device_target}"
138
- puts "udid=#{udid}"
139
- puts "bundle_dir_or_bundle_id=#{bundle_dir_or_bundle_id}"
140
- puts "script=#{script}"
141
- puts "log_file=#{log_file}"
142
- puts "timeout=#{timeout}"
143
- puts "uia_strategy=#{options[:uia_strategy]}"
144
- puts "args=#{args}"
145
- puts "inject_dylib=#{inject_dylib}"
146
- end
147
-
148
148
  after = Time.now
149
-
150
149
  if ENV['DEBUG']=='1'
151
150
  puts "Preparation took #{after-before} seconds"
152
-
153
151
  end
154
152
 
155
- cmd = instruments_command(options.merge(:udid => udid,
156
- :results_dir_trace => results_dir_trace,
157
- :bundle_dir_or_bundle_id => bundle_dir_or_bundle_id,
158
- :results_dir => results_dir,
159
- :script => script,
160
- :log_file => log_file,
161
- :args => args),
162
- xctools)
153
+ discovered_options =
154
+ {
155
+ :udid => udid,
156
+ :results_dir_trace => results_dir_trace,
157
+ :bundle_dir_or_bundle_id => bundle_dir_or_bundle_id,
158
+ :results_dir => results_dir,
159
+ :script => script,
160
+ :log_file => log_file,
161
+ :args => args
162
+ }
163
+ merged_options = options.merge(discovered_options)
164
+
165
+ self.log_run_loop_options(merged_options, xctools)
166
+
167
+ cmd = instruments_command(merged_options, xctools)
163
168
 
164
169
  log_header("Starting on #{device_target} App: #{bundle_dir_or_bundle_id}")
165
170
  cmd_str = cmd.join(' ')
@@ -247,17 +252,11 @@ module RunLoop
247
252
  end
248
253
  rescue TimeoutError => e
249
254
  if ENV['DEBUG']
250
- puts "Failed to launch\n"
251
- puts "reason=#{e}: #{e && e.message} "
252
- puts "device_target=#{device_target}"
253
- puts "udid=#{udid}"
254
- puts "bundle_dir_or_bundle_id=#{bundle_dir_or_bundle_id}"
255
- puts "script=#{script}"
256
- puts "log_file=#{log_file}"
257
- puts "timeout=#{timeout}"
258
- puts "uia_strategy=#{uia_strategy}"
259
- puts "args=#{args}"
260
- puts "lldb_output=#{raw_lldb_output}" if raw_lldb_output
255
+ puts "Failed to launch."
256
+ puts "#{e}: #{e && e.message}"
257
+ if raw_lldb_output
258
+ puts "LLDB OUTPUT: #{raw_lldb_output}"
259
+ end
261
260
  end
262
261
  raise TimeoutError, "Time out waiting for UIAutomation run-loop to Start. \n Logfile #{log_file} \n\n #{File.read(log_file)}\n"
263
262
  end
@@ -1,5 +1,5 @@
1
1
  module RunLoop
2
- VERSION = '1.0.2'
2
+ VERSION = '1.0.3'
3
3
 
4
4
  # A model of a software release version that can be used to compare two versions.
5
5
  #
@@ -108,6 +108,14 @@ module RunLoop
108
108
  instruments = 'xcrun instruments'
109
109
  return instruments if cmd == nil
110
110
 
111
+ # Xcode 6 GM is spamming "WebKit Threading Violations"
112
+ stderr_filter = lambda { |stderr|
113
+ stderr.read.strip.split("\n").each do |line|
114
+ unless line[/WebKit Threading Violation/, 0]
115
+ $stderr.puts line
116
+ end
117
+ end
118
+ }
111
119
  case cmd
112
120
  when :version
113
121
  @instruments_version ||= lambda {
@@ -121,15 +129,24 @@ module RunLoop
121
129
  }.call
122
130
  when :sims
123
131
  @instruments_sims ||= lambda {
124
- devices = `#{instruments} -s devices`.chomp.split("\n")
125
- devices.select { |device| device.downcase.include?('simulator') }
132
+ # Instruments 6 spams a lot of error messages. I don't like to
133
+ # hide them, but they seem to be around to stay (Xcode 6 GM).
134
+ cmd = "#{instruments} -s devices"
135
+ Open3.popen3(cmd) do |_, stdout, stderr, _|
136
+ stderr_filter.call(stderr)
137
+ devices = stdout.read.chomp.split("\n")
138
+ devices.select { |device| device.downcase.include?('simulator') }
139
+ end
126
140
  }.call
127
141
 
128
142
  when :templates
129
143
  @instruments_templates ||= lambda {
130
144
  cmd = "#{instruments} -s templates"
131
145
  if self.xcode_version >= self.v60
132
- `#{cmd}`.split("\n").map { |elm| elm.strip.tr('"', '') }
146
+ Open3.popen3(cmd) do |_, stdout, stderr, _|
147
+ stderr_filter.call(stderr)
148
+ stdout.read.chomp.split("\n").map { |elm| elm.strip.tr('"', '') }
149
+ end
133
150
  elsif self.xcode_version >= self.v51
134
151
  `#{cmd}`.split("\n").delete_if do |path|
135
152
  not path =~ /tracetemplate/
@@ -146,13 +163,17 @@ module RunLoop
146
163
 
147
164
  when :devices
148
165
  @devices ||= lambda {
149
- all = `#{instruments} -s devices`.chomp.split("\n")
150
- valid = all.select { |device| device =~ /[a-f0-9]{40}/ }
151
- valid.map do |device|
152
- udid = device[/[a-f0-9]{40}/, 0]
153
- version = device[/(\d\.\d(\.\d)?)/, 0]
154
- name = device.split('(').first.strip
155
- RunLoop::Device.new(name, version, udid)
166
+ cmd = "#{instruments} -s devices"
167
+ Open3.popen3(cmd) do |_, stdout, stderr, _|
168
+ stderr_filter.call(stderr)
169
+ all = stdout.read.chomp.split("\n")
170
+ valid = all.select { |device| device =~ /[a-f0-9]{40}/ }
171
+ valid.map do |device|
172
+ udid = device[/[a-f0-9]{40}/, 0]
173
+ version = device[/(\d\.\d(\.\d)?)/, 0]
174
+ name = device.split('(').first.strip
175
+ RunLoop::Device.new(name, version, udid)
176
+ end
156
177
  end
157
178
  }.call
158
179
  else
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: run_loop
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karl Krukow
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-10 00:00:00.000000000 Z
11
+ date: 2014-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 1.3.3.1
55
+ - !ruby/object:Gem::Dependency
56
+ name: awesome_print
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 1.2.0
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 1.2.0
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: CFPropertyList
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -122,20 +136,6 @@ dependencies:
122
136
  - - "~>"
123
137
  - !ruby/object:Gem::Version
124
138
  version: '10.3'
125
- - !ruby/object:Gem::Dependency
126
- name: awesome_print
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - "~>"
130
- - !ruby/object:Gem::Version
131
- version: '1.2'
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - "~>"
137
- - !ruby/object:Gem::Version
138
- version: '1.2'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: guard-rspec
141
141
  requirement: !ruby/object:Gem::Requirement