parallel_tests 1.3.2 → 1.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/parallel_tests/test/runner.rb +13 -2
- data/lib/parallel_tests/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c3c5c94b8591531e20c448d8b7ae8e7018146db
|
4
|
+
data.tar.gz: d729a288963d0bf4aafbfde3bcb5d664de561b3e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5448b82c0a3cf89b5d41a5e179c3260126602a62a377eb53009cb758815018a952293656d60b577854761cbb2e5b77d02ee3af1ae92c7c7f1cb34e0fe855164f
|
7
|
+
data.tar.gz: cda7473b6fd14fc9d55da4ee7fb84c50bbece107ea430a2230a38c6f10db8bfe8d6467ab2a8fb75791b7b4d26bba29812d50057dece0e220568d444b891a84ae
|
@@ -47,7 +47,7 @@ module ParallelTests
|
|
47
47
|
when :filesize
|
48
48
|
sort_by_filesize(tests)
|
49
49
|
when :runtime
|
50
|
-
sort_by_runtime(tests, runtimes(options), allowed_missing: 0.5)
|
50
|
+
sort_by_runtime(tests, runtimes(options), options.merge(allowed_missing: 0.5))
|
51
51
|
when nil
|
52
52
|
# use recorded test runtime if we got enough data
|
53
53
|
runtimes = runtimes(options) rescue []
|
@@ -153,6 +153,7 @@ 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
|
156
157
|
times = {}
|
157
158
|
runtimes.each do |line|
|
158
159
|
test, time = line.split(":", 2)
|
@@ -160,12 +161,22 @@ module ParallelTests
|
|
160
161
|
times[test] = time.to_f
|
161
162
|
end
|
162
163
|
|
164
|
+
# set know runtime for each test
|
163
165
|
tests.sort!
|
164
166
|
tests.map! do |test|
|
165
167
|
allowed_missing -= 1 unless time = times[test]
|
166
168
|
raise "Too little runtime info" if allowed_missing < 0
|
167
|
-
[test, time
|
169
|
+
[test, time]
|
168
170
|
end
|
171
|
+
|
172
|
+
if options[:verbose]
|
173
|
+
puts "Runtime found for #{tests.count(&:last)} of #{tests.size} tests"
|
174
|
+
end
|
175
|
+
|
176
|
+
# fill gaps with average runtime
|
177
|
+
known, unknown = tests.partition(&:last)
|
178
|
+
average = known.map!(&:last).inject(:+) / known.size
|
179
|
+
unknown.each { |set| set[1] = average }
|
169
180
|
end
|
170
181
|
|
171
182
|
def runtimes(options)
|