flaky 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e23714d41d018b276cb0ec58deaa1b45a45a8d1f
4
- data.tar.gz: d94c47c3d8e0d0a1e6536a33e8b021f799f9540e
3
+ metadata.gz: 12f730870c9c64675c02b19ff57381991a1ef42e
4
+ data.tar.gz: a49813af98d00d27ab97a19049e600cd31497271
5
5
  SHA512:
6
- metadata.gz: d52098355aedf5d4d102ba48f18840e7fcef611dc9186c1cbcec06c5887ab393c7e99f37baf01ffdb1f12a916de88ef6da7673199897c20e33d6071fbdbaaaf3
7
- data.tar.gz: 55ad8c6da8aa5565b37cef446a53508e67dd1ce16423b9d96babe4ba3e2a6f1b35ba9fe71a965713241db8771ef5afe86a1ef42db817dd3e81aff393d7838624
6
+ metadata.gz: 722025d90f0d8a51fc1d19fa99af0241e1a01959eea66b0cf147fa201308b145009f824809e7de56fb08aa80c6963c315222fdfe41c3a183444cad6383b0ee02
7
+ data.tar.gz: d2367175c716d5072fce2b709b017340eaf1a6e24a6cd6991daac65ecdfccde418bb1845dbd85c48162ad430997cfbc143e78d02401af28dc5c16196c78ad7bd
data/lib/flaky.rb CHANGED
@@ -8,8 +8,8 @@ require 'escape_utils'
8
8
  require 'posix/spawn' # http://rubygems.org/gems/posix-spawn
9
9
 
10
10
  module Flaky
11
- VERSION = '0.0.5' unless defined? ::Flaky::VERSION
12
- DATE = '2013-09-30' unless defined? ::Flaky::DATE
11
+ VERSION = '0.0.6' unless defined? ::Flaky::VERSION
12
+ DATE = '2013-10-03' unless defined? ::Flaky::DATE
13
13
 
14
14
  # https://github.com/appium/ruby_lib/blob/0e203d76610abd519ba9d2fe9c14b50c94df5bbd/lib/appium_lib.rb#L24
15
15
  def self.add_to_path file, path=false
@@ -21,6 +21,7 @@ module Flaky
21
21
 
22
22
  add_to_path __FILE__ # add this dir to path
23
23
 
24
+ # TODO: Use require_relative instead of add_to_path
24
25
  # require internal files
25
26
  require 'flaky/appium'
26
27
  require 'flaky/log'
data/lib/flaky/appium.rb CHANGED
@@ -1,9 +1,25 @@
1
1
  # encoding: utf-8
2
2
  module Flaky
3
+
4
+ class Cmd
5
+ attr_reader :pid, :in, :out, :err
6
+
7
+ def initialize cmd
8
+ @pid, @in, @out, @err = POSIX::Spawn::popen4 cmd
9
+ @in.close
10
+ end
11
+
12
+ def stop
13
+ [@in, @out, @err].each { |io| io.close unless io.nil? || io.closed? }
14
+ Process.kill 'KILL', @pid
15
+ Process.waitpid @pid
16
+ end
17
+ end
18
+
3
19
  #noinspection RubyResolve
4
20
  class Appium
5
21
  include POSIX::Spawn
6
- attr_reader :ready, :pid, :in, :out, :err, :log
22
+ attr_reader :ready, :pid, :in, :out, :err, :log, :tail
7
23
  @@thread = nil
8
24
 
9
25
  def self.remove_ios_apps
@@ -20,7 +36,7 @@ module Flaky
20
36
  end
21
37
 
22
38
  def self.kill_all process_name
23
- _pid, _in, _out, _err = POSIX::Spawn::popen4('killall', '-9', process_name)
39
+ _pid, _in, _out, _err = POSIX::Spawn::popen4('killall', '-9', process_name)
24
40
  raise "Unable to kill #{process_name}" unless _pid
25
41
  _in.close
26
42
  _out.read
@@ -34,6 +50,7 @@ module Flaky
34
50
  @ready = false
35
51
  @pid, @in, @out, @err = nil
36
52
  @log = ''
53
+ @tail = nil
37
54
  end
38
55
 
39
56
  def go
@@ -50,6 +67,8 @@ module Flaky
50
67
  while !self.ready
51
68
  sleep 0.5
52
69
  end
70
+
71
+ @tail = Cmd.new 'tail -f /var/log/system.log'
53
72
  end
54
73
 
55
74
  ##
@@ -108,6 +127,8 @@ module Flaky
108
127
  end unless @pid.nil?
109
128
  @pid = nil
110
129
  self.end_all_nodes
