parallelized_specs 0.4.45 → 0.4.46

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.
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.45"
15
+ gem.version = "0.4.46"
16
16
  end
17
17
  Jeweler::GemcutterTasks.new
18
18
  rescue LoadError
data/Readme.md CHANGED
@@ -1,5 +1,6 @@
1
1
  Speedup Test::RSpec by running parallel on multiple CPUs (or cores).<br/>
2
2
  ParallelizedSpecs splits tests into even groups(by number of tests or runtime) and runs each group in a single process with its own database.
3
+ Optional rerunning of failed specs allowing intermittent specs to not cause builds to fail with configurable max failures to try to rerun post build.
3
4
 
4
5
  Setup for Rails
5
6
  ===============
@@ -117,6 +118,10 @@ SpecFailuresLogger
117
118
 
118
119
  This logger produces pasteable command-line snippets for each failed example.
119
120
 
121
+ This also stores all failures in this file for later consumption during in optional RERUN process
122
+ which can rerun all failed specs and potentially change the pass\fail outcome of a build if all specs pass.
123
+ Enable this formatter
124
+
120
125
  E.g.
121
126
 
122
127
  rspec /path/to/my_spec.rb:123 # should do something
@@ -132,6 +137,77 @@ Add the following to your `spec/parallelized_spec.opts` (or `spec/spec.opts`) :
132
137
  --format progress
133
138
  --format ParallelizedSpecs::SpecFailuresLogger --out tmp/failing_specs.log
134
139
 
140
+ FailuresFormatter
141
+ -----------------------
142
+ **REQUIRED FOR RERUNS** *Note reruns cause some more false positive handling in multiple spots during runtime
143
+ and should also include the OutcomeBuilder formatter explained separately which handles these conditions*
144
+
145
+
146
+ This formatter captures all needed data about failed examples and stores them in a file for an additional run
147
+ at the end of the first build. If all specs that failed the first time pass the build will be marked as passed in the exit status
148
+ The output location defined below is not optional and if this formatter is used must not be changed.
149
+
150
+ Use default MAX_RERUNS of 9 or set max number of failed specs to be allowed for reruns by exporting environment variable
151
+ export RERUNS=10
152
+
153
+ E.g.
154
+
155
+
156
+ Add the following to your `spec/parallelized_spec.opts` (or `spec/spec.opts`) :
157
+
158
+ RSpec 1.x:
159
+ --format progress
160
+ --require parallelized_specs/failures_rerun_logger
161
+ --format ParallelizedSpecs::SpecFailuresLogger:tmp/parallel_log/rspec.failures
162
+ RSpec >= 2.4:
163
+ If installed as plugin: -I vendor/plugins/parallelized_specs/lib
164
+ --format progress
165
+ --format ParallelizedSpecs::SpecFailuresLogger --out tmp/parallel_log/rspec.failures
166
+
167
+ OutcomeBuilder
168
+ -----------------------
169
+ **RECOMMENDED WITH RERUNS** *Note reruns cause some more false positive handling in multiple spots during runtime
170
+ and should also include the OutcomeBuilder formatter*
171
+
172
+
173
+ Because previously the pass\fail determination was solely on exit status and now we do things besides always fail on non 0 exits
174
+ we must handle many other causes of non 0 exit codes that we don't want to start the rerun process if they happen
175
+
176
+ E.g.
177
+
178
+
179
+ Add the following to your `spec/parallelized_spec.opts` (or `spec/spec.opts`) :
180
+
181
+ RSpec 1.x:
182
+ --format progress
183
+ --require parallelized_specs/outcome_builder
184
+ --format ParallelizedSpecs::SpecFailuresLogger:tmp/parallel_log/outcome_builder.txt
185
+ RSpec >= 2.4:
186
+ If installed as plugin: -I vendor/plugins/parallelized_specs/lib
187
+ --format progress
188
+ --format ParallelizedSpecs::SpecFailuresLogger --out tmp/parallel_log/outcome_builder.txt
189
+
190
+ TrendingExampleFailures
191
+ -----------------------
192
+ Create a single * delimited text file with all failed examples failure information
193
+ No built in interface to populate a database with these
194
+
195
+ E.g.
196
+
197
+
198
+ Add the following to your `spec/parallelized_spec.opts` (or `spec/spec.opts`) :
199
+ RSpec 1.x:
200
+ --format progress
201
+ --require parallelized_specs/trending_example_failures_logger
202
+ --format ParallelizedSpecs::SpecFailuresLogger:tmp/parallel_log/trends.log
203
+ RSpec >= 2.4:
204
+ If installed as plugin: -I vendor/plugins/parallelized_specs/lib
205
+ --format progress
206
+ --format ParallelizedSpecs::SpecFailuresLogger --out tmp/parallel_log/trends.log
207
+
208
+
209
+
210
+
135
211
  Setup for non-rails
136
212
  ===================
137
213
  sudo gem install parallelized_specs
@@ -156,6 +232,8 @@ TIPS
156
232
  - [ActiveRecord] if you do not have `db:abort_if_pending_migrations` add this to your Rakefile: `task('db:abort_if_pending_migrations'){}`
157
233
  - `export PARALLEL_TEST_PROCESSORS=X` in your environment and parallelized_specs will use this number of processors by default
158
234
  - with zsh this would be `rake "parallel:prepare[3]"`
