parallel_tests 2.21.0 → 2.21.1
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.rb +16 -1
- data/lib/parallel_tests/cli.rb +15 -12
- data/lib/parallel_tests/pids.rb +0 -1
- 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: 859dbc6f86dedda88f0eddc04d5f07e949e737ff
|
4
|
+
data.tar.gz: c62eacaa3c1d018957fd94d47d025df1e06e9d6d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b306f589ad75ed0ac4ad636cbdda41f370ab58f036d1013536c997a2dc80fce8662e0ed83e157e7809b514ba2c149b88588af6c252d56531b84daaf775f14fc9
|
7
|
+
data.tar.gz: ebf66916a6ddb13e185013251f8e1f3a1b5a7be8d84d4815ad79e8adb336e2c6878cd036d4d2e9afa0e9e420cefecf99991f3e894a3b1fc01c14e343e2cd8d8f
|
data/lib/parallel_tests.rb
CHANGED
@@ -20,12 +20,27 @@ module ParallelTests
|
|
20
20
|
].detect{|c| not c.to_s.strip.empty? }.to_i
|
21
21
|
end
|
22
22
|
|
23
|
+
def with_pid_file
|
24
|
+
Tempfile.open('parallel_tests-pidfile') do |f|
|
25
|
+
begin
|
26
|
+
ENV['PARALLEL_PID_FILE'] = f.path
|
27
|
+
# Pids object should be created before threads will start adding pids to it
|
28
|
+
# Otherwise we would have to use Mutex to prevent creation of several instances
|
29
|
+
@pids = pids
|
30
|
+
yield
|
31
|
+
ensure
|
32
|
+
ENV['PARALLEL_PID_FILE'] = nil
|
33
|
+
@pids = nil
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
23
38
|
def pids
|
24
39
|
@pids ||= Pids.new(pid_file_path)
|
25
40
|
end
|
26
41
|
|
27
42
|
def pid_file_path
|
28
|
-
ENV
|
43
|
+
ENV.fetch('PARALLEL_PID_FILE')
|
29
44
|
end
|
30
45
|
|
31
46
|
def stop_all_processes
|
data/lib/parallel_tests/cli.rb
CHANGED
@@ -39,17 +39,18 @@ module ParallelTests
|
|
39
39
|
|
40
40
|
def execute_in_parallel(items, num_processes, options)
|
41
41
|
Tempfile.open 'parallel_tests-lock' do |lock|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
42
|
+
ParallelTests.with_pid_file do
|
43
|
+
progress_indicator = simulate_output_for_ci if options[:serialize_stdout]
|
44
|
+
|
45
|
+
Parallel.map(items, :in_threads => num_processes) do |item|
|
46
|
+
result = yield(item)
|
47
|
+
if progress_indicator && progress_indicator.alive?
|
48
|
+
progress_indicator.exit
|
49
|
+
puts
|
50
|
+
end
|
51
|
+
reprint_output(result, lock.path) if options[:serialize_stdout]
|
52
|
+
result
|
50
53
|
end
|
51
|
-
reprint_output(result, lock.path) if options[:serialize_stdout]
|
52
|
-
result
|
53
54
|
end
|
54
55
|
end
|
55
56
|
end
|
@@ -276,8 +277,10 @@ module ParallelTests
|
|
276
277
|
(0...num_processes).to_a
|
277
278
|
end
|
278
279
|
results = if options[:non_parallel]
|
279
|
-
|
280
|
-
|
280
|
+
ParallelTests.with_pid_file do
|
281
|
+
runs.map do |i|
|
282
|
+
ParallelTests::Test::Runner.execute_command(command, i, num_processes, options)
|
283
|
+
end
|
281
284
|
end
|
282
285
|
else
|
283
286
|
execute_in_parallel(runs, runs.size, options) do |i|
|
data/lib/parallel_tests/pids.rb
CHANGED
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: 2.21.
|
4
|
+
version: 2.21.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Grosser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-01-
|
11
|
+
date: 2018-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parallel
|