parallel_tests 0.16.7 → 0.16.8
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 +4 -4
- data/Gemfile.lock +1 -1
- data/Readme.md +4 -0
- data/lib/parallel_tests/cli.rb +19 -5
- data/lib/parallel_tests/test/runner.rb +9 -2
- data/lib/parallel_tests/version.rb +1 -1
- data/spec/integration_spec.rb +14 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90404adedf371fc723a913eebd4c59db6f0f334c
|
4
|
+
data.tar.gz: 6c4c6c55c6fe1e1e6b92ad79598e91d7da0ff795
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da4420026e7f2cb832e7e0b0f09f977964ace8f09611f9ae21025c47d2769730c252973d0f31901789b85329bbe92f6b68e38f8276e56400954904fc41e83259
|
7
|
+
data.tar.gz: f7d7c7064aae750bba6f0be4ae830ef3f8101bf25bf9c1b1ed8ff9b765bdef3f8a704bd8b2be2360e1a68c9a44c055f873f5b4144b928cd68cf2c5f9711b3c29
|
data/Gemfile.lock
CHANGED
data/Readme.md
CHANGED
@@ -174,6 +174,7 @@ Options are:
|
|
174
174
|
--group-by [TYPE] group tests by:
|
175
175
|
found - order of finding files
|
176
176
|
steps - number of cucumber steps
|
177
|
+
filesize - size of files on disk
|
177
178
|
default - runtime or filesize
|
178
179
|
-m, --multiply-processes [FLOAT] use given number as a multiplier of processes to run
|
179
180
|
-s, --single [PATTERN] Run all matching files in the same process
|
@@ -186,6 +187,7 @@ Options are:
|
|
186
187
|
--no-symlinks Do not traverse symbolic links to find test files
|
187
188
|
--ignore-tags [PATTERN] When counting steps ignore scenarios with tags that match this pattern
|
188
189
|
--nice execute test commands with low priority.
|
190
|
+
--only-group [INTEGER] Group the files, but only run the group specified here. Requires group-by filesize (will be set automatically if group-by is blank and only-group is specified)
|
189
191
|
-v, --version Show Version
|
190
192
|
-h, --help Show this.
|
191
193
|
|
@@ -223,6 +225,7 @@ TIPS
|
|
223
225
|
- [email_spec and/or action_mailer_cache_delivery](https://github.com/grosser/parallel_tests/wiki)
|
224
226
|
- [Memcached] use different namespaces e.g. `config.cache_store = ..., :namespace => "test_#{ENV['TEST_ENV_NUMBER']}"`
|
225
227
|
- [zeus-parallel_tests](https://github.com/sevos/zeus-parallel_tests)
|
228
|
+
- [Distributed parallel test (e.g. Travis Support)](https://github.com/grosser/parallel_tests/wiki/Distributed-Parallel-Tests-and-Travis-Support)
|
226
229
|
|
227
230
|
TODO
|
228
231
|
====
|
@@ -292,6 +295,7 @@ inspired by [pivotal labs](http://pivotallabs.com/users/miked/blog/articles/849-
|
|
292
295
|
- [Colin Harris](https://github.com/aberant)
|
293
296
|
- [Wataru MIYAGUNI](https://github.com/gongo)
|
294
297
|
- [Brandon Turner](https://github.com/blt04)
|
298
|
+
- [Matt Hodgson](https://github.com/mhodgson)
|
295
299
|
|
296
300
|
[Michael Grosser](http://grosser.it)<br/>
|
297
301
|
michael@grosser.it<br/>
|
data/lib/parallel_tests/cli.rb
CHANGED
@@ -34,10 +34,17 @@ module ParallelTests
|
|
34
34
|
|
35
35
|
report_time_taken do
|
36
36
|
groups = @runner.tests_in_groups(options[:files], num_processes, options)
|
37
|
-
report_number_of_tests(groups)
|
38
37
|
|
39
|
-
test_results =
|
40
|
-
|
38
|
+
test_results = if options[:only_group]
|
39
|
+
group_to_run = groups[options[:only_group] - 1]
|
40
|
+
|
41
|
+
[run_tests(group_to_run, 0, num_processes, options)]
|
42
|
+
else
|
43
|
+
report_number_of_tests(groups)
|
44
|
+
|
45
|
+
execute_in_parallel(groups, groups.size, options) do |group|
|
46
|
+
run_tests(group, groups.index(group), num_processes, options)
|
47
|
+
end
|
41
48
|
end
|
42
49
|
|
43
50
|
report_results(test_results)
|
@@ -98,6 +105,7 @@ group tests by:
|
|
98
105
|
found - order of finding files
|
99
106
|
steps - number of cucumber/spinach steps
|
100
107
|
scenarios - individual cucumber scenarios
|
108
|
+
filesize - by size of the file
|
101
109
|
default - runtime or filesize
|
102
110
|
TEXT
|
103
111
|
) { |type| options[:group_by] = type.to_sym }
|
@@ -116,6 +124,8 @@ TEXT
|
|
116
124
|
options[:isolate] = true
|
117
125
|
end
|
118
126
|
|
127
|
+
opts.on("--only-group [INTEGER]", Integer) { |group| options[:only_group] = group }
|
128
|
+
|
119
129
|
opts.on("-e", "--exec [COMMAND]", "execute this code parallel and with ENV['TEST_ENV_NUM']") { |path| options[:execute] = path }
|
120
130
|
opts.on("-o", "--test-options '[OPTIONS]'", "execute test commands with those options") { |arg| options[:test_options] = arg }
|
121
131
|
opts.on("-t", "--type [TYPE]", "test(default) / rspec / cucumber / spinach") do |type|
|
@@ -135,14 +145,18 @@ TEXT
|
|
135
145
|
opts.on("-h", "--help", "Show this.") { puts opts; exit }
|
136
146
|
end.parse!(argv)
|
137
147
|
|
138
|
-
raise "--group-by found and --single-process are not supported" if options[:group_by] == :found and options[:single_process]
|
139
|
-
|
140
148
|
if options[:count] == 0
|
141
149
|
options.delete(:count)
|
142
150
|
options[:non_parallel] = true
|
143
151
|
end
|
144
152
|
|
145
153
|
options[:files] = argv
|
154
|
+
|
155
|
+
options[:group_by] ||= :filesize if options[:only_group]
|
156
|
+
|
157
|
+
raise "--group-by found and --single-process are not supported" if options[:group_by] == :found and options[:single_process]
|
158
|
+
raise "--group-by filesize is required for --only-group" if options[:group_by] != :filesize and options[:only_group]
|
159
|
+
|
146
160
|
options
|
147
161
|
end
|
148
162
|
|
@@ -43,6 +43,8 @@ module ParallelTests
|
|
43
43
|
|
44
44
|
tests = if options[:group_by] == :found
|
45
45
|
tests.map { |t| [t, 1] }
|
46
|
+
elsif options[:group_by] == :filesize
|
47
|
+
with_filesize_info(tests)
|
46
48
|
else
|
47
49
|
with_runtime_info(tests)
|
48
50
|
end
|
@@ -60,7 +62,7 @@ module ParallelTests
|
|
60
62
|
|
61
63
|
def execute_command_and_capture_output(env, cmd, silence)
|
62
64
|
# make processes descriptive / visible in ps -ef
|
63
|
-
windows = RbConfig::CONFIG['host_os'] =~ /cygwin|mswin|mingw|bccwin|wince|emx/
|
65
|
+
windows = RbConfig::CONFIG['host_os'] =~ /cygwin|mswin|mingw|bccwin|wince|emx/
|
64
66
|
separator = windows ? ' & ' : ';'
|
65
67
|
exports = env.map do |k,v|
|
66
68
|
if windows
|
@@ -143,10 +145,15 @@ module ParallelTests
|
|
143
145
|
end
|
144
146
|
tests.sort.map{|test| [test, times[File.expand_path(test)]] }
|
145
147
|
else # use file sizes
|
146
|
-
tests
|
148
|
+
with_filesize_info(tests)
|
147
149
|
end
|
148
150
|
end
|
149
151
|
|
152
|
+
def with_filesize_info(tests)
|
153
|
+
# use filesize to group files
|
154
|
+
tests.sort.map { |test| [test, File.stat(test).size] }
|
155
|
+
end
|
156
|
+
|
150
157
|
def find_tests(tests, options = {})
|
151
158
|
(tests || []).map do |file_or_folder|
|
152
159
|
if File.directory?(file_or_folder)
|
data/spec/integration_spec.rb
CHANGED
@@ -211,6 +211,20 @@ describe 'CLI' do
|
|
211
211
|
run_tests("test", :processes => 4).should include("b\nc\nd\na\n")
|
212
212
|
end
|
213
213
|
|
214
|
+
it "can run only a single group" do
|
215
|
+
pending if RUBY_PLATFORM == "java" # just too slow ...
|
216
|
+
write "test/long_test.rb", "puts 'this is a long test'"
|
217
|
+
write "test/short_test.rb", "puts 'short test'"
|
218
|
+
|
219
|
+
group_1_result = run_tests("test", :processes => 2, :add => '--only-group 1')
|
220
|
+
group_1_result.should include("this is a long test")
|
221
|
+
group_1_result.should_not include("short test")
|
222
|
+
|
223
|
+
group_2_result = run_tests("test", :processes => 2, :add => '--only-group 2')
|
224
|
+
group_2_result.should_not include("this is a long test")
|
225
|
+
group_2_result.should include("short test")
|
226
|
+
end
|
227
|
+
|
214
228
|
context "Test::Unit" do
|
215
229
|
it "runs" do
|
216
230
|
write "test/x1_test.rb", "require 'test/unit'; class XTest < Test::Unit::TestCase; def test_xxx; end; end"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parallel_tests
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.16.
|
4
|
+
version: 0.16.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Grosser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-01-
|
11
|
+
date: 2014-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parallel
|