parallel_tests 1.3.5 → 1.3.6
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/lib/parallel_tests/test/runner.rb +11 -14
- data/lib/parallel_tests/version.rb +1 -1
- 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: b57802f4d3da910095fefb6c49645784d566ae31
|
4
|
+
data.tar.gz: 355cc6948f4513854032fde22251d7a4e136bd49
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f225a898105d9363f624f1d62c3776d7d7893a2ad718fc1ebae4dacac84af2aad915566b2e4534ff4ab71c525faad95d425033f79f7b0f4c554529fca19fa8c
|
7
|
+
data.tar.gz: 34d5724a1fb8085e2677077abd08d70486f7195b0a1f019a53be8bd413de8c8b6e9cbcb3562a1e7943d1e31e23fea16f4dd6a0f0d6e9ef87d0dfcc5ecd8450d6
|
@@ -47,10 +47,10 @@ module ParallelTests
|
|
47
47
|
when :filesize
|
48
48
|
sort_by_filesize(tests)
|
49
49
|
when :runtime
|
50
|
-
sort_by_runtime(tests, runtimes(options), options.merge(allowed_missing: 0.5))
|
50
|
+
sort_by_runtime(tests, runtimes(tests, options), options.merge(allowed_missing: 0.5))
|
51
51
|
when nil
|
52
52
|
# use recorded test runtime if we got enough data
|
53
|
-
runtimes = runtimes(options) rescue []
|
53
|
+
runtimes = runtimes(tests, options) rescue []
|
54
54
|
if runtimes.size * 1.5 > tests.size
|
55
55
|
puts "Using recorded test runtime"
|
56
56
|
sort_by_runtime(tests, runtimes)
|
@@ -153,18 +153,10 @@ module ParallelTests
|
|
153
153
|
allowed_missing = options[:allowed_missing] || 1.0
|
154
154
|
allowed_missing = tests.size * allowed_missing
|
155
155
|
|
156
|
-
# build runtime hash
|
157
|
-
times = {}
|
158
|
-
runtimes.each do |line|
|
159
|
-
test, time = line.split(":", 2)
|
160
|
-
next unless test and time
|
161
|
-
times[test] = time.to_f
|
162
|
-
end
|
163
|
-
|
164
156
|
# set know runtime for each test
|
165
157
|
tests.sort!
|
166
158
|
tests.map! do |test|
|
167
|
-
allowed_missing -= 1 unless time =
|
159
|
+
allowed_missing -= 1 unless time = runtimes[test]
|
168
160
|
raise "Too little runtime info" if allowed_missing < 0
|
169
161
|
[test, time]
|
170
162
|
end
|
@@ -175,13 +167,18 @@ module ParallelTests
|
|
175
167
|
|
176
168
|
# fill gaps with average runtime
|
177
169
|
known, unknown = tests.partition(&:last)
|
178
|
-
average = known.map!(&:last).inject(:+) / known.size
|
170
|
+
average = (known.any? ? known.map!(&:last).inject(:+) / known.size : 1)
|
179
171
|
unknown.each { |set| set[1] = average }
|
180
172
|
end
|
181
173
|
|
182
|
-
def runtimes(options)
|
174
|
+
def runtimes(tests, options)
|
183
175
|
log = options[:runtime_log] || runtime_log
|
184
|
-
File.read(log).split("\n")
|
176
|
+
lines = File.read(log).split("\n")
|
177
|
+
lines.each_with_object({}) do |line, times|
|
178
|
+
test, time = line.split(":", 2)
|
179
|
+
next unless test and time
|
180
|
+
times[test] = time.to_f if tests.include?(test)
|
181
|
+
end
|
185
182
|
end
|
186
183
|
|
187
184
|
def sort_by_filesize(tests)
|
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: 1.3.
|
4
|
+
version: 1.3.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Grosser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parallel
|