235
+ - [RERUNS] if your using reruns formatter also use the outcome builder to make your builds handle syntax issues in some threads files
236
+ and thread crashes more cleanly
159
237
 
160
238
  Authors
161
239
  ====
@@ -166,5 +244,7 @@ based loosely from https://github.com/grosser/parallel_tests
166
244
  - [Bryan Madsen](http://github.com/bmad)
167
245
 
168
246
  [Jake Sorce](http://github.com/jakesorce)<br/>
247
+
248
+ [Shawn Meredith](https://github.com/smeredith0506)<br/>
169
249
  Hereby placed under public domain, do what you want, just do not hold me accountable...<br/>
170
250
  [![Flattr](http://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=jakesorce&url=https://github.com/jakesorce/parallelized_specs&title=parallelized_specs&language=en_GB&tags=github&category=software)
@@ -10,7 +10,7 @@ require 'parallelized_specs/example_failures_logger'
10
10
  require 'parallelized_specs/trending_example_failures_logger'
11
11
  require 'parallelized_specs/failures_rerun_logger'
12
12
  require 'parallelized_specs/slow_spec_logger'
13
-
13
+ require 'fileutils'
14
14
 
15
15
  class ParallelizedSpecs
16
16
  VERSION = File.read(File.join(File.dirname(__FILE__), '..', 'VERSION')).strip
@@ -84,7 +84,8 @@ class ParallelizedSpecs
84
84
  end
85
85
 
86
86
  def self.run_specs(tests, options)
87
- formatters = formatters_used
87
+ formatters = formatters_setup
88
+
88
89
  num_processes = options[:count] || Parallel.processor_count
89
90
  name = 'spec'
90
91
 
@@ -120,16 +121,40 @@ class ParallelizedSpecs
120
121
  failed = test_results.any? { |result| result[:exit_status] != 0 } #ruby 1.8.7 works breaks on 1.9.3
121
122
  formatters.any? { |formatter| formatter.match(/FailuresFormatter/) } ? rerun_initializer(name, failed) : abort("SEVERE: #{name.capitalize}s Failed") if failed
122
123
  puts "INFO: marking build as PASSED"
123
- end
124
+ end
124
125
 
125
- def self.formatters_used
126
+ def self.formatters_setup
126
127
  formatters = []
127
128
  File.open("#{Rails.root}/spec/spec.opts").each_line do |line|
128
129
  formatters << line
129
130
  end
131
+ formatter_directory_management(formatters)
130
132
  formatters
131
133
  end
132
134
 
135
+ def self.formatter_directory_management(formatters)
136
+ FileUtils.mkdir_p('parallel_log') if !File.directory?('tmp/parallel_log')
137
+ if formatters.any? { |formatter| formatter.match(/FailuresFormatter/) }
138
+ begin
139
+ %w['tmp/parallel_log/spec_count','tmp/parallel_log/failed_specs', 'tmp/parallel_log/thread_started'].each do |dir|
140
+ directory_cleanup_and_create(dir)
141
+ end
142
+ rescue SystemCallError
143
+ $stderr.print "directory management error " + $!
144
+ raise
145
+ end
146
+ end
147
+ end
148
+
149
+ def directory_cleanup_and_create(dir)
150
+ if File.directory?(dir)
151
+ FileUtils.rm_rf(dir)
152
+ FileUtils.mkdir_p(dir)
153
+ else
154
+ FileUtils.mkdir_p(dir)
155
+ end
156
+ end
157
+
133
158
  def self.rerun_initializer(name, failed)
134
159
  if Dir.glob("#{Rails.root}/tmp/parallel_log/failed_specs/{*,.*}").count > 2 && !File.zero?("#{Rails.root}/tmp/parallel_log/rspec.failures") # works on both 1.8.7\1.9.3
135
160
  puts "INFO: some specs failed, about to start the rerun process\n INFO: no more than 9 specs may be rerun and shared specs are not allowed\n...\n..\n."
@@ -515,6 +540,7 @@ class ParallelizedSpecs
515
540
  File.open(file, 'a+') { |f| f.puts slow_spec }
516
541
  end
517
542
  end
543
+
518
544
  end
519
545
 
520
546
 
@@ -20,7 +20,11 @@ class ParallelizedSpecs::TrendingExampleFailures < ParallelizedSpecs::SpecLogger
20
20
  def dump_pending(*args);end
21
21
 
22
22
  def dump_summary(*args)
23
- @hudson_build_info = File.read("#{RAILS_ROOT}/spec/build_info.txt")
23
+ if File.exists?("#{Rails.root}/spec/build_info.txt")
24
+ @hudson_build_info = File.read("#{Rails.root}/spec/build_info.txt")
25
+ else
26
+ @hudson_build_info = "no*hudson build*info"
27
+ end
24
28
  lock_output do
25
29
  (@failed_examples||{}).each_pair do |example, details|
26
30
  @output.puts "#{example}#{details}#{@hudson_build_info}"
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "parallelized_specs"
8
- s.version = "0.4.45"
8
+ s.version = "0.4.46"
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-04-05"
12
+ s.date = "2013-04-09"
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: 85
4
+ hash: 83
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 45
10
- version: 0.4.45
9
+ - 46
10
+ version: 0.4.46
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-04-05 00:00:00 Z
18
+ date: 2013-04-09 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: parallel