parallel_tests 0.4.18 → 0.4.19
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/Readme.md +14 -5
- data/VERSION +1 -1
- data/lib/parallel_cucumber.rb +8 -1
- data/lib/parallel_cucumber/runtime_logger.rb +57 -0
- data/lib/parallel_specs.rb +4 -0
- data/lib/parallel_tests.rb +5 -1
- data/parallel_tests.gemspec +3 -2
- data/spec/spec_helper.rb +1 -1
- metadata +8 -7
data/Readme.md
CHANGED
|
@@ -6,26 +6,35 @@ Setup for Rails
|
|
|
6
6
|
## Install
|
|
7
7
|
### Rails 3
|
|
8
8
|
As gem
|
|
9
|
-
|
|
9
|
+
|
|
10
|
+
gem install parallel_tests
|
|
11
|
+
|
|
10
12
|
# add to Gemfile
|
|
11
|
-
gem "parallel_tests", :group
|
|
13
|
+
gem "parallel_tests", :group => :development
|
|
12
14
|
|
|
13
15
|
OR as plugin
|
|
14
|
-
|
|
16
|
+
|
|
17
|
+
gem install parallel
|
|
15
18
|
rails plugin install git://github.com/grosser/parallel_tests.git
|
|
16
19
|
|
|
20
|
+
# add to Gemfile
|
|
21
|
+
gem "parallel", :group => :development
|
|
22
|
+
|
|
17
23
|
### Rails 2
|
|
18
24
|
|
|
19
25
|
As gem
|
|
20
|
-
|
|
26
|
+
|
|
27
|
+
gem install parallel_tests
|
|
28
|
+
|
|
21
29
|
# add to config/environments/development.rb
|
|
22
30
|
config.gem "parallel_tests"
|
|
31
|
+
|
|
23
32
|
# add to Rakefile
|
|
24
33
|
begin; require 'parallel_tests/tasks'; rescue LoadError; end
|
|
25
34
|
|
|
26
35
|
OR as plugin
|
|
27
36
|
|
|
28
|
-
|
|
37
|
+
gem install parallel
|
|
29
38
|
./script/plugin install git://github.com/grosser/parallel_tests.git
|
|
30
39
|
|
|
31
40
|
## Setup
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.4.
|
|
1
|
+
0.4.19
|
data/lib/parallel_cucumber.rb
CHANGED
|
@@ -3,7 +3,10 @@ require File.join(File.dirname(__FILE__), 'parallel_tests')
|
|
|
3
3
|
class ParallelCucumber < ParallelTests
|
|
4
4
|
def self.run_tests(test_files, process_number, options)
|
|
5
5
|
color = ($stdout.tty? ? 'AUTOTEST=1 ; export AUTOTEST ;' : '')#display color when we are in a terminal
|
|
6
|
-
|
|
6
|
+
runtime_logging = "--format ParallelCucumber::RuntimeLogger --out #{runtime_log}"
|
|
7
|
+
cmd = "#{color} #{executable}"
|
|
8
|
+
cmd << runtime_logging if File.directory?(File.dirname(runtime_log))
|
|
9
|
+
cmd << " #{options[:test_options]} #{test_files*' '}"
|
|
7
10
|
execute_command(cmd, process_number, options)
|
|
8
11
|
end
|
|
9
12
|
|
|
@@ -17,6 +20,10 @@ class ParallelCucumber < ParallelTests
|
|
|
17
20
|
end
|
|
18
21
|
end
|
|
19
22
|
|
|
23
|
+
def self.runtime_log
|
|
24
|
+
'tmp/parallel_runtime_cucumber.log'
|
|
25
|
+
end
|
|
26
|
+
|
|
20
27
|
protected
|
|
21
28
|
|
|
22
29
|
def self.test_suffix
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
class ParallelCucumber
|
|
2
|
+
class RuntimeLogger
|
|
3
|
+
|
|
4
|
+
def initialize(step_mother, path_or_io, options=nil)
|
|
5
|
+
@io = prepare_io(path_or_io)
|
|
6
|
+
@example_times = Hash.new(0)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def before_feature(_)
|
|
10
|
+
@start_at = Time.now.to_f
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def after_feature(feature)
|
|
14
|
+
@example_times[feature.file] += Time.now.to_f - @start_at
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def after_features(*args)
|
|
18
|
+
lock_output do
|
|
19
|
+
@io.puts @example_times.map { |file, time| "#{file}:#{time}" }
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
private
|
|
24
|
+
|
|
25
|
+
def prepare_io(path_or_io)
|
|
26
|
+
if path_or_io.respond_to?(:write)
|
|
27
|
+
path_or_io
|
|
28
|
+
else # its a path
|
|
29
|
+
File.open(path_or_io, 'w').close # clean out the file
|
|
30
|
+
file = File.open(path_or_io, 'a')
|
|
31
|
+
|
|
32
|
+
at_exit do
|
|
33
|
+
unless file.closed?
|
|
34
|
+
file.flush
|
|
35
|
+
file.close
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
file
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# do not let multiple processes get in each others way
|
|
44
|
+
def lock_output
|
|
45
|
+
if File === @io
|
|
46
|
+
begin
|
|
47
|
+
@io.flock File::LOCK_EX
|
|
48
|
+
yield
|
|
49
|
+
ensure
|
|
50
|
+
@io.flock File::LOCK_UN
|
|
51
|
+
end
|
|
52
|
+
else
|
|
53
|
+
yield
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
data/lib/parallel_specs.rb
CHANGED
data/lib/parallel_tests.rb
CHANGED
|
@@ -54,6 +54,10 @@ class ParallelTests
|
|
|
54
54
|
process_number == 0 ? '' : process_number + 1
|
|
55
55
|
end
|
|
56
56
|
|
|
57
|
+
def self.runtime_log
|
|
58
|
+
'__foo__'
|
|
59
|
+
end
|
|
60
|
+
|
|
57
61
|
protected
|
|
58
62
|
|
|
59
63
|
# read output of the process and print in in chucks
|
|
@@ -111,7 +115,7 @@ class ParallelTests
|
|
|
111
115
|
|
|
112
116
|
def self.tests_with_runtime(root)
|
|
113
117
|
tests = find_tests(root)
|
|
114
|
-
lines = File.read("#{root}
|
|
118
|
+
lines = File.read("#{root}/../#{runtime_log}").split("\n") rescue []
|
|
115
119
|
|
|
116
120
|
# use recorded test runtime if we got enough data
|
|
117
121
|
if lines.size * 1.5 > tests.size
|
data/parallel_tests.gemspec
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |s|
|
|
7
7
|
s.name = %q{parallel_tests}
|
|
8
|
-
s.version = "0.4.
|
|
8
|
+
s.version = "0.4.19"
|
|
9
9
|
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
11
|
s.authors = ["Michael Grosser"]
|
|
12
|
-
s.date = %q{2011-
|
|
12
|
+
s.date = %q{2011-06-04}
|
|
13
13
|
s.email = %q{grosser.michael@gmail.com}
|
|
14
14
|
s.executables = ["parallel_cucumber", "parallel_spec", "parallel_test"]
|
|
15
15
|
s.files = [
|
|
@@ -23,6 +23,7 @@ Gem::Specification.new do |s|
|
|
|
23
23
|
"bin/parallel_spec",
|
|
24
24
|
"bin/parallel_test",
|
|
25
25
|
"lib/parallel_cucumber.rb",
|
|
26
|
+
"lib/parallel_cucumber/runtime_logger.rb",
|
|
26
27
|
"lib/parallel_specs.rb",
|
|
27
28
|
"lib/parallel_specs/spec_runtime_logger.rb",
|
|
28
29
|
"lib/parallel_tests.rb",
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: parallel_tests
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 41
|
|
5
5
|
prerelease:
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
8
|
- 4
|
|
9
|
-
-
|
|
10
|
-
version: 0.4.
|
|
9
|
+
- 19
|
|
10
|
+
version: 0.4.19
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- Michael Grosser
|
|
@@ -15,11 +15,11 @@ autorequire:
|
|
|
15
15
|
bindir: bin
|
|
16
16
|
cert_chain: []
|
|
17
17
|
|
|
18
|
-
date: 2011-
|
|
18
|
+
date: 2011-06-04 00:00:00 +02:00
|
|
19
19
|
default_executable:
|
|
20
20
|
dependencies:
|
|
21
21
|
- !ruby/object:Gem::Dependency
|
|
22
|
-
|
|
22
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
|
23
23
|
none: false
|
|
24
24
|
requirements:
|
|
25
25
|
- - ">="
|
|
@@ -28,10 +28,10 @@ dependencies:
|
|
|
28
28
|
segments:
|
|
29
29
|
- 0
|
|
30
30
|
version: "0"
|
|
31
|
-
requirement: *id001
|
|
32
|
-
prerelease: false
|
|
33
31
|
type: :runtime
|
|
34
32
|
name: parallel
|
|
33
|
+
version_requirements: *id001
|
|
34
|
+
prerelease: false
|
|
35
35
|
description:
|
|
36
36
|
email: grosser.michael@gmail.com
|
|
37
37
|
executables:
|
|
@@ -53,6 +53,7 @@ files:
|
|
|
53
53
|
- bin/parallel_spec
|
|
54
54
|
- bin/parallel_test
|
|
55
55
|
- lib/parallel_cucumber.rb
|
|
56
|
+
- lib/parallel_cucumber/runtime_logger.rb
|
|
56
57
|
- lib/parallel_specs.rb
|
|
57
58
|
- lib/parallel_specs/spec_runtime_logger.rb
|
|
58
59
|
- lib/parallel_tests.rb
|