parallel_tests 2.17.1 → 2.18.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f5a51a34a91c7947c0a43231f159eb47dcf92678
4
- data.tar.gz: 7cc48638574403d6d898c3b4bf64396a25268c54
3
+ metadata.gz: f5b04284134cfd09c0b28c8852041cae9946958b
4
+ data.tar.gz: 4579bd82392b38f52dac94facf562b42a729331f
5
5
  SHA512:
6
- metadata.gz: 7b1cc69d8645a0468d7cf9a61326050d77b9f294c8f5db512e8bc3fb16b436cee1ac49cc91be6f456b746fe5ce42f2cad0a011ddb8cb4b77d53993e32765e97b
7
- data.tar.gz: 02187019194e0f549ecd8c04902c199f00a473c08e209efd8d333dc0925c6a474adb487adfa5908e2eb0fb2a6423161cebc2c33f6552b637db5ab5f7cbbba6ab
6
+ metadata.gz: ae0013b187faed8555b62d8e88a46dfcd58acdaeb7f87c058f0eb6e64f9f6f44236d0726f0cae30a3242e37ed2c3f07545b2e39b0dd6e1e3a863a1959c3cbaf7
7
+ data.tar.gz: 146639b4ab99103164b734247b278752d2b1cdcc2523e843655287ab957a444fa5e4c82696e18b175f8d2ea7efe2ed8f491da9d93cae597bb1845c189814d4d5
@@ -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.split("\n").map do |line|
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
- lock do
21
+ with_locked_log do |logfile|
22
22
  separator = "\n"
23
- groups = File.read(logfile).split(separator).map { |line| line.split(":") }.group_by(&:first)
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
- File.write(logfile, lines.join(separator) + separator)
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
- lock do
47
- File.open(logfile, 'a') { |f| f.puts message }
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
@@ -1,3 +1,3 @@
1
1
  module ParallelTests
2
- VERSION = Version = '2.17.1'
2
+ VERSION = Version = '2.18.0'
3
3
  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.17.1
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-10 00:00:00.000000000 Z
11
+ date: 2017-11-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parallel