130
+
131
+ @tail.stop if @tail
111
132
  end
112
133
  end # class Appium
113
134
  end # module Flaky
data/lib/flaky/run.rb CHANGED
@@ -106,6 +106,13 @@ module Flaky
106
106
  log_name = File.join result_dir, pass_str, log_name
107
107
  Flaky.write log_name, log
108
108
 
109
+ log_name = "#{postfix}.server.log.txt"
110
+ log_name = File.join result_dir, pass_str, log_name
111
+
112
+ File.open(log_name, 'w') do |f|
113
+ f.write appium.tail.out.readpartial(999_999_999)
114
+ end
115
+
109
116
  appium_log_name = File.join result_dir, pass_str, "#{postfix}.appium.html"
110
117
  Flaky.write appium_log_name, appium.log
111
118
 
@@ -36,6 +36,7 @@ module Flaky
36
36
  flaky.execute run_cmd: run_cmd, test_name: test_name, appium: appium
37
37
  end
38
38
 
39
+ appium.stop
39
40
  flaky.report
40
41
  end
41
42
  end # module Flaky
data/readme.md CHANGED
@@ -1,4 +1,4 @@
1
- #### flaky [![Gem Version](https://badge.fury.io/rb/flaky.png)](http://rubygems.org/gems/flaky) [![Dependency Status](https://gemnasium.com/bootstraponline/flaky.png)](https://gemnasium.com/bootstraponline/flaky)
1
+ #### flaky [![Gem Version](https://badge.fury.io/rb/flaky.png)](http://rubygems.org/gems/flaky) [![Dependency Status](https://gemnasium.com/appium/flaky.png)](https://gemnasium.com/appium/flaky)
2
2
 
3
3
  Run Appium iOS tests to measure flakiness.
4
4
 
@@ -12,4 +12,15 @@ Must set `ENV['APPIUM_HOME']` to point to the appium folder containing `server.j
12
12
  This only works with:
13
13
 
14
14
  - [Ruby / appium_lib iOS](https://github.com/appium/ruby_lib_ios)
15
- - iOS iPhone Simulator 6.1
15
+ - iOS iPhone Simulator 6.1
16
+
17
+ --
18
+
19
+ #### For each test:
20
+
21
+ - iOS Simulator is closed
22
+ - All `iPhone Simulator/6.1/Applications/*` are removed
23
+ - Appium server is restarted
24
+ - [spec](https://github.com/bootstraponline/spec) test logs are saved and colored
25
+ - Appium logs are saved and colored
26
+ - iOS Simulator logs are saved `/var/log/system.log`
data/release_notes.md CHANGED
@@ -1,3 +1,15 @@
1
+ #### v0.0.5 2013-09-30
2
+
3
+ - [f4c64f7](https://github.com/appium/flaky/commit/f4c64f721f80bc0ce6519ce3f115486cd097d4e0) Release 0.0.5
4
+ - [55a772c](https://github.com/appium/flaky/commit/55a772c264c4ead55487f0daf839ea8e307db483) Detect invalid appium home
5
+ - [eaa9282](https://github.com/appium/flaky/commit/eaa9282a073d19c56b7e33612c157adab5c7d242) Update
6
+ - [04cf471](https://github.com/appium/flaky/commit/04cf471799ff02174403739849062d4d9db234e8) Add badges
7
+ - [1f20686](https://github.com/appium/flaky/commit/1f20686c84e81408c87bce41d51e6381205bf3b4) Fix appium discovery
8
+ - [d603941](https://github.com/appium/flaky/commit/d603941210edd806638abca243163cc74eb779bf) Add readme
9
+ - [6965112](https://github.com/appium/flaky/commit/69651128a79cd06674547f9f92e9acd76a4f9a4a) Don't save uncolored duplicate log
10
+ - [0b255c8](https://github.com/appium/flaky/commit/0b255c82e90070fe64ba3e4001c93111f83b7725) Rename executable to flake
11
+
12
+
1
13
  #### v0.0.4 2013-09-27
2
14
 
3
15
  - [7e9918f](https://github.com/appium/flaky/commit/7e9918f5a5dbf7027e448e177780be68857d11fa) Release 0.0.4
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flaky
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - code@bootstraponline.com
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-30 00:00:00.000000000 Z
11
+ date: 2013-10-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chronic_duration
@@ -110,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
110
110
  version: '0'
111
111
  requirements: []
112
112
  rubyforge_project:
113
- rubygems_version: 2.0.6
113
+ rubygems_version: 2.1.5
114
114
  signing_key:
115
115
  specification_version: 4
116
116
  summary: Measure flaky Ruby Appium tests