parallelized_specs 0.3.98 → 0.3.99

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.3.98"
15
+ gem.version = "0.3.99"
16
16
  end
17
17
  Jeweler::GemcutterTasks.new
18
18
  rescue LoadError
@@ -98,10 +98,10 @@ class ParallelizedSpecs
98
98
  num_processes = groups.size
99
99
 
100
100
  #adjust processes to groups
101
- abort "no #{name}s found!" if groups.size == 0
101
+ abort "SEVERE: no #{name}s found!" if groups.size == 0
102
102
 
103
103
  num_tests = groups.inject(0) { |sum, item| sum + item.size }
104
- puts "#{num_processes} processes for #{num_tests} #{name}s, ~ #{num_tests / groups.size} #{name}s per process"
104
+ puts "INFO: #{num_processes} processes for #{num_tests} #{name}s, ~ #{num_tests / groups.size} #{name}s per process"
105
105
 
106
106
  test_results = Parallel.map(groups, :in_processes => num_processes) do |group|
107
107
  run_tests(group, groups.index(group), options)
@@ -109,8 +109,8 @@ class ParallelizedSpecs
109
109
 
110
110
  #parse and print results
111
111
  results = find_results(test_results.map { |result| result[:stdout] }*"")
112
- puts ""
113
- puts summarize_results(results)
112
+ #puts ""
113
+ #puts summarize_results(results)
114
114
 
115
115
 
116
116
  #report total time taken
@@ -118,9 +118,9 @@ class ParallelizedSpecs
118
118
  puts "Took #{Time.now - start} seconds"
119
119
 
120
120
  if Dir.glob("#{RAILS_ROOT}/tmp/parallel_log/spec_count/{*,.*}").count == 2 && Dir.glob("#{RAILS_ROOT}/tmp/parallel_log/thread_started/{*,.*}").count == num_processes + 2
121
- (puts "All threads completed")
121
+ (puts "INFO: All threads completed")
122
122
  elsif Dir.glob("#{RAILS_ROOT}/tmp/parallel_log/thread_started/{*,.*}").count != num_processes + 2
123
- abort "one or more threads didn't get started by rspec"
123
+ abort "SEVERE: one or more threads didn't get started by rspec"
124
124
  else
125
125
  threads = Dir["#{RAILS_ROOT}/tmp/parallel_log/spec_count/*"]
126
126
  threads.each do |t|
@@ -133,21 +133,21 @@ class ParallelizedSpecs
133
133
  puts IO.readlines("#{RAILS_ROOT}/tmp/parallel_log/thread_#{failed_thread}.log")[-1]
134
134
  end
135
135
  end
136
- abort "One or more threads have failed, see above logging information for details" #works on both 1.8.7\1.9.3
136
+ abort "SEVERE: One or more threads have failed to complete, see above logging information for details" #works on both 1.8.7\1.9.3
137
137
  end
138
138
  #exit with correct status code so rake parallel:test && echo 123 works
139
139
 
140
140
  failed = test_results.any? { |result| result[:exit_status] != 0 } #ruby 1.8.7 works breaks on 1.9.3
141
- puts "this is the exit status of the rspec suites #{failed}"
141
+ puts "INFO: this is the exit status of the rspec suites #{failed}"
142
142
 
143
143
  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
144
- puts "some specs failed, about to start the rerun process\n no more than 9 specs may be rerun and shared specs are not allowed\n...\n..\n."
144
+ puts "INFO: some specs failed, about to start the rerun process\n no more than 9 specs may be rerun and shared specs are not allowed\n...\n..\n."
145
145
  ParallelizedSpecs.rerun()
146
146
  else
147
147
  #works on both 1.8.7\1.9.3
148
- abort "#{name.capitalize}s Failed" if Dir.glob("#{RAILS_ROOT}/tmp/parallel_log/failed_specs/{*,.*}").count > 2 || failed
148
+ abort "SEVERE: #{name.capitalize}s Failed" if Dir.glob("#{RAILS_ROOT}/tmp/parallel_log/failed_specs/{*,.*}").count > 2 || failed
149
149
  end
150
- puts "marking build as PASSED"
150
+ puts "INFO: marking build as PASSED"
151
151
  end
152
152
 
153
153
  # parallel:spec[:count, :pattern, :options]
@@ -293,35 +293,37 @@ class ParallelizedSpecs
293
293
  end
294
294
  end
295
295
 
296
- def self.update_rerun_summary(result, file)
297
- File.open(file, 'a+') { |f| f.puts(result) }
296
+ def self.update_rerun_summary(l, file, outcome)
297
+ File.open(file, 'a+') { |f| f.puts("Outcome #{outcome} for #{l}") }
298
298
  end
299
299
 
300
300
  def self.parse_result(result)
301
- puts "this is the result\n#{result}"
301
+ puts "INFO: this is the result\n#{result}"
302
302
  #can't just use exit code, if specs fail to start it will pass or if a spec isn't found, and sometimes rspec 1 exit codes aren't right
303
303
  rerun_status = result.scan(/\d*[^\D]\d*/).to_a
304
- puts "this is the rerun_status\n#{rerun_status}"
304
+ puts "INFO: this is the rerun_status\n#{rerun_status}"
305
305
  example_index = rerun_status.length - 2
306
306
  @examples = rerun_status[example_index].to_i
307
307
  @failures = rerun_status.last.to_i
308
308
  end
309
309
 
310
310
  def self.rerun_spec(spec)
