parallelized_specs 0.4.28 → 0.4.29

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -12,7 +12,7 @@ begin
12
12
  gem.email = "jake@instructure.com"
13
13
  gem.homepage = "http://github.com/jakesorce/#{gem.name}"
14
14
  gem.authors = "Jake Sorce, Bryan Madsen, Shawn Meredith"
15
- gem.version = "0.4.28"
15
+ gem.version = "0.4.29"
16
16
  end
17
17
  Jeweler::GemcutterTasks.new
18
18
  rescue LoadError
@@ -9,6 +9,7 @@ require 'parallelized_specs/outcome_builder'
9
9
  require 'parallelized_specs/example_failures_logger'
10
10
  require 'parallelized_specs/trending_example_failures_logger'
11
11
  require 'parallelized_specs/failures_rerun_logger'
12
+ require 'parallelized_specs/slowest_specs_logger'
12
13
 
13
14
 
14
15
  class ParallelizedSpecs
@@ -107,6 +108,8 @@ class ParallelizedSpecs
107
108
  run_tests(group, groups.index(group), options)
108
109
  end
109
110
 
111
+ slowest_spec_determination("#{RAILS_ROOT}/tmp/parallel_log/slowest_specs.log")
112
+
110
113
  #parse and print results
111
114
  results = find_results(test_results.map { |result| result[:stdout] }*"")
112
115
  #puts ""
@@ -166,6 +169,32 @@ class ParallelizedSpecs
166
169
  [num_processes.to_i, pattern.to_s]
167
170
  end
168
171
 
172
+ def self.slowest_spec_determination(file)
173
+ if File.exists?(file)
174
+ spec_durations = []
175
+ File.open(file).each_line do |line|
176
+ spec_durations << line
177
+ end
178
+ File.open(file, 'w') { |f| f.truncate(0) }
179
+ populate_slowest_specs(spec_durations, file)
180
+ else
181
+ puts "slow spec profiling was not enabled"
182
+ end
183
+ end
184
+
185
+ def self.populate_slowest_specs(spec_durations, file)
186
+ slowest_specs = []
187
+ spec_durations.each do |spec|
188
+ time = spec.match(/.*\d/).to_s
189
+ if time.to_f >= 30
190
+ slowest_specs << spec
191
+ end
192
+ end
193
+ slowest_specs.each do |slow_spec|
194
+ File.open(file, 'a+') { |f| f.puts slow_spec }
195
+ end
196
+ end
197
+
169
198
  # finds all tests and partitions them into groups
170
199
  def self.tests_in_groups(tests, num_groups, options)
171
200
  if options[:no_sort]
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "parallelized_specs"
8
- s.version = "0.4.28"
8
+ s.version = "0.4.29"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jake Sorce, Bryan Madsen, Shawn Meredith"]
12
- s.date = "2013-03-22"
12
+ s.date = "2013-03-26"
13
13
  s.email = "jake@instructure.com"
14
14
  s.files = [
15
15
  "Gemfile",
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parallelized_specs
3
3
  version: !ruby/object:Gem::Version
4
- hash: 55
4
+ hash: 53
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 28
10
- version: 0.4.28
9
+ - 29
10
+ version: 0.4.29
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jake Sorce, Bryan Madsen, Shawn Meredith
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2013-03-22 00:00:00 Z
18
+ date: 2013-03-26 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: parallel