parallel_tests 2.17.1 → 2.18.0
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.rb +0 -8
- data/lib/parallel_tests/test/runner.rb +2 -1
- data/lib/parallel_tests/test/runtime_logger.rb +15 -16
- 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: f5b04284134cfd09c0b28c8852041cae9946958b
|
4
|
+
data.tar.gz: 4579bd82392b38f52dac94facf562b42a729331f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae0013b187faed8555b62d8e88a46dfcd58acdaeb7f87c058f0eb6e64f9f6f44236d0726f0cae30a3242e37ed2c3f07545b2e39b0dd6e1e3a863a1959c3cbaf7
|
7
|
+
data.tar.gz: 146639b4ab99103164b734247b278752d2b1cdcc2523e843655287ab957a444fa5e4c82696e18b175f8d2ea7efe2ed8f491da9d93cae597bb1845c189814d4d5
|
data/lib/parallel_tests.rb
CHANGED
@@ -60,14 +60,6 @@ module ParallelTests
|
|
60
60
|
current_process_number == total_processes
|
61
61
|
end
|
62
62
|
|
63
|
-
def parent_pid
|
64
|
-
if WINDOWS
|
65
|
-
`wmic process where (processid=#{Process.pid}) get parentprocessid`
|
66
|
-
else
|
67
|
-
`ps -o ppid= -p#{`ps -o ppid= -p#{Process.pid}`}` #the true parent is one layer up.
|
68
|
-
end.to_i
|
69
|
-
end
|
70
|
-
|
71
63
|
def with_ruby_binary(command)
|
72
64
|
WINDOWS ? "#{RUBY_BINARY} -- #{command}" : command
|
73
65
|
end
|
@@ -98,7 +98,8 @@ module ParallelTests
|
|
98
98
|
end
|
99
99
|
|
100
100
|
def find_results(test_output)
|
101
|
-
test_output.
|
101
|
+
test_output.lines.map do |line|
|
102
|
+
line.chomp!
|
102
103
|
line.gsub!(/\e\[\d+m/, '') # remove color coding
|
103
104
|
next unless line_is_result?(line)
|
104
105
|
line
|
@@ -18,19 +18,28 @@ module ParallelTests
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def unique_log
|
21
|
-
|
21
|
+
with_locked_log do |logfile|
|
22
22
|
separator = "\n"
|
23
|
-
groups =
|
23
|
+
groups = logfile.read.split(separator).map { |line| line.split(":") }.group_by(&:first)
|
24
24
|
lines = groups.map do |file, times|
|
25
25
|
time = "%.2f" % times.map(&:last).map(&:to_f).inject(:+)
|
26
26
|
"#{file}:#{time}"
|
27
27
|
end
|
28
|
-
|
28
|
+
logfile.rewind
|
29
|
+
logfile.write(lines.join(separator) + separator)
|
30
|
+
logfile.truncate(logfile.pos)
|
29
31
|
end
|
30
32
|
end
|
31
33
|
|
32
34
|
private
|
33
35
|
|
36
|
+
def with_locked_log
|
37
|
+
File.open(logfile, File::RDWR|File::CREAT) do |logfile|
|
38
|
+
logfile.flock(File::LOCK_EX)
|
39
|
+
yield logfile
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
34
43
|
# ensure folder exists + clean out previous log
|
35
44
|
# this will happen in multiple processes, but should be roughly at the same time
|
36
45
|
# so there should be no log message lost
|
@@ -43,8 +52,9 @@ module ParallelTests
|
|
43
52
|
|
44
53
|
def log(test, time)
|
45
54
|
return unless message = message(test, time)
|
46
|
-
|
47
|
-
|
55
|
+
with_locked_log do |logfile|
|
56
|
+
logfile.seek(0, IO::SEEK_END)
|
57
|
+
logfile.puts message
|
48
58
|
end
|
49
59
|
end
|
50
60
|
|
@@ -54,17 +64,6 @@ module ParallelTests
|
|
54
64
|
"#{filename}:#{delta}"
|
55
65
|
end
|
56
66
|
|
57
|
-
def lock
|
58
|
-
File.open(logfile, 'r') do |f|
|
59
|
-
begin
|
60
|
-
f.flock File::LOCK_EX
|
61
|
-
yield
|
62
|
-
ensure
|
63
|
-
f.flock File::LOCK_UN
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
67
|
def logfile
|
69
68
|
ParallelTests::Test::Runner.runtime_log
|
70
69
|
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: 2.
|
4
|
+
version: 2.18.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Grosser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-11-
|
11
|
+
date: 2017-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parallel
|