311
- puts "#{spec} will be ran and marked as a success if it passes"
311
+ puts "INFO: #{spec} will be ran and marked as a success if it passes"
312
312
  result = %x[DISPLAY=:99 bundle exec rake spec #{spec}]
313
313
  parse_result(result)
314
314
  result
315
315
  end
316
316
 
317
- def self.print_failures(failure_summary)
317
+ def self.print_failures(failure_summary, state = "")
318
+ puts "*****************INFO: #{state} SUMMARY*****************\n"
319
+ state == "RERUN" ? puts "INFO: outcomes of the specs that were rerun" : puts "INFO: summary of build failures"
318
320
  file = File.open(failure_summary, "r")
319
321
  content = file.read
320
322
  puts content
321
323
  end
322
324
 
323
325
  def self.rerun()
324
- puts "beginning the failed specs rerun process"
326
+ puts "INFO: beginning the failed specs rerun process"
325
327
  rerun_failed_examples = false
326
328
  rerun_specs = []
327
329
  filename = "#{RAILS_ROOT}/tmp/parallel_log/rspec.failures"
@@ -335,60 +337,63 @@ class ParallelizedSpecs
335
337
  File.open(filename).each_line do |line|
336
338
  if line =~ /spec\/selenium\/helpers/ || line =~ /spec\/selenium\/shared_examples/
337
339
  print_failures("#{RAILS_ROOT}/tmp/parallel_log/error.log")
338
- abort "shared specs currently are not eligiable for reruns, marking build as a failure"
340
+ abort "SEVERE: shared specs currently are not eligiable for reruns, marking build as a failure"
339
341
  else
340
342
  rerun_specs.push line
341
343
  end
342
344
  end
343
345
 
344
346
  rerun_failed_examples = true
345
- puts "failed specs will be rerun\n rerunning #{@error_count} examples"
347
+ puts "INFO: failures meet rerun criteria \n INFO: rerunning #{@error_count} examples"
346
348
  @rerun_failures ||= []
347
349
  @rerun_passes ||= []
348
350
 
349
351
  rerun_specs.each do |l|
350
- result = rerun_spec(l)
352
+ result = rerun_spec(l)
351
353
 
352
354
  if @examples == 0 and @failures == 0
353
- update_rerun_summary(result, failure_summary)
354
- print_failures(failure_summary)
355
- abort "spec didn't actually run, ending rerun process early"
355
+ update_rerun_summary(l, failure_summary, "FAILED")
356
+ print_failures(failure_summary, "RERUN")
357
+ abort "SEVERE: spec didn't actually run, ending rerun process early"
356
358
  end
357
359
 
358
360
  if @examples == 0 #when specs fail to run it exits with 0 examples, 0 failures and won't be matched by the previous regex
359
- update_rerun_summary(result, failure_summary)
360
- print_failures(failure_summary)
361
- abort "the spec failed to run on the rerun try, marking build as failed"
361
+ update_rerun_summary(l, failure_summary, "FAILED")
362
+ print_failures(failure_summary, "RERUN")
363
+ abort "SEVERE: the spec failed to run on the rerun try, marking build as failed"
362
364
  elsif @failures > 0
363
- puts "the example failed again"
364
- update_rerun_summary(result, failure_summary)
365
+ puts "WARNING: the example failed again"
366
+ update_rerun_summary(l, failure_summary, "FAILED")
365
367
  @rerun_failures << l
366
368
  elsif @examples > 0 && @failures == 0
367
- puts "the example passed and is being marked as a success"
369
+ update_rerun_summary(l, failure_summary, "PASSED")
370
+ puts "INFO: the example passed and is being marked as a success"
368
371
  @rerun_passes << l
369
372
  else
370
- abort "unexpected outcome on the rerun, marking build as a failure"
373
+ abort "SEVERE: unexpected outcome on the rerun, marking build as a failure"
371
374
  end
372
375
  end #end file loop
373
376
 
374
377
  when @error_count == 0
375
- abort "#{@error_count} errors, but the build failed, errors were not written to the file or there is something else wrong, marking build as a failure"
378
+ abort "SEVERE: #{@error_count} errors, but the build failed, errors were not written to the file or there is something else wrong, marking build as a failure"
376
379
  when @error_count > 9
377
380
  print_failures("#{RAILS_ROOT}/tmp/parallel_log/error.log")
378
- abort "#{@error_count} errors are to many to rerun, marking the build as a failure"
381
+ abort "SEVERE: #{@error_count} errors are to many to rerun, marking the build as a failure"
379
382
  else
380
383
  puts "#Total errors #{@error_count}"
381
- abort "unexpected error information, please check errors are being written to file correctly"
384
+ abort "SEVERE: unexpected error information, please check errors are being written to file correctly"
382
385
  end
383
386
 
384
387
  if rerun_failed_examples
385
388
  if @rerun_failures.count > 0
386
- print_failures(failure_summary)
387
- abort "some specs failed on rerun, the build will be marked as failed"
389
+ print_failures(failure_summary, "RERUN")
390
+ abort "SEVERE: some specs failed on rerun, the build will be marked as failed"
388
391
  elsif @rerun_passes.count >= @error_count
389
- puts "all rerun examples passed, rspec will mark this build as passed"
392
+ print_failures("#{RAILS_ROOT}/tmp/parallel_log/error.log")
393
+ print_failures(failure_summary, "RERUN")
394
+ puts "INFO: rerun summary all rerun examples passed, rspec will mark this build as passed"
390
395
  else
391
- abort "unexpected situation on rerun, marking build as failure"
396
+ abort "SEVERE: unexpected situation on rerun, marking build as failure"
392
397
  end
393
398
  end
394
399
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "parallelized_specs"
8
- s.version = "0.3.98"
8
+ s.version = "0.3.99"
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-01-29"
12
+ s.date = "2013-02-03"
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: 215
4
+ hash: 213
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 98
10
- version: 0.3.98
9
+ - 99
10
+ version: 0.3.99
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-01-29 00:00:00 Z
18
+ date: 2013-02-03 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: parallel